-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25769][SQL]make UnresolvedAttribute.sql escape nested columns correctly #22788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2aa4ad9
e941acd
99bfd00
458f77a
566d5f9
7ff2696
693c512
05688f5
3c81840
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,7 @@ SELECT t1.i1 FROM t1, mydb1.t1 | |
| struct<> | ||
| -- !query 9 output | ||
| org.apache.spark.sql.AnalysisException | ||
| Reference 't1.i1' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos 7 | ||
| Reference '`t1`.`i1`' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos 7 | ||
|
||
|
|
||
|
|
||
| -- !query 10 | ||
|
|
@@ -90,7 +90,7 @@ SELECT mydb1.t1.i1 FROM t1, mydb1.t1 | |
| struct<> | ||
| -- !query 10 output | ||
| org.apache.spark.sql.AnalysisException | ||
| Reference 'mydb1.t1.i1' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos 7 | ||
| Reference '`mydb1`.`t1`.`i1`' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos 7 | ||
|
|
||
|
|
||
| -- !query 11 | ||
|
|
@@ -108,7 +108,7 @@ SELECT t1.i1 FROM t1, mydb2.t1 | |
| struct<> | ||
| -- !query 12 output | ||
| org.apache.spark.sql.AnalysisException | ||
| Reference 't1.i1' is ambiguous, could be: mydb1.t1.i1, mydb2.t1.i1.; line 1 pos 7 | ||
| Reference '`t1`.`i1`' is ambiguous, could be: mydb1.t1.i1, mydb2.t1.i1.; line 1 pos 7 | ||
|
|
||
|
|
||
| -- !query 13 | ||
|
|
@@ -134,7 +134,7 @@ SELECT t1.i1 FROM t1, mydb1.t1 | |
| struct<> | ||
| -- !query 15 output | ||
| org.apache.spark.sql.AnalysisException | ||
| Reference 't1.i1' is ambiguous, could be: mydb2.t1.i1, mydb1.t1.i1.; line 1 pos 7 | ||
| Reference '`t1`.`i1`' is ambiguous, could be: mydb2.t1.i1, mydb1.t1.i1.; line 1 pos 7 | ||
|
|
||
|
|
||
| -- !query 16 | ||
|
|
@@ -152,7 +152,7 @@ SELECT t1.i1 FROM t1, mydb2.t1 | |
| struct<> | ||
| -- !query 17 output | ||
| org.apache.spark.sql.AnalysisException | ||
| Reference 't1.i1' is ambiguous, could be: mydb2.t1.i1, mydb2.t1.i1.; line 1 pos 7 | ||
| Reference '`t1`.`i1`' is ambiguous, could be: mydb2.t1.i1, mydb2.t1.i1.; line 1 pos 7 | ||
|
|
||
|
|
||
| -- !query 18 | ||
|
|
@@ -161,7 +161,7 @@ SELECT db1.t1.i1 FROM t1, mydb2.t1 | |
| struct<> | ||
| -- !query 18 output | ||
| org.apache.spark.sql.AnalysisException | ||
| cannot resolve '`db1.t1.i1`' given input columns: [mydb2.t1.i1, mydb2.t1.i1]; line 1 pos 7 | ||
| cannot resolve '`db1`.`t1`.`i1`' given input columns: [mydb2.t1.i1, mydb2.t1.i1]; line 1 pos 7 | ||
|
||
|
|
||
|
|
||
| -- !query 19 | ||
|
|
@@ -186,7 +186,7 @@ SELECT mydb1.t1 FROM t1 | |
| struct<> | ||
| -- !query 21 output | ||
| org.apache.spark.sql.AnalysisException | ||
| cannot resolve '`mydb1.t1`' given input columns: [mydb1.t1.i1]; line 1 pos 7 | ||
| cannot resolve '`mydb1`.`t1`' given input columns: [mydb1.t1.i1]; line 1 pos 7 | ||
|
|
||
|
|
||
| -- !query 22 | ||
|
|
@@ -221,7 +221,7 @@ SELECT mydb1.t1.i1 FROM t1 | |
| struct<> | ||
| -- !query 25 output | ||
| org.apache.spark.sql.AnalysisException | ||
| cannot resolve '`mydb1.t1.i1`' given input columns: [mydb2.t1.i1]; line 1 pos 7 | ||
| cannot resolve '`mydb1`.`t1`.`i1`' given input columns: [mydb2.t1.i1]; line 1 pos 7 | ||
|
|
||
|
|
||
| -- !query 26 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1143,7 +1143,7 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext { | |
| |order by struct.a, struct.b | ||
| |""".stripMargin) | ||
| } | ||
| assert(error.message contains "cannot resolve '`struct.a`' given input columns: [a, b]") | ||
| assert(error.message contains "cannot resolve '`struct`.`a`' given input columns: [a, b]") | ||
|
|
||
| } | ||
|
|
||
|
|
@@ -2702,7 +2702,7 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext { | |
|
|
||
| val e = intercept[AnalysisException](sql("SELECT v.i from (SELECT i FROM v)")) | ||
| assert(e.message == | ||
| "cannot resolve '`v.i`' given input columns: [__auto_generated_subquery_name.i]") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the problem here is the out-most backticks, do you know where we add it?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The out-most backticks is added in the |
||
| "cannot resolve '`v`.`i`' given input columns: [__auto_generated_subquery_name.i]") | ||
|
|
||
| checkAnswer(sql("SELECT __auto_generated_subquery_name.i from (SELECT i FROM v)"), Row(1)) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @huaxingao . Can we have the following one-line patch instead 12 line changes?
cc @cloud-fan and @gatorsmile and @dbtsai .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongjoon-hyun Thanks! Fixed.