-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implement dynamic partition pruning #1072
Implement dynamic partition pruning #1072
Conversation
@rzeyde-varada could you also assist reviewing it? |
test failures seems relevant to this feature |
7818da6
to
79d9a73
Compare
I've resolved the test failures now |
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.
Reviewed most of the code - looks good overall, a few questions/suggestions inside.
Will continue the review tomorrow.
presto-main/src/main/java/io/prestosql/sql/analyzer/FeaturesConfig.java
Outdated
Show resolved
Hide resolved
presto-spi/src/main/java/io/prestosql/spi/connector/ConnectorSplitManager.java
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterService.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/execution/SqlStageExecution.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/operator/DynamicFilterClient.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/operator/DynamicFilterClientFactory.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/operator/DynamicFilterClientSupplier.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterResource.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterResource.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/ServerMainModule.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterResource.java
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.
Finished the review - many thanks for the contribution!
A small question about integration tests:
Would it be possible to adapt MemorySplitManager
, so we can run a smoke integration test for dynamic partition pruning?
presto-main/src/main/java/io/prestosql/server/DynamicFilterService.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterService.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterService.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterResource.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterService.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/operator/DynamicFilterSourceOperator.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/operator/DynamicFilterSourceOperator.java
Outdated
Show resolved
Hide resolved
567039d
to
82e16ba
Compare
Thanks for the thorough review :) |
52fee8e
to
678a943
Compare
678a943
to
9ee27c9
Compare
f042881
to
715227e
Compare
058f13b
to
b760b51
Compare
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.
Some initial comments. I'm looking at the rest of the code now.
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-spi/src/main/java/io/prestosql/spi/DynamicFilterDescription.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/operator/DynamicFilterSummary.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterResource.java
Outdated
Show resolved
Hide resolved
1917330
to
cd7f2de
Compare
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.
tests left to review
@@ -54,22 +57,25 @@ | |||
// Mapping from dynamic filter ID to its build channel indices. | |||
private final Map<String, Integer> buildChannels; | |||
|
|||
private final TypeProvider types; | |||
// Mapping from dynamic filter ID to its build channel type. | |||
private final Map<String, Type> filterBuildTypes; |
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: we probably should have dedicated class for filter Id at this point instead of string
presto-main/src/main/java/io/prestosql/sql/planner/LocalDynamicFilter.java
Outdated
Show resolved
Hide resolved
return Futures.transform(resultFuture, this::convertTupleDomain, directExecutor()); | ||
} | ||
|
||
public ListenableFuture<Map<Symbol, Domain>> getNodeLocalDynamicFilterForSymbols() |
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: Local specific logic should be moved out of LocalDynamicFilter
eventually
presto-main/src/main/java/io/prestosql/sql/planner/LocalDynamicFilter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/LocalDynamicFilter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/LocalDynamicFilter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/LocalDynamicFilter.java
Outdated
Show resolved
Hide resolved
cd7f2de
to
7339097
Compare
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.
LGTM % test improvement
presto-main/src/test/java/io/prestosql/server/TestDynamicFilterService.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/io/prestosql/server/TestDynamicFilterService.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/io/prestosql/sql/planner/TestLocalDynamicFilterCollector.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/io/prestosql/sql/planner/TestLocalDynamicFilter.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/io/prestosql/sql/planner/TestLocalDynamicFilter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterService.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/io/prestosql/server/TestDynamicFilterService.java
Outdated
Show resolved
Hide resolved
fixes: #52 |
19be880
to
2f13dfb
Compare
presto-main/src/test/java/io/prestosql/server/TestDynamicFilterService.java
Outdated
Show resolved
Hide resolved
benchmark results with partitions (significant CPU and duration improvement) benchmark results without partitions: |
2f0f83f
to
796c841
Compare
presto-main/src/main/java/io/prestosql/sql/planner/DistributedExecutionPlanner.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSplitSource.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/execution/SqlQueryExecution.java
Outdated
Show resolved
Hide resolved
@@ -88,4 +88,29 @@ public boolean isFailure() | |||
{ | |||
return failureState; | |||
} | |||
|
|||
public boolean noMoreTasks() |
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 should be named something else. noMoreSplits
sounds like a command, and this simply interrogates the current state.
presto-main/src/main/java/io/prestosql/execution/StageState.java
Outdated
Show resolved
Hide resolved
case RUNNING: | ||
case FINISHED: | ||
case CANCELED: | ||
// no more workers will be added to the 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.
The comments don't seem to match the code... this doesn't change anything
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 code was extracted as-is from io.prestosql.execution.scheduler.SqlQueryScheduler.StageLinkage#processScheduleResults
#1072 (comment)
Are we guaranteed that there will be no more tasks added (e.g when new workers come with co-located joins) when we reach SCHEDULING_SPLITS state ?
If not, we still need some way to figure out in DynamicFilterService
when it's safe to assume that no new tasks will be added which can generate more values from build-side of join and we can use the dynamic filters reported from completion of existing build-side operators for filtering on the probe side.
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.
Looking at SourcePartitionedScheduler#finalizeTaskCreationIfNecessary
it will splitPlacementPolicy.lockDownNodes();
and set state to SCHEDULING_SPLIT
. It seems that at this point no more nodes will participate in query.
However, can stage state can change to RUNNING
via SqlStageExecution#schedulingComplete()
and skip splitPlacementPolicy.lockDownNodes();
call?
I guess SqlQueryScheduler.StageLinkage#processScheduleResults
would also break then
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 was referring to the tone of the comments, not the contents. The comments imply that a change will occur. For example, the comment below says DO NOT complete a FAILED or ABORTED stage
, but this is not a command. The code where this was extracted was making changes to the stage, so the comments were appropriate.
796c841
to
dc2eedb
Compare
merged, thanks! |
@simpligility I think this would be a great PR to showcase for the Presto Twitch show. @raunaqmorarka any objections to us showcasing your work? Further would you be interested in joining the show? |
Introduce collecting DynamicFilterSummary on build side of Join
Expose DynamicFilterResource endpoint on coordinator for collecting DynamicFilterSummaries from worker nodes. Feed coordinator with DynamicFilterSummaries from worker nodes
Use DynamicFilterSummaries collected on coordinator to filter out splits in SplitManager