fix(literals): return long bounds for decimal conversion#3470
Open
abnobdoss wants to merge 1 commit into
Open
Conversation
ebyhr
approved these changes
Jun 7, 2026
Member
ebyhr
left a comment
There was a problem hiding this comment.
The change makes sense to me. I've verified that the added tests are valid regression tests that fail without this PR's change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3469
Rationale for this change
Decimal literals converted to
LongTypeshould 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
LongAboveMaxandLongBelowMinfor decimal-to-long overflow.Relationship to Java
Java's
DecimalLiteral.to(...)only handlesDECIMALand returnsnullfor other target types (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
LongTyperange.Are there any user-facing changes?
Yes. Decimal literal conversion to
LongTypenow reports overflow with the correct long sentinel type.