jonahgao opened a new issue, #4829:
URL: https://github.com/apache/arrow-rs/issues/4829
**Describe the bug**
Casting from string to decimal does not perform a precision overflow check.
**To Reproduce**
```rust
use arrow::array::types::Decimal128Type;
use arrow::array::{AsArray, StringArray};
use arrow::compute::{cast_with_options, CastOptions};
use arrow::datatypes::DataType;
fn main() {
let str_array = StringArray::from(vec!["1000".to_string()]);
let output_type = DataType::Decimal128(10, 8);
let mut option = CastOptions::default();
option.safe = false;
let casted_array = cast_with_options(&str_array, &output_type,
&option).unwrap();
let decimal_array = casted_array.as_primitive::<Decimal128Type>();
println!("{:?}", decimal_array.value_as_string(0));
}
```
The execution result of the above program is "10.00000000".
**Expected behavior**
<!--
A clear and concise description of what you expected to happen.
-->
It should panic and report an overflow.
**Additional context**
<!--
Add any other context about the problem here.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]