Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc improvements #3155

Merged
merged 9 commits into from Nov 24, 2022
Merged

Doc improvements #3155

merged 9 commits into from Nov 24, 2022

Conversation

psvri
Copy link
Contributor

@psvri psvri commented Nov 21, 2022

Which issue does this PR close?

Partially implements #37 .

Rationale for this change

Improves documentation for arrow-array and json

What changes are included in this PR?

Adds a whole bunch of doc comments

Are there any user-facing changes?

No

@github-actions github-actions bot added the arrow Changes to the arrow crate label Nov 21, 2022
@@ -45,61 +45,83 @@ pub trait ArrowNativeTypeOp: ArrowNativeType {
/// The multiplicative identity
const ONE: Self;

/// A checked add operation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A checked add operation
/// Checked addition operation

A seems redundant to me.

fn add_checked(self, rhs: Self) -> Result<Self, ArrowError>;

/// A wrapping add operation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A wrapping add operation
/// Wrapping addition operation

fn add_wrapping(self, rhs: Self) -> Self;

/// A checked subtract operation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A checked subtract operation
/// Checked subtraction operation

fn sub_checked(self, rhs: Self) -> Result<Self, ArrowError>;

/// A wrapping subtract operation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A wrapping subtract operation
/// Wrapping subtraction operation

fn div_wrapping(self, rhs: Self) -> Self;

/// A checked modulo operation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A checked modulo operation
/// Checked remainder operation

fn mod_checked(self, rhs: Self) -> Result<Self, ArrowError>;

/// A wrapping modulo operation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A wrapping modulo operation
/// Wrapping remainder operation

@@ -29,7 +29,9 @@ use std::any::Any;

/// trait declaring an offset size, relevant for i32 vs i64 array types.
pub trait OffsetSizeTrait: ArrowNativeType + std::ops::AddAssign + Integer {
/// True for 64 bit size and false for 32 bit size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// True for 64 bit size and false for 32 bit size
/// True for 64 bit offset size and false for 32 bit offset size

Comment on lines 208 to 209
/// An array where each element is a 128-bits decimal with precision in [1, 64] and
/// scale in [0, 64].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// An array where each element is a 128-bits decimal with precision in [1, 64] and
/// scale in [0, 64].
/// An array where each element is a 128-bits decimal with precision in [1, 76] and
/// scale in [0, 76].

Comment on lines 44 to 45
#[inline]
/// Returns the length of the buffer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we used to put doc on top of #[inline].

Suggested change
#[inline]
/// Returns the length of the buffer
/// Returns the length of the buffer
#[inline]

Comment on lines 120 to 121
#[inline]
/// Appends n `additional` bits of value `v` into the buffer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[inline]
/// Appends n `additional` bits of value `v` into the buffer
/// Appends `additional` bits of value `v` into the buffer
#[inline]

Comment on lines 171 to 172
#[inline]
/// Creates a [`Buffer`]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[inline]
/// Creates a [`Buffer`]
/// Creates a [`Buffer`] from this builder and resets this builder.
#[inline]

pub type Float64BufferBuilder = BufferBuilder<f64>;

/// A timestamp second array builder.
Copy link
Member

@viirya viirya Nov 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A timestamp second array builder.
/// Buffer builder for timestamp type of second unit.

pub type TimestampNanosecondBufferBuilder =
BufferBuilder<<TimestampNanosecondType as ArrowPrimitiveType>::Native>;

/// A 32-bit date array builder.
Copy link
Member

@viirya viirya Nov 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A 32-bit date array builder.
/// Buffer builder for 32-bit date type

/// builder.append(false).unwrap();
/// builder.append(true).unwrap();
///
/// let arr = builder.finish();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to add few asserts which confirms the values of built array. Like the docs of other builders do.

#[derive(Debug, Clone)]
pub struct MapFieldNames {
/// [`Field`] name for map
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// [`Field`] name for map
/// [`Field`] name for map entries

pub entry: String,
/// [`Field`] name for key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// [`Field`] name for key
/// [`Field`] name for map key

pub key: String,
/// [`Field`] name for value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// [`Field`] name for value
/// [`Field`] name for map value

@@ -78,10 +111,12 @@ impl<K: ArrayBuilder, V: ArrayBuilder> MapBuilder<K, V> {
}
}

/// Returns the keys of the map
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Returns the keys of the map
/// Returns the key array builder of the map

pub fn keys(&mut self) -> &mut K {
&mut self.key_builder
}

/// Returns the values of the map
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Returns the values of the map
/// Returns the value array builder of the map

@psvri
Copy link
Contributor Author

psvri commented Nov 24, 2022

Thanks for the comments. I will do the changes and request a review again after I resolve them.

@psvri psvri marked this pull request as draft November 24, 2022 14:05
@psvri psvri marked this pull request as ready for review November 24, 2022 14:08
@psvri psvri requested a review from viirya November 24, 2022 16:00
pub type DurationNanosecondArray = PrimitiveArray<DurationNanosecondType>;

/// An array where each element is a 128-bits decimal with precision in [1, 38] and
/// scale in [0, 38].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// scale in [0, 38].
/// scale in [-38, 38].

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mad, missed seeing the negative scale support in the recent commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

pub type Decimal128Array = PrimitiveArray<Decimal128Type>;
/// An array where each element is a 256-bits decimal with precision in [1, 76] and
/// scale in [0, 76].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// scale in [0, 76].
/// scale in [-76, 76].

@tustvold tustvold merged commit 2460c7b into apache:master Nov 24, 2022
@ursabot
Copy link

ursabot commented Nov 24, 2022

Benchmark runs are scheduled for baseline = 007fb4c and contender = 2460c7b. 2460c7b is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@psvri psvri deleted the doc-improvements branch November 25, 2022 12:34
@tustvold tustvold mentioned this pull request Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants