LuciferYang opened a new pull request, #18413:
URL: https://github.com/apache/iceberg/pull/18413

   Closes #18411.
   
   `BoundSetPredicate.literalSet()` holds raw values, but since #15224 
`ExpressionUtil` casts each of them to `Literal<?>`, so sanitizing a bound 
`IN`/`NOT_IN` with two or more values throws `ClassCastException`. The 
`StructType` overloads catch it and sanitize the unbound filter instead. 
`SnapshotScan` takes that path for the scan report filter, so one `IN` drops 
type-aware sanitizing for every predicate in the filter: `ts > 
(timestamp-1-hours-ago)` is reported as `ts > (16-digit-int)`.
   
   This sanitizes set elements by the bound term's type, as the code did before 
#15224. Converting each value back into a literal with 
`Literals.from(value).to(type)` would be shorter, but it gets `timestamp_ns` 
wrong because `LongLiteral.to` treats the long as micros. The restored switch 
leaves out the extra `/ 1000` the pre-#15224 version applied to nanos, which 
put every `timestamp_ns` value in the `(timestamp)` bucket.
   
   New tests in `TestExpressionUtil`:
   - `testSanitizeBoundIn`: bound `IN`/`NOT_IN` through both sanitizers.
   - `testSanitizeInWithStructUsesColumnType`: the `SnapshotScan` path, with 
micros values bucketed as timestamps, also next to an `IN`.
   - `testSanitizeBoundTimestampNanoIn`: fails if the nanos double conversion 
comes back.
   - `testSanitizeBoundDateIn`: date set values.
   
   ---
   **AI Disclosure**
   - Model: Claude Opus
   - Human Oversight: reviewed
   


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