-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Hard-fork join operator and remove spilling from it #12618
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
Merged
raunaqmorarka
merged 9 commits into
trinodb:master
from
skrzypo987:skrzypo/071-remove-join-spilling-1
Jul 6, 2022
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cd4f14d
Hard-fork join operator
6e4d04b
Remove spill from non-spilling HashJoin operator
0a3b553
Remove spilling from forked join operator
d6d6e83
Remove LookupSourceProvider from non-spilling join operator
97b010b
Inline SpillingJoinProcessor class in forked join operator
52a4017
Replace ReadWriteLock with synchronized
5a91312
Remove PageJoiner interface from non-spilling join operator
7cb8b03
Remove LookupSourceFactory interface from non-spilling join operator
3aa42d8
Decrease visibility of some methods and classes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,10 +41,11 @@ public class TrinoOperatorFactories | |
| public OperatorFactory innerJoin( | ||
| int operatorId, | ||
| PlanNodeId planNodeId, | ||
| JoinBridgeManager<? extends LookupSourceFactory> lookupSourceFactory, | ||
| JoinBridgeManager<?> lookupSourceFactory, | ||
| boolean outputSingleMatch, | ||
| boolean waitForBuild, | ||
| boolean hasFilter, | ||
| boolean spillingEnabled, | ||
| List<Type> probeTypes, | ||
| List<Integer> probeJoinChannel, | ||
| OptionalInt probeHashChannel, | ||
|
|
@@ -64,6 +65,7 @@ public OperatorFactory innerJoin( | |
| INNER, | ||
| outputSingleMatch, | ||
| waitForBuild, | ||
| spillingEnabled, | ||
| totalOperatorsCount, | ||
| partitioningSpillerFactory, | ||
| blockTypeOperators); | ||
|
|
@@ -73,9 +75,10 @@ public OperatorFactory innerJoin( | |
| public OperatorFactory probeOuterJoin( | ||
| int operatorId, | ||
| PlanNodeId planNodeId, | ||
| JoinBridgeManager<? extends LookupSourceFactory> lookupSourceFactory, | ||
| JoinBridgeManager<?> lookupSourceFactory, | ||
| boolean outputSingleMatch, | ||
| boolean hasFilter, | ||
| boolean spillingEnabled, | ||
| List<Type> probeTypes, | ||
| List<Integer> probeJoinChannel, | ||
| OptionalInt probeHashChannel, | ||
|
|
@@ -95,6 +98,7 @@ public OperatorFactory probeOuterJoin( | |
| PROBE_OUTER, | ||
| outputSingleMatch, | ||
| false, | ||
| spillingEnabled, | ||
| totalOperatorsCount, | ||
| partitioningSpillerFactory, | ||
| blockTypeOperators); | ||
|
|
@@ -104,9 +108,10 @@ public OperatorFactory probeOuterJoin( | |
| public OperatorFactory lookupOuterJoin( | ||
| int operatorId, | ||
| PlanNodeId planNodeId, | ||
| JoinBridgeManager<? extends LookupSourceFactory> lookupSourceFactory, | ||
| JoinBridgeManager<?> lookupSourceFactory, | ||
| boolean waitForBuild, | ||
| boolean hasFilter, | ||
| boolean spillingEnabled, | ||
| List<Type> probeTypes, | ||
| List<Integer> probeJoinChannel, | ||
| OptionalInt probeHashChannel, | ||
|
|
@@ -126,6 +131,7 @@ public OperatorFactory lookupOuterJoin( | |
| LOOKUP_OUTER, | ||
| false, | ||
| waitForBuild, | ||
| spillingEnabled, | ||
| totalOperatorsCount, | ||
| partitioningSpillerFactory, | ||
| blockTypeOperators); | ||
|
|
@@ -135,8 +141,9 @@ public OperatorFactory lookupOuterJoin( | |
| public OperatorFactory fullOuterJoin( | ||
| int operatorId, | ||
| PlanNodeId planNodeId, | ||
| JoinBridgeManager<? extends LookupSourceFactory> lookupSourceFactory, | ||
| JoinBridgeManager<?> lookupSourceFactory, | ||
| boolean hasFilter, | ||
| boolean spillingEnabled, | ||
| List<Type> probeTypes, | ||
| List<Integer> probeJoinChannel, | ||
| OptionalInt probeHashChannel, | ||
|
|
@@ -156,6 +163,7 @@ public OperatorFactory fullOuterJoin( | |
| FULL_OUTER, | ||
| false, | ||
| false, | ||
| spillingEnabled, | ||
| totalOperatorsCount, | ||
| partitioningSpillerFactory, | ||
| blockTypeOperators); | ||
|
|
@@ -171,14 +179,15 @@ private static List<Integer> rangeList(int endExclusive) | |
| private OperatorFactory createJoinOperatorFactory( | ||
| int operatorId, | ||
| PlanNodeId planNodeId, | ||
| JoinBridgeManager<? extends LookupSourceFactory> lookupSourceFactoryManager, | ||
| JoinBridgeManager<?> lookupSourceFactoryManager, | ||
| List<Type> probeTypes, | ||
| List<Integer> probeJoinChannel, | ||
| OptionalInt probeHashChannel, | ||
| List<Integer> probeOutputChannels, | ||
| JoinType joinType, | ||
| boolean outputSingleMatch, | ||
| boolean waitForBuild, | ||
| boolean spillingEnabled, | ||
| OptionalInt totalOperatorsCount, | ||
| PartitioningSpillerFactory partitioningSpillerFactory, | ||
| BlockTypeOperators blockTypeOperators) | ||
|
|
@@ -187,21 +196,39 @@ private OperatorFactory createJoinOperatorFactory( | |
| .map(probeTypes::get) | ||
| .collect(toImmutableList()); | ||
|
|
||
| return new LookupJoinOperatorFactory( | ||
| operatorId, | ||
| planNodeId, | ||
| lookupSourceFactoryManager, | ||
| probeTypes, | ||
| probeOutputChannelTypes, | ||
| lookupSourceFactoryManager.getBuildOutputTypes(), | ||
| joinType, | ||
| outputSingleMatch, | ||
| waitForBuild, | ||
| new JoinProbeFactory(probeOutputChannels.stream().mapToInt(i -> i).toArray(), probeJoinChannel, probeHashChannel), | ||
| blockTypeOperators, | ||
| totalOperatorsCount, | ||
| probeJoinChannel, | ||
| probeHashChannel, | ||
| partitioningSpillerFactory); | ||
| if (spillingEnabled) { | ||
| return new LookupJoinOperatorFactory( | ||
| operatorId, | ||
| planNodeId, | ||
| (JoinBridgeManager<? extends LookupSourceFactory>) lookupSourceFactoryManager, | ||
|
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. You should create a new type hierarchy or new operator factory methods rather than explicitly cast here |
||
| probeTypes, | ||
| probeOutputChannelTypes, | ||
| lookupSourceFactoryManager.getBuildOutputTypes(), | ||
| joinType, | ||
| outputSingleMatch, | ||
| waitForBuild, | ||
| new JoinProbeFactory(probeOutputChannels.stream().mapToInt(i -> i).toArray(), probeJoinChannel, probeHashChannel), | ||
| blockTypeOperators, | ||
| totalOperatorsCount, | ||
| probeJoinChannel, | ||
| probeHashChannel, | ||
| partitioningSpillerFactory); | ||
| } | ||
| else { | ||
|
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. else is redundant |
||
| return new io.trino.operator.join.unspilled.LookupJoinOperatorFactory( | ||
| operatorId, | ||
| planNodeId, | ||
| (JoinBridgeManager<? extends io.trino.operator.join.unspilled.PartitionedLookupSourceFactory>) lookupSourceFactoryManager, | ||
| probeTypes, | ||
| probeOutputChannelTypes, | ||
| lookupSourceFactoryManager.getBuildOutputTypes(), | ||
| joinType, | ||
| outputSingleMatch, | ||
| waitForBuild, | ||
| new JoinProbeFactory(probeOutputChannels.stream().mapToInt(i -> i).toArray(), probeJoinChannel, probeHashChannel), | ||
| blockTypeOperators, | ||
| probeJoinChannel, | ||
| probeHashChannel); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
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 can skip
OperatorFactoriesfor "new" join. Won't serve any purpose