jackwener commented on code in PR #4863:
URL: https://github.com/apache/arrow-datafusion/pull/4863#discussion_r1064680608
##########
datafusion/sql/src/relation/join.rs:
##########
@@ -142,10 +142,29 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
.build()
}
JoinConstraint::Natural => {
- // https://issues.apache.org/jira/browse/ARROW-10727
- Err(DataFusionError::NotImplemented(
- "NATURAL JOIN is not supported
(https://issues.apache.org/jira/browse/ARROW-10727)".to_string(),
- ))
+ // TODO: what if no common join cols? -> becomes cross join
+ // TODO: limit join_type to specific set?
+ let left_cols: HashSet<&String> = left
+ .schema()
+ .fields()
+ .iter()
+ .map(|f| f.field().name())
+ .collect();
+ let keys: Vec<Column> = right
+ .schema()
+ .fields()
+ .iter()
+ .map(|f| f.field().name())
+ .filter(|f| left_cols.contains(f))
+ .map(Column::from_name)
+ .collect();
Review Comment:
Please notice `qualifier`. Field can own a `qualifier` and also don't own a
`qualifier`
For example,
t1: |t1.a|t1.b|c| (we can meet `c` instead of `t1.c`)
We also need add test to consider it.
--
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]