-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31577][SQL] Fix case-sensitivity and forward name conflict problems when check name conflicts of CTE relations #28371
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 all commits
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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| -- Automatically generated by SQLQueryTestSuite | ||
| -- Number of queries: 13 | ||
| -- Number of queries: 16 | ||
|
|
||
|
|
||
| -- !query | ||
|
|
@@ -64,10 +64,9 @@ WITH | |
| ) | ||
| SELECT * FROM t2 | ||
| -- !query schema | ||
| struct<> | ||
| struct<scalarsubquery():int> | ||
| -- !query output | ||
| org.apache.spark.sql.AnalysisException | ||
| Name t is ambiguous in nested CTE. Please set spark.sql.legacy.ctePrecedencePolicy to CORRECTED so that name defined in inner CTE takes precedence. If set it to LEGACY, outer CTE definitions will take precedence. See more details in SPARK-28228.; | ||
|
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. I tried this query with Spark 2.4.5 (need to replace
Member
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. Got it. |
||
| 2 | ||
|
|
||
|
|
||
| -- !query | ||
|
|
@@ -186,3 +185,45 @@ struct<> | |
| -- !query output | ||
| org.apache.spark.sql.AnalysisException | ||
| Name t is ambiguous in nested CTE. Please set spark.sql.legacy.ctePrecedencePolicy to CORRECTED so that name defined in inner CTE takes precedence. If set it to LEGACY, outer CTE definitions will take precedence. See more details in SPARK-28228.; | ||
|
|
||
|
|
||
| -- !query | ||
| WITH | ||
| t AS ( | ||
| WITH t2 AS (SELECT 1) | ||
| SELECT * FROM t2 | ||
| ), | ||
| t2 AS (SELECT 2) | ||
| SELECT * FROM t | ||
| -- !query schema | ||
| struct<1:int> | ||
| -- !query output | ||
| 1 | ||
|
|
||
|
|
||
| -- !query | ||
| WITH | ||
| abc AS (SELECT 1), | ||
| t AS ( | ||
| WITH aBc AS (SELECT 2) | ||
| SELECT * FROM aBC | ||
| ) | ||
| SELECT * FROM t | ||
| -- !query schema | ||
| struct<> | ||
| -- !query output | ||
| org.apache.spark.sql.AnalysisException | ||
| Name aBc is ambiguous in nested CTE. Please set spark.sql.legacy.ctePrecedencePolicy to CORRECTED so that name defined in inner CTE takes precedence. If set it to LEGACY, outer CTE definitions will take precedence. See more details in SPARK-28228.; | ||
|
|
||
|
|
||
| -- !query | ||
| WITH abc AS (SELECT 1) | ||
| SELECT ( | ||
| WITH aBc AS (SELECT 2) | ||
| SELECT * FROM aBC | ||
| ) | ||
| -- !query schema | ||
| struct<> | ||
| -- !query output | ||
| org.apache.spark.sql.AnalysisException | ||
| Name aBc is ambiguous in nested CTE. Please set spark.sql.legacy.ctePrecedencePolicy to CORRECTED so that name defined in inner CTE takes precedence. If set it to LEGACY, outer CTE definitions will take precedence. See more details in SPARK-28228.; | ||
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.
My bad. I missed to check case-sensitivity.