This is an automated email from the ASF dual-hosted git repository.
englefly pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new ce89a9f07c5 [fix](Nereids) top-n with top project should hit top-n opt
(#29971)
ce89a9f07c5 is described below
commit ce89a9f07c561317fefe8023047269ea3b264038
Author: morrySnow <[email protected]>
AuthorDate: Mon Jan 15 14:48:25 2024 +0800
[fix](Nereids) top-n with top project should hit top-n opt (#29971)
in PR #29312, we limit top-n opt only enable in simplest cases.
in this PR, we let go of some restrictions.
---
.../java/org/apache/doris/nereids/processor/post/TopNScanOpt.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/TopNScanOpt.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/TopNScanOpt.java
index bc0586f40c4..89d396611c5 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/TopNScanOpt.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/TopNScanOpt.java
@@ -52,6 +52,14 @@ public class TopNScanOpt extends PlanPostProcessor {
public Plan visitPhysicalSink(PhysicalSink<? extends Plan> physicalSink,
CascadesContext context) {
if (physicalSink.child() instanceof TopN) {
return super.visit(physicalSink, context);
+ } else if (physicalSink.child() instanceof Project &&
physicalSink.child().child(0) instanceof TopN) {
+ PhysicalTopN<?> oldTopN = (PhysicalTopN<?>)
physicalSink.child().child(0);
+ PhysicalTopN<?> newTopN = (PhysicalTopN<?>) oldTopN.accept(this,
context);
+ if (newTopN == oldTopN) {
+ return physicalSink;
+ } else {
+ return
physicalSink.withChildren(physicalSink.child().withChildren(newTopN));
+ }
}
return physicalSink;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]