-
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
Doctests for DecimalArray. #414
Conversation
cc/ @alamb |
/// assert_eq!(-8_887_000_000, decimal_array.value(1)); | ||
/// assert_eq!(16, decimal_array.value_length()); | ||
/// assert_eq!(23, decimal_array.precision()); | ||
/// assert_eq!(6, decimal_array.scale()); |
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.
@alippai has an improvement for string formatting decimal values in #406
If he adds the method to DecimalArray
in #406 (comment) it would be neat to also add it to the doc test.
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.
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.
You'll be able to add assert_eq!("8887.000000", decimal_array.value_as_string(0));
when I finish the PR. Also I'd keep the assert_eq!(8_887_000_000, decimal_array.value(0));
example (to show the values are i128 values)
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.
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.
@novemberkilo now it's merged, thanks for your patience
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.
arrow/src/array/array_binary.rs
Outdated
/// # Examples | ||
/// | ||
/// ``` | ||
/// use arrow::array::{ArrayData, Array, DecimalArray}; |
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 think using the DecimalBuilder
to construct a DecimalArray may make for a better example:
For example, here: https://github.com/apache/arrow-rs/blob/master/arrow/src/array/builder.rs#L2856
Codecov Report
@@ Coverage Diff @@
## master #414 +/- ##
==========================================
- Coverage 82.64% 82.64% -0.01%
==========================================
Files 164 164
Lines 45508 45508
==========================================
- Hits 37609 37608 -1
- Misses 7899 7900 +1
Continue to review full report at Codecov.
|
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.
Looks great -- thank you @novemberkilo
/// | ||
/// assert_eq!(&DataType::Decimal(23, 6), decimal_array.data_type()); | ||
/// assert_eq!(8_887_000_000, decimal_array.value(0)); | ||
/// assert_eq!("8887.000000", decimal_array.value_as_string(0)); |
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.
❤️
Which issue does this PR close?
re #301
What changes are included in this PR?
Doctests only
Are there any user-facing changes?
No