[SPARK-28268][SQL] Rewrite non-correlated Semi/Anti join as Filter#25064
Closed
francis0407 wants to merge 1 commit intoapache:masterfrom
Closed
[SPARK-28268][SQL] Rewrite non-correlated Semi/Anti join as Filter#25064francis0407 wants to merge 1 commit intoapache:masterfrom
francis0407 wants to merge 1 commit intoapache:masterfrom
Conversation
|
Can one of the admins verify this patch? |
|
We're closing this PR because it hasn't been updated in a while. If you'd like to revive this PR, please reopen it! |
Contributor
Author
|
Closed due to out of date. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When semi/anti join has a non-correlated join condition, we can convert it to a Filter with a non-correlated Exists subquery. As the Exists subquery is non-correlated, we can use a physical plan for it to avoid join.
Actually, this optimization is mainly for the non-correlated subqueries (Exists/In). We currently rewrite Exists/InSubquery as semi/anti/existential join, whether it is correlated or not. And they are mostly executed using a BroadcastNestedLoopJoin which is really not a good choice.
Here are some examples:
1.
=>
=>
This PR adds a new optimize rule :
ReplaceLeftSemiAntiJoinWithFilter.This rule replaces non-correlated
LeftSemi/LeftAnti JoinwithFilter. When theconditionof a semi/anti join can be split byAndinto expressions where each expression only refers to attributes from one side, we can turn it into aFilterwith a non-correlatedExistssubquery.Besides, this PR adds a physical plan for non-correlated Exists.
How was this patch tested?
ut