Dandandan commented on a change in pull request #1339:
URL: https://github.com/apache/arrow-datafusion/pull/1339#discussion_r753341351



##########
File path: datafusion/src/optimizer/filter_push_down.rs
##########
@@ -408,10 +412,20 @@ fn optimize(plan: &LogicalPlan, mut state: State) -> 
Result<LogicalPlan> {
             //
             // Join clauses with `Using` constraints also take advantage of 
this logic to make sure
             // predicates reference the shared join columns are pushed to both 
sides.
+            let mut null_unsafe_predicates = vec![];
             let join_side_filters = state
                 .filters
                 .iter()
                 .filter_map(|(predicate, columns)| {
+                    if join_type == &JoinType::Left
+                        || join_type == &JoinType::Right

Review comment:
       Yes, that's why I suggest to add the "safe" variants here instead, to 
not allow the safe variant by default if we would add another type.
   
   Even better would be IMO to extract this to a function 
   with a normal (without wildcard) pattern match. This way, when a new variant 
is added, it will be a compile error. 
   
   ```rust
   fn is_null_safe(join_type: JoinType) -> bool {
       match join_type...
   }
   ```
   
   It also makes sense to me that this would be a method on `JoinType`.




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


Reply via email to