alamb commented on a change in pull request #1618:
URL: https://github.com/apache/arrow-datafusion/pull/1618#discussion_r791130261



##########
File path: datafusion/src/optimizer/filter_push_down.rs
##########
@@ -400,63 +412,68 @@ fn optimize(plan: &LogicalPlan, mut state: State) -> 
Result<LogicalPlan> {
             optimize_join(state, plan, left, right)
         }
         LogicalPlan::Join(Join {
-            left, right, on, ..
+            left,
+            right,
+            on,
+            join_type,
+            ..
         }) => {
-            // duplicate filters for joined columns so filters can be pushed 
down to both sides.
-            // Take the following query as an example:
-            //
-            // ```sql
-            // SELECT * FROM t1 JOIN t2 on t1.id = t2.uid WHERE t1.id > 1
-            // ```
-            //
-            // `t1.id > 1` predicate needs to be pushed down to t1 table scan, 
while
-            // `t2.uid > 1` predicate needs to be pushed down to t2 table scan.
-            //
-            // 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 join_side_filters = state
-                .filters
-                .iter()
-                .filter_map(|(predicate, columns)| {
-                    let mut join_cols_to_replace = HashMap::new();
-                    for col in columns.iter() {
-                        for (l, r) in on {
-                            if col == l {
-                                join_cols_to_replace.insert(col, r);
-                                break;
-                            } else if col == r {
-                                join_cols_to_replace.insert(col, l);
-                                break;
+            if *join_type == JoinType::Inner {

Review comment:
       this makes sense  (to only create synthetic predicates for inner joins 
for now).
   
   I will try and capture some of the potential follow on improvements in 
follow on tickets




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