Anurag-S1ngh opened a new pull request, #19164:
URL: https://github.com/apache/iceberg/pull/19164

   ## Summary
   
   `TruncateUtil.truncateInt` and `truncateLong` wrap the type minimum to a 
partition value near the top of the type's range when the width does not divide 
the range. With `truncate[1000]` on an int column, values from -2147483648 to 
-2147483001 truncate to 2147483296. The writer already emits that partition, 
but the range projections ignored it: `LessThan("x", 0)` projected to `x_trunc 
<= -1000`, which excludes 2147483296, so those rows were pruned. Strict `>` and 
`>=` projections had the opposite problem and could match the wrapped partition.
   
   ## Changes
   
   - `Transform` gains a `project(name, predicate, strict)` default method that 
returns an `Expression`, so a projection can be compound. The existing 
`project` and `projectStrict` keep returning `UnboundPredicate` and behave as 
before.
   - `Truncate` overrides it for int and long. Inclusive projections include 
the wrapped partition, strict projections only keep values that can match, and 
both fall back to the old single predicate when the width divides the type's 
range.
   - `Projections` and `ResidualEvaluator` call the expression-returning 
method, and the residual evaluator evaluates a compound projection against the 
partition tuple.
   - `ProjectionUtil` gets `truncateIntegerExpression`, 
`truncateLongExpression` and the shared `truncateWrapped` helper.
   
   ## Testing
   
   - `./gradlew :iceberg-api:test` on JDK 21, 1430 tests, no failures
   - `./gradlew :iceberg-core:test --tests org.apache.iceberg.TestFilePlanner 
--tests org.apache.iceberg.TestLocalDataTableScan`
   - `spotlessCheck` on `iceberg-api` and `iceberg-core`
   - New tests cover inclusive and strict projections at both ends of int and 
long, residuals, file planning and scans
   
   Closes #19075
   


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