-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
When arrow construct a decimal array, we need to verify the data of decimal with the precision.
From current implemention
arrow-rs/arrow/src/datatypes/datatype.rs
Line 456 in d87f6a4
| pub(crate) fn validate_decimal_precision(value: i128, precision: usize) -> Result<i128> { |
arrow-rs/arrow/src/datatypes/datatype.rs
Line 485 in d87f6a4
| pub(crate) fn validate_decimal256_precision( |
We compare the decimal using i128 or string, it may be inefficient.
optimize the validation using the byte array instead of i128 or string.
Describe the solution you'd like
For exmaple, precision 3, The max value is i128.to_le_byte(999), and the min value if i128.to_le_byte(-999).
Comparing the decimal128(value,precision,scale) just need to compare the value ([u8;16]) with the min and max.
Describe alternatives you've considered
Additional context