Commit b231705
fix(literals): Return Long bounds for Decimal conversion (#3470)
Closes #3469
# Rationale for this change
Decimal literals converted to `LongType` should use long bound sentinels
when the value is outside the long range. The existing conversion
returned integer sentinels, mismatching the requested target type.
This returns `LongAboveMax` and `LongBelowMin` for decimal-to-long
overflow.
### Relationship to Java
Java's `DecimalLiteral.to(...)` only handles `DECIMAL` and returns
`null` for other target types
([`Literals.java#L497-L505`](https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/expressions/Literals.java#L497-L505)),
so there is no direct decimal-to-long branch to mirror. This keeps
PyIceberg's long conversion consistent with its typed integer overflow
handling. Java's generic valueless overflow sentinels are a broader
semantic difference and are out of scope here.
## Are these changes tested?
Yes. New literal tests cover decimal values above and below the
`LongType` range.
## Are there any user-facing changes?
Yes. Decimal literal conversion to `LongType` now reports overflow with
the correct long sentinel type.
Co-authored-by: Abanoub Doss <abanoub.doss@gmail.com>1 parent 835e13a commit b231705
2 files changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
| 529 | + | |
530 | 530 | | |
531 | | - | |
| 531 | + | |
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
878 | 879 | | |
879 | 880 | | |
880 | 881 | | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
881 | 890 | | |
882 | 891 | | |
883 | 892 | | |
| |||
0 commit comments