abnobdoss opened a new pull request, #3470: URL: https://github.com/apache/iceberg-python/pull/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 bound sentinels, which mismatched the requested target type. This returns `LongAboveMax` and `LongBelowMin` from decimal-to-long conversion. ### Relationship to Java PyIceberg supports decimal-to-long literal conversion, while Java does not: 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)). There is no direct Java conversion branch to mirror here, so this fix makes PyIceberg's long conversion use the typed overflow sentinels that match the requested target type, consistent with the existing integer overflow handling. One remaining divergence is out of scope: Java uses generic valueless singleton sentinels for above-max and below-min whose `value()` methods throw (`AboveMax` [`#L183`](https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/expressions/Literals.java#L183), `BelowMin` [`#L209`](https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/expressions/Literals.java#L209)), while PyIceberg's typed sentinels carry the target type's boundary value. This PR only corrects the sentinel type returned by decimal-to-long overflow. ## 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. -- 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]
