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
With datafusion-cli built from latest develop, and also from this arrow bump commit a407500:
> select cast(cast('5.20' as decimal(4,2)) as decimal(3,2)), cast(cast(5.20 as decimal(4,2)) as decimal(3,2));
+--------------+--------------+
| Utf8("5.20") | Float64(5.2) |
+--------------+--------------+
| 5.21 | 5.21 |
+--------------+--------------+
1 row(s) fetched.
Elapsed 0.007 seconds.
Expected behavior
With commit 3082ac6807d3bac1dae1e8fb31490d2aa1aec19d (pre- arrow bump):
DataFusion CLI v44.0.0
> select cast(cast('5.20' as decimal(4,2)) as decimal(3,2)), cast(cast(5.20 as decimal(4,2)) as decimal(3,2));
+--------------+--------------+
| Utf8("5.20") | Float64(5.2) |
+--------------+--------------+
| 5.20 | 5.20 |
+--------------+--------------+
1 row(s) fetched.
Elapsed 0.017 seconds.
Additional context
Couple other examples:
> select cast(cast('5.20' as decimal(5,3)) as decimal(4,3)) as a, cast(cast('5.20' as decimal(5,2)) as decimal(3,2)) as b, cast(cast('5.20' as decimal(5,3)) as decimal(4,2)) as c;
+-------+------+------+
| a | b | c |
+-------+------+------+
| 5.201 | 5.21 | 5.20 |
+-------+------+------+
1 row(s) fetched.
> select cast(cast('5.20' as decimal(4,2)) as decimal(2,2));
Arrow error: Invalid argument error: 521 is too large to store in a Decimal128 of precision 2. Max is 99
> select cast(cast('5.20' as decimal(5,3)) as decimal(3,3));
Arrow error: Invalid argument error: 5201 is too large to store in a Decimal128 of precision 3. Max is 999
where does that additional +1 come from?
The text was updated successfully, but these errors were encountered:
Describe the bug
Converting a decimal
5.20
from (4,2) to (3,2) leads to the value becoming5.21
Something's gone wrong likely in the fixing of #13492 / apache/arrow-rs#6833?
Or, maybe there's some existing bug in the creation of the decimal array in the first place, and the Arrow bug was hiding it before?
Fyi @alamb @andygrove
To Reproduce
With datafusion-cli built from latest develop, and also from this arrow bump commit a407500:
Expected behavior
With commit
3082ac6807d3bac1dae1e8fb31490d2aa1aec19d
(pre- arrow bump):Additional context
Couple other examples:
where does that additional +1 come from?
The text was updated successfully, but these errors were encountered: