alamb commented on code in PR #13182:
URL: https://github.com/apache/datafusion/pull/13182#discussion_r1830935592


##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -1214,15 +1214,37 @@ impl LogicalPlanBuilder {
             return plan_err!("left_keys and right_keys were not the same 
length");
         }
 
-        let join_key_pairs = equi_exprs
+        let exprs: Vec<(Expr, Expr)> = equi_exprs
             .0
             .into_iter()
-            .zip(equi_exprs.1.into_iter())
-            .map(|(l, r)| {
-                let left_key = l.into();
-                let right_key = r.into();
+            .zip(equi_exprs.1)
+            .map(|(l, r)| (l.into(), r.into()))
+            .collect();
+
+        let columns: Vec<_> = exprs
+            .iter()
+            .filter_map(|(l, r)| {
+                l.try_as_col().and_then(|left_col| {
+                    r.try_as_col().map(|right_col| (left_col, right_col))
+                })
+            })
+            .collect();
+        if columns.len() == exprs.len() {
+            // all expressions are columns
+            return self.join(

Review Comment:
   I found this confusing too -- I made a PR to try and clarify it



##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -1214,15 +1214,37 @@ impl LogicalPlanBuilder {
             return plan_err!("left_keys and right_keys were not the same 
length");
         }
 
-        let join_key_pairs = equi_exprs
+        let exprs: Vec<(Expr, Expr)> = equi_exprs
             .0
             .into_iter()
-            .zip(equi_exprs.1.into_iter())
-            .map(|(l, r)| {
-                let left_key = l.into();
-                let right_key = r.into();
+            .zip(equi_exprs.1)
+            .map(|(l, r)| (l.into(), r.into()))
+            .collect();
+
+        let columns: Vec<_> = exprs
+            .iter()
+            .filter_map(|(l, r)| {
+                l.try_as_col().and_then(|left_col| {
+                    r.try_as_col().map(|right_col| (left_col, right_col))
+                })
+            })
+            .collect();
+        if columns.len() == exprs.len() {
+            // all expressions are columns
+            return self.join(

Review Comment:
   I found this confusing too -- I made a PR to try and clarify it
   - https://github.com/apache/datafusion/pull/13276



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