viirya opened a new pull request, #23901:
URL: https://github.com/apache/datafusion/pull/23901

   ## Which issue does this PR close?
   
   - Closes #23900.
   
   ## Rationale for this change
   
   `push_down_filter` infers equi-key predicates across a join's ON keys and 
pushes them to the opposite side. For a null-aware join (the `LeftAnti` join 
produced by `NOT IN` with a nullable subquery), an outer predicate on the left 
key like `outer.id > 5` is rewritten to `sub.id > 5` and pushed onto the 
subquery input. Since the inferred predicate must be null-rejecting to be 
pushed, this drops the subquery's NULL rows and breaks the three-valued `NOT 
IN` semantics — a NULL in the subquery key must reach the join so the result is 
empty.
   
   Same class of bug as #23848, in a different rule.
   
   ## What changes are included in this PR?
   
   - Skip predicate inference in `infer_join_predicates` when `join.null_aware` 
is set (mirrors the #23848 guard on `FilterNullJoinKeys`).
   - A `push_down_filter` unit test asserting no predicate is inferred onto the 
subquery side of a null-aware `LeftAnti` join.
   - SLT coverage for the failing query, plus a `prefer_hash_join = false` / 
multi-partition variant.
   
   ## Are these changes tested?
   
   Yes — new unit test (verified it fails without the guard) and SLT cases. The 
full optimizer lib suite passes.
   
   ## Are there any user-facing changes?
   
   No, aside from the correctness fix.
   


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