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

Add doc example for creating FixedSizeListArray #1426

Conversation

HaoYang670
Copy link
Contributor

Signed-off-by: remzi 13716567376yh@gmail.com

Which issue does this PR close?

Closes #1392.

Signed-off-by: remzi <13716567376yh@gmail.com>
@github-actions github-actions bot added the arrow Changes to the arrow crate label Mar 11, 2022
/// .add_buffer(Buffer::from_slice_ref(&[0, 1, 2, 3, 4, 5, 6, 7, 8]))
/// .build()
/// .unwrap();
//// // Construct a list array from the above two
Copy link
Member

Choose a reason for hiding this comment

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

Extra space

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.

@jackwener
Copy link
Member

BTW, I found that some examples include many assert_check. Just there is a question for me, is it necessary to include many checks in the example?

/// .add_buffer(Buffer::from_slice_ref(&[0, 1, 2, 3, 4, 5, 6, 7, 8]))
/// .build()
/// .unwrap();
//// // Construct a list array from the above two
Copy link
Member

Choose a reason for hiding this comment

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

"from above two"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

delete the comment.

Actually, I copied the comment from https://github.com/apache/arrow-rs/blob/master/arrow/src/array/array_list.rs#L692

@@ -342,6 +342,46 @@ pub type LargeListArray = GenericListArray<i64>;

/// A list array where each element is a fixed-size sequence of values with the same
/// type whose maximum length is represented by a i32.
/// # Example
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we add a blank line before?

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

/// assert_eq!(0, list_array.null_count());
/// assert_eq!(6, list_array.value_offset(2));
/// assert_eq!(3, list_array.value_length());
/// assert_eq!(
Copy link
Member

Choose a reason for hiding this comment

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

maybe it's clearer to compare whole array content here, for instance, checking list_array.value(1) is [0, 1, 2], list_array.value(2) is [3, 4, 5], etc.

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!

Signed-off-by: remzi <13716567376yh@gmail.com>
Signed-off-by: remzi <13716567376yh@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #1426 (6cc1876) into master (4bcc7a6) will decrease coverage by 0.49%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1426      +/-   ##
==========================================
- Coverage   83.17%   82.68%   -0.50%     
==========================================
  Files         182      185       +3     
  Lines       53439    53822     +383     
==========================================
+ Hits        44449    44502      +53     
- Misses       8990     9320     +330     
Impacted Files Coverage Δ
arrow/src/array/array_list.rs 95.52% <ø> (ø)
arrow/src/array/array_binary.rs 92.62% <0.00%> (-0.67%) ⬇️
arrow/src/datatypes/datatype.rs 66.40% <0.00%> (-0.40%) ⬇️
arrow/src/array/transform/mod.rs 86.31% <0.00%> (-0.12%) ⬇️
arrow/src/compute/kernels/substring.rs 98.24% <0.00%> (-0.04%) ⬇️
arrow-flight/src/lib.rs 18.54% <0.00%> (ø)
arrow/src/compute/kernels/window.rs 100.00% <0.00%> (ø)
arrow-flight/src/sql/mod.rs 0.00% <0.00%> (ø)
arrow-flight/examples/flight_sql_server.rs 0.00% <0.00%> (ø)
arrow-flight/src/sql/server.rs 0.00% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4bcc7a6...6cc1876. Read the comment docs.

Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

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

LGTM

@sunchao sunchao merged commit 729934c into apache:master Mar 12, 2022
@sunchao
Copy link
Member

sunchao commented Mar 12, 2022

Merged, thanks!

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.

Add doc examples for creating FixedSizeListArray
4 participants