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
{{ message }}
Repository navigation
Negative-scale Decimals (e.g. 1E+2) are corrupted by DecimalLiteral.increment/decrement and truncate_decimal #4284
Three decimal helpers still read a Decimal's scale as abs(int(value.as_tuple().exponent)). A Python Decimal carries the negated scale as its exponent, so a value with a non-negative exponent — e.g. Decimal("1E+2") (100 with scale −2) — is misread as having a positive scale of 2. This is the same root cause as #3997, which fixed three call sites; these remaining ones were not covered:
increment()/decrement() are used by the range-projection helpers in pyiceberg/transforms.py, so any future path that hands them a negative-scale Decimal produces bounds on the wrong order of magnitude. Schema-typed paths currently reject such decimals at bind time (fixed by #3997 in to(DecimalType)), which is why this went unnoticed — but the helpers themselves still return corrupted values for valid Decimal input.
Willingness to contribute
Yes. I will be willing to submit a PR for this bug.
Transparent disclosure: this issue was investigated and filed with AI assistance (reproduction verified locally on main @ e3564a5).
Activity