-
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
Add support of converting FixedSizeBinaryArray
to DecimalArray
#2041
Add support of converting FixedSizeBinaryArray
to DecimalArray
#2041
Conversation
Signed-off-by: remzi <[email protected]>
@HaoYang670 from the comments, why not change the builder for decimal in this pr. |
@liukun4515 |
) -> U { | ||
assert!( | ||
v.value_length() == Self::VALUE_LENGTH, | ||
"Value length of the array ({}) must equal to the byte width of the decimal ({})", |
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.
But from this message, this function is just used to convert to the decimal array.
@HaoYang670
cc @viirya |
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 good to me, although I am a little bit confused where we have ended up w.r.t validating decimals in ArrayData
arrow/src/array/array_decimal.rs
Outdated
v.value_length(), | ||
Self::VALUE_LENGTH, | ||
); | ||
|
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 could use the new APIs for this
let builder = v
.into_data()
.into_builder()
.data_type(DataType::Decimal(precision, scale));
Self::from(unsafe { builder.build_unchecked() });
Saves some clones and is slightly less verbose
Co-authored-by: Raphael Taylor-Davies <[email protected]>
Thank you @tustvold. The decimal values will be validated in the function |
Signed-off-by: remzi <[email protected]>
This is very much a testing only feature, this enables validation everywhere and will absolutely tank performance. It is a MIRI-light, meant for integration testing and not production usage.
That is likely because the general assumption within arrow-rs is you can't construct an invalid ArrayData without using an unsafe API. This does not appear to be true of Decimal, at least at the moment |
Hmm, the failure seems related to the CI env. Also find the same failrue in #2056 |
Codecov Report
@@ Coverage Diff @@
## master #2041 +/- ##
==========================================
+ Coverage 83.54% 83.61% +0.06%
==========================================
Files 222 223 +1
Lines 58186 58567 +381
==========================================
+ Hits 48612 48970 +358
- Misses 9574 9597 +23
Continue to review full report at Codecov.
|
Signed-off-by: remzi <[email protected]>
@alamb could you please help to look at what causes the CI failure? |
The failure randomly occurred, such as in #2064. |
Thanks @HaoYang670 -- I don't really have any idea what is going on with the windows builders. I have restarted the failed job and hopefully the tests will pass on a subsequent run |
Benchmark runs are scheduled for baseline = 7fff23f and contender = 9d8f0c9. 9d8f0c9 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Thank you for your review @liukun4515 @viirya @tustvold @alamb ! |
Signed-off-by: remzi [email protected]
Which issue does this PR close?
None.
Related to #2026.
Rationale for this change
What changes are included in this PR?
Add new function
from_fixed_size_binary_array
Are there any user-facing changes?
No.