-
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
Replace partial topN with limit when reading pre-sorted input #6634
Conversation
0bd174c
to
785422b
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.
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveBucketHandle.java
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConfig.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/test/java/io/trino/plugin/hive/AbstractTestHive.java
Outdated
Show resolved
Hide resolved
@@ -16,6 +16,7 @@ | |||
import com.fasterxml.jackson.annotation.JsonCreator; | |||
import com.fasterxml.jackson.annotation.JsonProperty; | |||
import com.google.common.collect.ImmutableList; | |||
import io.trino.plugin.hive.metastore.SortingColumn; |
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 is metastore-specific class and it could be better to use a dedicaed, metastore-agnostic representation here.
i cannot offer a concrete proposal here yet, though
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveBucketHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConfig.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveSessionProperties.java
Outdated
Show resolved
Hide resolved
0e253a4
to
274fdba
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.
small comments
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveBucketHandle.java
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConfig.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveSplitManager.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestEliminatePartialSort.java
Outdated
Show resolved
Hide resolved
0e63e6a
to
eb0f971
Compare
core/trino-main/src/main/java/io/trino/sql/planner/optimizations/AddLocalExchanges.java
Outdated
Show resolved
Hide resolved
2bab2b4
to
b38589f
Compare
b38589f
to
02440f1
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.
small comments
plugin/trino-hive/src/test/java/io/trino/plugin/hive/AbstractTestHive.java
Show resolved
Hide resolved
plugin/trino-hive/src/test/java/io/trino/plugin/hive/AbstractTestHive.java
Show resolved
Hide resolved
mind automation |
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 could add integration test to TestHiveIntegrationSmokeTest
too what verifies plan with sort and limit
44713e1
to
10805d5
Compare
@@ -414,6 +414,16 @@ public PlanWithProperties visitTopN(TopNNode node, PreferredProperties preferred | |||
break; | |||
case PARTIAL: | |||
child = planChild(node, PreferredProperties.any()); | |||
// If source is pre-sorted, partial topN can be replaced with partial Limit N | |||
List<LocalProperty<Symbol>> desiredProperties = node.getOrderingScheme().getOrderBy().stream() |
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 most likely deserves a separate rule but such rule would have to derive properties too (which is not the rule way). I think it's fine to keep simplification here since it's rather trivial and all information are at hand. cc @martint
10805d5
to
5825227
Compare
Added testOptimizeSortedFileRead in TestHiveIntegrationSmokeTest which verifies change in plan with sorted hive table |
5825227
to
3cefc58
Compare
6fb8227
to
9598eeb
Compare
9598eeb
to
26b7574
Compare
@lhofhansl you can try this one now with Phoenix connector |
Fixes #5372