Jefffrey commented on code in PR #4863:
URL: https://github.com/apache/arrow-datafusion/pull/4863#discussion_r1065060312
##########
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:
I'm not sure I follow, are you suggesting to consider the qualifier when
checking for common columns? My understanding is that when joining two
different tables they should have different qualifiers anyway.
--
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]