You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect results when casting large strings to Decimal256 #10665
When casting strings to Decimal256, an input whose unscaled value exceeds the i256 range is handled incorrectly; it is converted to an incorrect result value (due to wrapping of the internal i256 representation), rather than being rejected.
To Reproduce
```rust
use arrow_array::{cast::AsArray, types::Decimal256Type, StringArray};
use arrow_cast::{cast_with_options, CastOptions};
use arrow_schema::DataType;
use std::sync::Arc;
fn main() {
// ~7.2 x 10^64: 65 integer digits and 33 fractional digits
let input = "72167486952390333280550343777716101824043691957654319462507011489.831702916080743443465428641160496";
let array = Arc::new(StringArray::from(vec![input])) as arrow_array::ArrayRef;
let options = CastOptions { safe: false, ..Default::default() };
let result = cast_with_options(&array, &DataType::Decimal256(76, 17), &options).unwrap();
println!("{}", result.as_primitive::<Decimal256Type>().value_as_string(0));
}
Activity
perf(arrow-cast): optimize parsing of decimals from strings (apache#1…
perf(arrow-cast): optimize parsing of decimals from strings (apache#1…
perf(arrow-cast): optimize parsing of decimals from strings (apache#1…
perf(arrow-cast): optimize parsing of decimals from strings (apache#1…
perf(arrow-cast): optimize parsing of decimals from strings (apache#1…
perf(arrow-cast): optimize parsing of decimals from strings (apache#1…
perf(arrow-cast): optimize parsing of decimals from strings (apache#1…
perf(arrow-cast): optimize parsing of decimals from strings (apache#1…