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

   ### Feature Request / Improvement
   
   StrictMetricsEvaluator.notStartsWith currently always returns 
ROWS_MIGHT_NOT_MATCH, ignoring file-level column bounds entirely. There is an 
existing [TODO in the 
code](https://github.com/apache/iceberg/blob/9a939d68358de9dac2c6ba9b236b675ebe477490/api/src/main/java/org/apache/iceberg/expressions/StrictMetricsEvaluator.java#L470):
   ```
   // TODO: Handle cases that definitely cannot match, such as 
notStartsWith("x") when the bounds
   // are ["a", "b"].
   ```
   
   When the column's lower and upper bounds prove that no value in the file can 
start with the given prefix, the evaluator should return ROWS_MUST_MATCH. This 
allows the engine to skip unnecessary row-level filtering for NOT STARTS WITH 
predicates, improving query performance on string-heavy workloads.
   
   Specifically, the evaluator can determine that all rows match NOT STARTS 
WITH <prefix> when:
   
   - The column contains only null values
   - The lower bound (truncated to the shorter of prefix/bound length) is 
strictly greater than the prefix — all values are above the prefix range
   - The upper bound (truncated to the shorter of prefix/bound length) is 
strictly less than the prefix — all values are below the prefix range
   
   This mirrors how notEq and notIn already use bounds in the same evaluator.
   
   
   
   ### 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