This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new 03f85f1db add another test case to cover join ambiguous check (#4305)
03f85f1db is described below
commit 03f85f1dbe93c536b8ef8bd88e8fd7335cf9ffa1
Author: ygf11 <[email protected]>
AuthorDate: Thu Nov 24 02:07:15 2022 +0800
add another test case to cover join ambiguous check (#4305)
---
datafusion/sql/src/planner.rs | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs
index 1e09054c8..9e9355cf4 100644
--- a/datafusion/sql/src/planner.rs
+++ b/datafusion/sql/src/planner.rs
@@ -5343,7 +5343,7 @@ mod tests {
let sql = "with a as (select * from person), a as (select * from
orders) select * from a;";
let expected = "SQL error: ParserError(\"WITH query name \\\"a\\\"
specified more than once\")";
let result = logical_plan(sql).err().unwrap();
- assert_eq!(expected, format!("{}", result));
+ assert_eq!(result.to_string(), expected);
}
#[test]
@@ -5577,7 +5577,7 @@ mod tests {
let expected = "Error during planning: Source table contains 3 columns
but only 1 names given as column alias";
let result = logical_plan(sql).err().unwrap();
- assert_eq!(expected, format!("{}", result));
+ assert_eq!(result.to_string(), expected);
}
#[test]
@@ -5680,7 +5680,7 @@ mod tests {
let expected = "Projection: SUM(person.age) FILTER (WHERE age >
Int64(4))\
\n Aggregate: groupBy=[[]], aggr=[[SUM(person.age) FILTER (WHERE age
> Int64(4))]]\
\n TableScan: person".to_string();
- assert_eq!(expected, format!("{}", plan.display_indent()));
+ assert_eq!(plan.display_indent().to_string(), expected);
Ok(())
}
@@ -5970,7 +5970,7 @@ mod tests {
}
#[test]
- fn test_ambiguous_coulmn_referece_in_join() {
+ fn test_ambiguous_coulmn_referece_in_on_join() {
let sql = "select p1.id, p1.age, p2.id
from person as p1
INNER JOIN person as p2
@@ -5983,7 +5983,23 @@ mod tests {
let result = logical_plan(sql);
assert!(result.is_err());
let err = result.err().unwrap();
- assert_eq!(format!("{}", err), expected);
+ assert_eq!(err.to_string(), expected);
+ }
+
+ #[test]
+ fn test_ambiguous_coulmn_referece_with_in_using_join() {
+ let sql = "select p1.id, p1.age, p2.id
+ from person as p1
+ INNER JOIN person as p2
+ using(id)";
+
+ let expected = "Projection: p1.id, p1.age, p2.id\
+ \n Inner Join: Using p1.id = p2.id\
+ \n SubqueryAlias: p1\
+ \n TableScan: person\
+ \n SubqueryAlias: p2\
+ \n TableScan: person";
+ quick_test(sql, expected);
}
fn assert_field_not_found(err: DataFusionError, name: &str) {