-
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
Always use preferred partitioning for local exchanges #15459
Conversation
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/optimizations/AddLocalExchanges.java
Outdated
Show resolved
Hide resolved
...c/test/java/io/trino/sql/planner/optimizations/TestAddLocalExchangesForTaskScaleWriters.java
Show resolved
Hide resolved
...c/test/java/io/trino/sql/planner/optimizations/TestAddLocalExchangesForTaskScaleWriters.java
Show resolved
Hide resolved
...c/test/java/io/trino/sql/planner/optimizations/TestAddLocalExchangesForTaskScaleWriters.java
Outdated
Show resolved
Hide resolved
...o-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakePreferredPartitioning.java
Show resolved
Hide resolved
there are test failures |
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
With local scaled exchanges in partitioned case there won't be any performance degradation due to partition skewness. Therefore, we can always use preferred insert partitioning when local scaling is enabled.
private boolean isSingleGatheringExchange(PlanNode node) | ||
{ | ||
Optional<PlanNode> result = searchFrom(node) | ||
.where(planNode -> planNode instanceof ExchangeNode) |
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: In isLocalScaledWriterExchange
you search for LOCAL
exchange specifically. It seems you can remove the check there too
.orElseGet(() -> getTaskWriterCount(session)); | ||
} | ||
|
||
private boolean isSingleGatheringExchange(PlanNode node) |
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: move above isLocalScaledWriterExchange
{ | ||
// This check is required because we don't know which writer count to use when exchange 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.
nit: we could extract decision logic part scaled OR unpart scaled OR part OR unpart
from AddLocalExchanges
and not rely o plan node serach
} | ||
|
||
return partitioningScheme | ||
.map(scheme -> visitPartitionedWriter(node, scheme, source, parentPreferences)) | ||
.orElseGet(() -> visitUnpartitionedWriter(node, source, writerTarget)); |
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: would be more coherent to extract visitScaleUnpartitionedWriter
hit: #15507 |
NO RELEASE NOTES |
@gaurav8297 please increase Also comment for:
doesn't seem correct as |
Does this need a release note? cc @sopel39 |
@colebow I would put it under #15058 (comment) |
Description
After this change (#14718) we can always use preferred partitioning for local exchange which is more reliable in terms of memory usage.
Additional context and related issues
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: