Describe the bug
Best I can tell from the code:
- parsing the string
"1.99" as a scale-1 decimal produces 1.9
- casting the scale-2 decimal
1.99 to scale-1 produces 2.0
To Reproduce
// 1.99 -> 1.9 at scale 1, stored as 19
assert_eq!(parse_decimal::<Decimal128Type>("1.99", 10, 1), Ok(19));
vs
let input = Decimal128Array::from(vec![Some(199i128)])
.with_precision_and_scale(10, 2)
.unwrap();
let out = cast(&input, &DataType::Decimal128(10, 1)).unwrap();
// 1.99 → 2.0 at scale=1, stored as 20
assert_eq!(out.as_primitive::<Decimal128Type>().value(0), 20i128);
Expected behavior
It seems like the two operations should have the same behavior, likely 2.0?
Additional context
Rabbit-hole off of #8700 (comment)