Skip to content

Doc improvements#3155

Merged
tustvold merged 9 commits into
apache:masterfrom
psvri:doc-improvements
Nov 24, 2022
Merged

Doc improvements#3155
tustvold merged 9 commits into
apache:masterfrom
psvri:doc-improvements

Conversation

@psvri

@psvri psvri commented Nov 21, 2022

Copy link
Copy Markdown
Contributor

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
Comment thread arrow-array/src/arithmetic.rs Outdated
/// The multiplicative identity
const ONE: Self;

/// A checked add operation

Copy link
Copy Markdown
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.

Comment thread arrow-array/src/arithmetic.rs Outdated
/// A checked add operation
fn add_checked(self, rhs: Self) -> Result<Self, ArrowError>;

/// A wrapping add operation

Copy link
Copy Markdown
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

Comment thread arrow-array/src/arithmetic.rs Outdated
/// A wrapping add operation
fn add_wrapping(self, rhs: Self) -> Self;

/// A checked subtract operation

Copy link
Copy Markdown
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

Comment thread arrow-array/src/arithmetic.rs Outdated
/// A checked subtract operation
fn sub_checked(self, rhs: Self) -> Result<Self, ArrowError>;

/// A wrapping subtract operation

Copy link
Copy Markdown
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

Comment thread arrow-array/src/arithmetic.rs Outdated
/// A wrapping division operation
fn div_wrapping(self, rhs: Self) -> Self;

/// A checked modulo operation

Copy link
Copy Markdown
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

Comment thread arrow-array/src/arithmetic.rs Outdated
/// A checked modulo operation
fn mod_checked(self, rhs: Self) -> Result<Self, ArrowError>;

/// A wrapping modulo operation

Copy link
Copy Markdown
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

Comment thread arrow-array/src/array/list_array.rs Outdated

/// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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]

/// A 64-bit floating point buffer builder.
pub type Float64BufferBuilder = BufferBuilder<f64>;

/// A timestamp second array builder.

@viirya viirya Nov 24, 2022

Copy link
Copy Markdown
Member

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.

@viirya viirya Nov 24, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

Comment thread arrow-array/src/builder/map_builder.rs Outdated
/// Contains details of the mapping
#[derive(Debug, Clone)]
pub struct MapFieldNames {
/// [`Field`] name for map

Copy link
Copy Markdown
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

Comment thread arrow-array/src/builder/map_builder.rs Outdated
pub struct MapFieldNames {
/// [`Field`] name for map
pub entry: String,
/// [`Field`] name for key

Copy link
Copy Markdown
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

Comment thread arrow-array/src/builder/map_builder.rs Outdated
pub entry: String,
/// [`Field`] name for key
pub key: String,
/// [`Field`] name for value

Copy link
Copy Markdown
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

Comment thread arrow-array/src/builder/map_builder.rs Outdated
}
}

/// Returns the keys of the map

Copy link
Copy Markdown
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

Comment thread arrow-array/src/builder/map_builder.rs Outdated
&mut self.key_builder
}

/// Returns the values of the map

Copy link
Copy Markdown
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

psvri commented Nov 24, 2022

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

/// scale in [0, 38].
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
Copy Markdown
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

ursabot commented Nov 24, 2022

Copy link
Copy Markdown

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.

4 participants