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

   ### Feature Request / Improvement
   
   
   ### Apache Iceberg version
   
   main (unreleased)
   
   ### Query engine
   
   Any (Spark, Flink, etc.)
   
   ### Problem
   
   `ParquetFilters.convert()` has a TODO on line 45 acknowledging that 
`AlwaysFalse.INSTANCE` is not handled:
   
   ```java
   // TODO: handle AlwaysFalse.INSTANCE
   if (pred != null && pred != AlwaysTrue.INSTANCE) {
     return FilterCompat.get(pred);
   } else {
     return FilterCompat.NOOP;
   }
   ```
   
   When an Iceberg expression evaluates to `AlwaysFalse`, the visitor returns 
`AlwaysFalse.INSTANCE` — a custom `FilterPredicate` sentinel. Because it is 
non-null and not `AlwaysTrue.INSTANCE`, the condition passes and it gets 
wrapped via `FilterCompat.get(pred)`. Parquet's internal filter infrastructure 
has no knowledge of Iceberg's `AlwaysFalse` type, so the resulting filter 
behavior is undefined — it may read all rows instead of none.
   
   ### Expected behavior
   
   When the expression evaluates to `AlwaysFalse`, the convert method should 
either:
   - Return a filter that rejects all row groups (e.g., via a tautologically 
false Parquet predicate), or
   - Return `FilterCompat.NOOP` and let Iceberg's own row-group filtering 
handle the exclusion
   
   ### Proposed fix
   
   Add `AlwaysFalse.INSTANCE` to the condition:
   
   ```java
   if (pred != null && pred != AlwaysTrue.INSTANCE && pred != 
AlwaysFalse.INSTANCE) {
     return FilterCompat.get(pred);
   } else if (pred == AlwaysFalse.INSTANCE) {
     // construct a false predicate or signal no rows
   } else {
     return FilterCompat.NOOP;
   }
   ```
   
   ### Affected file
   
   ParquetFilters.java (line 45–50)
   
   
   ### 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