Describe the bug
If I try and cast floating-point value 12345.67 to decimal(6,2) then I get an error, as expected:
"1234567 is too large to store in a Decimal128 of precision 6. Max is 999999"
However, if I try and cast a decimal(24,2) value of 12345.67 to decimal(6,2) then I do not get an error but instead have an invalid decimal value.
PrimitiveArray<Decimal128(6, 2)>
[
1234567,
]
If I then convert this decimal to a string, it produces 1234.56 instead of 12345.67
StringArray
[
"1234.56",
]
To Reproduce
Expected behavior
Additional context
This is the root cause of apache/datafusion#13492