Jefffrey commented on code in PR #4840:
URL: https://github.com/apache/arrow-datafusion/pull/4840#discussion_r1064052544
##########
datafusion/sql/src/planner.rs:
##########
@@ -2390,6 +2390,63 @@ mod tests {
quick_test(sql, expected);
}
+ #[test]
+ fn using_join_multiple_keys() {
+ let sql = "SELECT * FROM person a join person b using (id, age)";
+ let expected = "Projection: a.id, a.first_name, a.last_name, a.age,
a.state, a.salary, a.birth_date, a.😀, \
+ b.first_name, b.last_name, b.state, b.salary, b.birth_date, b.😀\
+ \n Inner Join: Using a.id = b.id, a.age = b.age\
+ \n SubqueryAlias: a\
+ \n TableScan: person\
+ \n SubqueryAlias: b\
+ \n TableScan: person";
+ quick_test(sql, expected);
+ }
+
+ #[test]
+ fn using_join_multiple_keys_subquery() {
+ let sql = "SELECT age FROM (SELECT * FROM person a join person b using
(id, age, state))";
+ let expected = "Projection: a.age\
+ \n Projection: a.id, a.first_name, a.last_name,
a.age, a.state, a.salary, a.birth_date, a.😀, \
+ b.first_name, b.last_name, b.salary, b.birth_date, b.😀\
+ \n Inner Join: Using a.id = b.id, a.age = b.age,
a.state = b.state\
+ \n SubqueryAlias: a\
+ \n TableScan: person\
+ \n SubqueryAlias: b\
+ \n TableScan: person";
+ quick_test(sql, expected);
+ }
+
+ #[test]
+ fn using_join_multiple_keys_select_all_columns() {
+ let sql = "SELECT a.*, b.* FROM person a join person b using (id,
age)";
Review Comment:
Added test
--
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]