-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24966][SQL] Implement precedence rules for set operations. #21941
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
|
@dilipbiswal, thanks! I am a bot who has found some folks who might be able to help with the review:@gatorsmile, @rxin and @hvanhovell |
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.
When true, INTERSECT is given precedence over UNION and EXCEPT set operations as per
->
When true, INTERSECT is given the greater precedence over the other set operations (UNION, EXCEPT and MINUS) as per
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.
also add withSQLConf(SQLConf.SETOPS_PRECEDENCE_ENFORCED.key -> "true") {
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.
also include MINUS
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.
let me think about the name of conf
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 Sure.
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 A couple of alternatives i had considered :-). FYI.
spark.sql.set.operators.precedence.enforced
spark.sql.set.operators.standard.compliance
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.
spark.sql.legacy.setopsPrecedence.enabled
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 not related to the current PR. This addresses a comment from @HyukjinKwon in 21886
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 not related to the current PR. This addresses a comment from @HyukjinKwon in 21886
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 not related to the current PR. This addresses a comment from @HyukjinKwon in 21886
|
Test build #93871 has finished for PR 21941 at commit
|
|
Test build #93872 has finished for PR 21941 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.
let us mark it internal.
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.
and
|
Test build #93917 has finished for PR 21941 at commit
|
|
retest this please |
|
Test build #93936 has finished for PR 21941 at commit
|
|
@maropu Is this a transient failure ? Does not seem related to my change ? |
|
no idea, but |
|
retest this please |
|
Test build #93966 has finished for PR 21941 at commit
|
|
retest this please |
|
Test build #93989 has finished for PR 21941 at commit
|
|
retest this please |
|
Test build #94003 has finished for PR 21941 at commit
|
|
retest this please |
|
Test build #94028 has finished for PR 21941 at commit
|
e7d69db to
bc6df75
Compare
|
@gatorsmile rebasing in a hope that the test result changes :-) |
|
Test build #94046 has finished for PR 21941 at commit
|
|
retest this please |
|
Test build #94053 has finished for PR 21941 at commit
|
|
LGTM Thanks! Merged to master. |
|
Thanks a lot @gatorsmile |
What changes were proposed in this pull request?
Currently the set operations INTERSECT, UNION and EXCEPT are assigned the same precedence. This PR fixes the problem by giving INTERSECT higher precedence than UNION and EXCEPT. UNION and EXCEPT operators are evaluated in the order in which they appear in the query from left to right.
This results in change in behavior because of the change in order of evaluations of set operators in a query. The old behavior is still preserved under a newly added config parameter.
Query
:Parsed plan before the change
:Parsed plan after the change
:How was this patch tested?
Added tests in PlanParserSuite, SQLQueryTestSuite.
Please review http://spark.apache.org/contributing.html before opening a pull request.