sahuadarsh0 commented on issue #19075: URL: https://github.com/apache/iceberg/issues/19075#issuecomment-7067380616
Two details worth noting when designing the fix in `api`: 1. **`Transform.project` / `projectStrict` return type:** Both methods in `org.apache.iceberg.transforms.Transform` (lines 115, 128) return `UnboundPredicate<T>` rather than `Expression`. Representing `x_trunc <= -1000 OR x_trunc == 2147483296` (or `x_trunc > 0 AND x_trunc != 2147483296` for strict projection) requires a compound `Expression`. Without either returning `null` (which disables `<`/`<=` partition pruning for any non-power-of-2 width) or introducing an `Expression`-returning projection hook used by `Projections` and `ResidualEvaluator`, a single `UnboundPredicate` cannot include the wrapped partition without widening the range. 2. **Strict projection for `GT` / `GT_EQ`:** For non-power-of-2 widths, `TruncateUtil.truncateInt` wraps values near `Integer.MIN_VALUE` into the top of the positive range (e.g., `truncate[1000](Integer.MIN_VALUE) == 2147483296`, and for `truncate[7]`, `truncateInt(7, Integer.MIN_VALUE) == 2147483643 < truncateInt(7, Integer.MAX_VALUE) == 2147483646`). In `ProjectionUtil.truncateIntegerStrict` / `truncateLongStrict`, `GT(0)` currently projects to `x_trunc > 0`, which matches the wrapped partition even though none of its rows satisfy `x > 0` (so `ResidualEvaluator` evaluates the residual to `alwaysTrue()`). -- 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]
