-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Avoid unnecessary DeterminePartitionCount work #17150
Avoid unnecessary DeterminePartitionCount work #17150
Conversation
fa552f9
to
178e1fd
Compare
178e1fd
to
56bdc11
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.
Thanks! @pettyjamesm
There are some test failures. Can you look into that? |
56bdc11
to
75fa8b4
Compare
Yep, test failures are related because some tests are asserting the number of metastore accesses which is now lower than before for some queries. I've updated the assertions that I could verify locally with the new numbers, but may still be missing some assertions so we'll have to wait for the next CI run results to see if there are more updates needed. |
75fa8b4
to
9ade84c
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 % comments
...trino-main/src/test/java/io/trino/sql/planner/optimizations/TestDeterminePartitionCount.java
Show resolved
Hide resolved
...trino-main/src/test/java/io/trino/sql/planner/optimizations/TestDeterminePartitionCount.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/optimizations/DeterminePartitionCount.java
Show resolved
Hide resolved
...trino-main/src/test/java/io/trino/sql/planner/optimizations/TestDeterminePartitionCount.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/optimizations/DeterminePartitionCount.java
Outdated
Show resolved
Hide resolved
Modifies the DeterminePartitionCount optimizer rule to only attempt stats collection and dynamic partition count selection when the plan contains an eligible remote exchange. Otherwise, plan stats collection would be triggered potentially unnecessarily.
9ade84c
to
133067d
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. thanks!
core/trino-main/src/main/java/io/trino/sql/planner/optimizations/DeterminePartitionCount.java
Show resolved
Hide resolved
return false; | ||
} | ||
PartitioningHandle partitioningHandle = exchangeNode.getPartitioningScheme().getPartitioning().getHandle(); | ||
return !partitioningHandle.isScaleWriters() |
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: this is probably enforced by PlanNodeSearcher.searchFrom(plan).whereIsInstanceOfAny(INSERT_NODES).matches();
check.
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.
It was until #17024 enabled automatic partition determination for write queries behind a session property (default: false).
assertDistributedPlan( | ||
query, | ||
Session.builder(getQueryRunner().getDefaultSession()) | ||
.setSystemProperty(MAX_HASH_PARTITION_COUNT, "20") |
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 guess you could move it as default session setup for these tests
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 think it's ok to explicitly configure the methods separately since many of the tests still use different values to assert different count values selected from the parameters used.
Description
Modifies the
DeterminePartitionCount
optimizer rule to only attempt stats collection and dynamic partition count selection when the plan contains an eligible remote exchange. Otherwise, plan stats collection would be triggered potentially unnecessarily.Release notes
(x) 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: