Jefffrey opened a new issue, #9201:
URL: https://github.com/apache/arrow-rs/issues/9201
**Is your feature request related to a problem or challenge? Please describe
what you are trying to do.**
<!--
A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]
(This section helps Arrow developers understand the context and *why* for
this feature, in addition to the *what*)
-->
Casting of decimals with negative scale
**Describe the solution you'd like**
<!--
A clear and concise description of what you want to happen.
-->
Example test:
```rust
// arrow-cast/src/cast/mod.rs
#[test]
fn test_cast_decimal_to_numeric_negative_scale() {
let value_array: Vec<Option<i256>> = vec![
Some(i256::from_i128(125)),
Some(i256::from_i128(225)),
Some(i256::from_i128(325)),
None,
Some(i256::from_i128(525)),
];
let array = create_decimal256_array(value_array, 38, -1).unwrap();
generate_cast_test_case!(
&array,
Int64Array,
&DataType::Int64,
vec![Some(1_250), Some(2_250), Some(3_250), None, Some(5_250)]
);
}
```
Currently this fails with error:
```bash
failures:
---- cast::tests::test_cast_decimal_to_numeric_negative_scale stdout ----
thread 'cast::tests::test_cast_decimal_to_numeric_negative_scale' (5901100)
panicked at arrow-cast/src/cast/mod.rs:3725:9:
called `Result::unwrap()` on an `Err` value: CastError("Cannot cast to
\"Decimal256\". The scale -1 causes overflow.")
failures:
cast::tests::test_cast_decimal_to_numeric_negative_scale
test result: FAILED. 304 passed; 1 failed; 0 ignored; 0 measured; 0 filtered
out; finished in 0.01s
error: test failed, to rerun pass `-p arrow-cast --lib`
```
Would be nice if we can make this work.
**Describe alternatives you've considered**
<!--
A clear and concise description of any alternative solutions or features
you've considered.
-->
**Additional context**
<!--
Add any other context or screenshots about the feature request here.
-->
Related code sections
https://github.com/apache/arrow-rs/blob/1db1a8869cceb179aa885ed58da9f0b49c03eafe/arrow-cast/src/cast/decimal.rs#L819-L825
--
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]