-
Notifications
You must be signed in to change notification settings - Fork 784
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #694 +/- ##
=======================================
Coverage 82.44% 82.44%
=======================================
Files 168 168
Lines 47347 47365 +18
=======================================
+ Hits 39033 39051 +18
Misses 8314 8314
Continue to review full report at Codecov.
|
arrow/src/array/array_primitive.rs
Outdated
/// ``` | ||
/// use arrow::array::{Array, PrimitiveArray}; | ||
/// use arrow::datatypes::Int32Type; | ||
/// let arr: PrimitiveArray<Int32Type> = PrimitiveArray::from_iter_values(0..10); |
There was a problem hiding this comment.
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)); | ||
/// } | ||
/// ``` |
There was a problem hiding this comment.
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 👍
* Doctest for PrimitiveArray using from_iter_values. * Better example for building a PrimitiveArray.
* Doctest for PrimitiveArray using from_iter_values. * Better example for building a PrimitiveArray. Co-authored-by: Navin <[email protected]>
Which issue does this PR close?
re #302
// @alamb