abnobdoss opened a new pull request, #2508:
URL: https://github.com/apache/iceberg-rust/pull/2508

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   - Closes #.
   
   ## What changes are included in this PR?
   
   <!--
   Provide a summary of the modifications in this PR. List the main changes 
such as new features, bug fixes, refactoring, or any other updates.
   -->
   
   This fixes decimal-to-decimal `Datum::to()` conversion when the source and 
target decimal types have the same scale but different precision.
   
   I ran into this while working on Python predicate bindings: decimal literals 
constructed from Python values naturally enter the Rust API without the target 
column precision, so they need to be convertible during bind as long as the 
value fits and scale matches.
   
   Previously, a decimal datum created with the default maximum precision could 
fail to bind to a narrower decimal column, even when the value fit and the 
scale matched. This PR allows that conversion when the mantissa fits the target 
precision.
   
   Scale conversion remains out of scope. Decimal conversions with different 
source and target scales still return `DataInvalid`.
   
   ## Are these changes tested?
   
   <!--
   Specify what test covers (unit test, integration test, etc.).
   
   If tests are not included in your PR, please explain why (for example, are 
they covered by existing tests)?
   -->
   
   Yes. This adds unit coverage for decimal datum conversion, precision 
validation, and predicate binding behavior.
   
   Validation run:
   
   ```bash
   cargo fmt --check
   cargo test -p iceberg test_decimal_precision
   cargo test -p iceberg test_datum_to_decimal_
   cargo test -p iceberg test_datum_decimal_with_precision_
   cargo test -p iceberg test_bind_decimal
   cargo clippy -p iceberg --tests -- -D warnings
   ```
   
   ##### Was generative AI tooling used to co-author this PR?
   
   Yes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to