Copilot commented on code in PR #23411:
URL: https://github.com/apache/datafusion/pull/23411#discussion_r3550037774


##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -589,6 +589,13 @@ fn infer_join_predicates(
 
     let join_type = join.join_type;
 
+    // Null-aware anti joins implement NOT IN semantics, where NULLs on the
+    // right side affect the result. Inferring predicates across the join can
+    // incorrectly filter those NULLs.
+    if join_type == JoinType::LeftAnti && join.null_aware {
+        return Ok(vec![]);

Review Comment:
   This early-return for null-aware LeftAnti joins happens after 
`join_col_keys` is built, which does unnecessary work on a path that 
immediately exits. Consider moving the null-aware join check above the 
`join_col_keys` extraction to avoid iterating/allocating when inference is 
disabled.



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