fix(iceberg): normalize decimal datum precision#5
Draft
abnobdoss wants to merge 1 commit into
Draft
Conversation
6a62ef7 to
f471f4f
Compare
f471f4f to
9f9b087
Compare
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.
What
Allows
Datum::to()to convert decimal Datum values between decimal types with the same scale when the unscaled value fits the target precision.This keeps scale conversion out of scope. A decimal with a different target scale still returns
DataInvalid.Why
Datum::decimal_from_str()creates decimal literals with max precision 38. Binding those literals against ordinary decimal columns such asdecimal(9, 2)fails even when the value fits and the scale matches.This change lets bind-time conversion normalize the precision while preserving the decimal value. The precision check is shared with
Datum::decimal_with_precision, so direct construction and bind-time conversion enforce the same decimal digit-precision rule.Tests
Adds coverage for:
decimal(1, 2)Datum::decimal_with_precisionDatum::decimal_from_str("3.14")againstdecimal(9, 2)after normalizationValidation run: