yadavay-amzn opened a new pull request, #16074:
URL: https://github.com/apache/iceberg/pull/16074

   Fixes https://github.com/apache/iceberg/issues/15502
   
   ## Problem
   
   When an Iceberg table has manifests written using a partition spec with 
`identity`-transformed timestamp field, queries that filter on that field using 
a temporal transform like `hours()` fail with:
   
   ```
   ValidationException: Invalid value for conversion to type timestamptz: 
490674 (java.lang.Integer)
   ```
   
   `Identity.projectStrict()` creates an unbound predicate with the literal 
from the input predicate. When the predicate term is a transform (e.g. 
`hours(ts) = 490674`), the literal type (integer) does not match the partition 
field type (timestamptz), causing a `ValidationException` when the unbound 
predicate is later bound to the partition schema.
   
   ## Fix
   
   Return `null` from `projectStrict()` when the predicate term is not a 
`BoundReference`, indicating the identity transform cannot project 
transform-based predicates. This causes the projection to fall back to 
`alwaysTrue` (inclusive) or `alwaysFalse` (strict), which is the correct 
behavior.
   
   The fix is a 4-line guard clause at the top of `projectStrict()`. Since 
`project()` delegates to `projectStrict()`, both paths are covered.
   
   ## Testing
   
   Added a regression test in `TestProjection` that reproduces the exact 
scenario from the issue: identity-partitioned `timestamptz` field filtered with 
`hours()` transform, verifying both inclusive and strict projections.


-- 
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