Revanth14 opened a new issue, #18700:
URL: https://github.com/apache/iceberg/issues/18700

   ### Feature Request / Improvement
   
   ## Problem
   `UnboundPredicate.bindLiteralOperation` folds a comparison whose literal 
converts to `aboveMax()` or `belowMin()` into `alwaysTrue` or `alwaysFalse`. 
That is exact for integers, but not on a float column: `x < 1e100` binds to 
`alwaysTrue`, yet it is false for NaN and `+Inf` and unknown for null, and `x > 
1e100` binds to `alwaysFalse` although it is true for `+Inf`.
   
   `DoubleLiteral.to(FLOAT)` also maps `±Infinity` to 
`aboveMax()`/`belowMin()`, although infinity is a float value. On a float 
column, `x = Double.POSITIVE_INFINITY` and `x >= Double.POSITIVE_INFINITY` 
therefore bind to `alwaysFalse` and never match `+Inf` rows, and `x <= 
Double.POSITIVE_INFINITY` binds to `alwaysTrue`, which also matches NaN.
   
   ## Proposal
   - Convert an infinite double to the float infinity in 
`DoubleLiteral.to(FLOAT)`.
   - On a floating-point term, bind an ordering comparison against a finite 
out-of-range literal to a comparison against the largest finite value: `x < 
1e100` and `x <= 1e100` become `x <= Float.MAX_VALUE`, `x > 1e100` and `x >= 
1e100` become `x > Float.MAX_VALUE`, and the same below the minimum. Every 
float except `+Inf` lies below such a literal, so NaN, the infinities and null 
then compare as they do against the literal itself.
   
   `EQ` and `NOT_EQ` can keep their folds.
   
   ## Context
   iceberg-go made this change in apache/iceberg-go#2355, so the two 
implementations now bind these filters differently.
   
   
   ### Query engine
   
   None
   
   ### Willingness to contribute
   
   - [x] I can contribute this improvement/feature independently
   - [ ] I would be willing to contribute this improvement/feature with 
guidance from the Iceberg community
   - [ ] I cannot contribute this improvement/feature at this time


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