NoahKusaba opened a new pull request, #117:
URL: https://github.com/apache/datafusion-iceberg/pull/117

   ## Which issue does this PR close?
   
   N/A. Refactor; no behavior change.
   
   ## Rationale for this change
   
   `read/predicate.rs` signals failure through `NotTransformed` variants on two 
ad-hoc enums instead of `Option`, so most match arms exist only to return 
`NotTransformed`, and one enum mixes columns and literals with finished 
predicates. Swapping a `literal op column` comparison goes through a 
hand-written `reverse_predicate_operator` with an `unreachable!`.
   
   ## What changes are included in this PR?
   
   - Conversion returns `Option` and uses `?`. Columns and literals come from 
`column(expr)` and `literal(expr)`, so only predicates are combined.
   - `Converted::{Exact, Implied}` replaces `Predicate`/`PartialPredicate`; the 
AND, OR and NOT soundness rules are unchanged.
   - `literal op column` uses DataFusion's `Operator::swap()`, removing 
`reverse_predicate_operator`.
   - Uses iceberg's `Reference` builders (`is_null`, `is_in`, `starts_with`, 
...) instead of building expressions by hand.
   - Marks three follow-ups with `TODO`: a boolean column as an AND/OR operand, 
LIKE `ESCAPE`, and `Decimal128` literals.
   
   ## Are there any user-facing changes?
   
   No. `convert_filters_to_predicate` returns the same predicates.
   
   ## Are these changes tested?
   
   Yes. Adds unit tests for behavior the refactor touches that wasn't covered: 
every reversed comparison (`1 <= foo`, ...), a bare boolean column inside AND 
and OR, `LIKE ... ESCAPE`, and comparisons that aren't column-to-literal. They 
pass on `main` too. I also compared the old and new conversion on about 40,000 
generated filters; all results were identical.
   


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