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

Doctest for PrimitiveArray using from_iter_values. #694

Merged
merged 2 commits into from
Aug 19, 2021

Conversation

novemberkilo
Copy link
Contributor

Which issue does this PR close?

re #302

// @alamb

@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 15, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 15, 2021

Codecov Report

Merging #694 (8c58a99) into master (1a5c26b) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #694   +/-   ##
=======================================
  Coverage   82.44%   82.44%           
=======================================
  Files         168      168           
  Lines       47347    47365   +18     
=======================================
+ Hits        39033    39051   +18     
  Misses       8314     8314           
Impacted Files Coverage Δ
arrow/src/array/array_primitive.rs 94.38% <ø> (ø)
arrow/src/array/equal_json.rs 84.92% <0.00%> (-0.29%) ⬇️
arrow/src/array/builder.rs 86.13% <0.00%> (+0.15%) ⬆️
parquet/src/encodings/encoding.rs 94.67% <0.00%> (+0.19%) ⬆️

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 1a5c26b...8c58a99. Read the comment docs.

/// ```
/// use arrow::array::{Array, PrimitiveArray};
/// use arrow::datatypes::Int32Type;
/// let arr: PrimitiveArray<Int32Type> = PrimitiveArray::from_iter_values(0..10);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the example could be slightly more complex to show that's not just a range?

E.g. (0..10).map(|x| x +1)?

/// for i in 0..10i32 {
/// assert_eq!(i + 1, arr.value(i as usize));
/// }
/// ```
Copy link
Contributor

Choose a reason for hiding this comment

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

I am also hoping we could document creating an array using collect such as

let arr : Int32Array = [Some(1), Some(2)].into_iter().collect();

I am not sure if that is already documented but this documentation on PrimitiveArray is already much better than nothing @novemberkilo 👍

@Dandandan Dandandan added the documentation Improvements or additions to documentation label Aug 18, 2021
@alamb alamb merged commit 38e5d22 into apache:master Aug 19, 2021
alamb pushed a commit that referenced this pull request Aug 19, 2021
* Doctest for PrimitiveArray using from_iter_values.

* Better example for building a PrimitiveArray.
alamb added a commit that referenced this pull request Aug 20, 2021
* Doctest for PrimitiveArray using from_iter_values.

* Better example for building a PrimitiveArray.

Co-authored-by: Navin <[email protected]>
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 documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants