-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-27444][SQL] multi-select can be used in subquery #24348
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
|
|
||
| insertStatement | ||
| : (ctes)? insertInto queryTerm queryOrganization #singleInsertQuery | ||
| | (ctes)? fromClause multiInsertQueryBody+ #multiInsertQuery |
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.
move the ctes? to the parent entry, to save duplicated code. This is a simplification of #24150
|
cc @dilipbiswal |
| queryNoWith | ||
| : queryTerm queryOrganization #noWithQuery | ||
| | fromClause selectStatement #queryWithFrom | ||
| | fromClause selectStatement+ #queryWithFrom |
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.
nit: should we name the label #queriesWithFrom ? I am fine if we stay as is :-)
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.
well, multi-select is still one query :)
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.
@cloud-fan Okay.. sounds good to me.
|
@cloud-fan Thanks a LOT for fixing it. |
| table("a").select(star()).insertInto("tbl1").union( | ||
| table("a").where('s < 10).select(star()).insertInto("tbl2"))) | ||
| assertEqual( | ||
| "select * from (from a select * select *)", |
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.
Thank you for adding this.
|
Test build #104515 has finished for PR 24348 at commit
|
|
thanks, merging to master! |
| intercept( | ||
| "from a select * select * from x where a.s < 10", | ||
| "Multi-select queries cannot have a FROM clause in their individual SELECT statements") | ||
| "This select statement can not have FROM cause as its already specified upfront") |
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.
you know what? cannot is correct too and more usual :-).
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.
this is copied from the old error message: https://github.com/apache/spark/pull/24348/files#diff-9847f5cef7cf7fbc5830fbc6b779ee10L133
We can update this
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.
it's fine. I didn't mean we should fix now. just wanted to say it :-).
What changes were proposed in this pull request?
This is a regression caused by #24150
select * from (from a select * select *)is supported in 2.4, and we should keep supporting it.This PR merges the parser rule for single and multi select statements, as they are very similar.
How was this patch tested?
a new test case