-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28002][SQL][FOLLOWUP] Fix duplicate CTE error message and add more test cases #24949
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
Conversation
|
ok to test |
|
add to whitelist |
|
Test build #106829 has finished for PR 24949 at commit
|
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.
According to @gatorsmile 's comment, could you add a t(x, x) test case, too?
Duplicate names within a single CTE definition are not allowed.
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.
We need to capture the duplicate names earlier and issue a better error message
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.
Hmm, I added the t(x, x) case, but it is allowed, and I think it is right to be allowed.
I thought @gatorsmile referred to the
WITH
t(x) AS (SELECT 1),
t(x) AS (SELECT 2)
SELECT * FROM t;
case, which is not.
@gatorsmile we capture the duplicate CTE name during parsing, I fixed the error message though.
If I got something wrong please let me know.
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.
@gatorsmile, @dongjoon-hyun do you think the PR is ok now?
|
Test build #106845 has finished for PR 24949 at commit
|
|
Test build #106871 has finished for PR 24949 at commit
|
|
retest this please |
|
Test build #106875 has finished for PR 24949 at commit
|
|
@gatorsmile, @dongjoon-hyun is there anything I can add to this PR? |
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
Outdated
Show resolved
Hide resolved
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.
Do you think we can have a more meaningful message?
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.
I think this standard message comes from antlr when the query doesn't fit to the .g4 definition. I'm not sure if it can be fixed.
8fbae02 to
0c39fb2
Compare
|
Test build #107277 has finished for PR 24949 at commit
|
dongjoon-hyun
left a comment
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.
+1, LGTM. Merged to master.
Thank you, @peter-toth , @gatorsmile , @HyukjinKwon .
|
Thanks for the review @dongjoon-hyun, @HyukjinKwon, @gatorsmile! |
What changes were proposed in this pull request?
This PR adds some more WITH test cases as a follow-up to #24842
How was this patch tested?
Add new UTs.