diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java index ee8e75535527e35..3e0c806096aec97 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java @@ -28,6 +28,7 @@ import org.apache.doris.nereids.jobs.joinorder.hypergraph.node.StructInfoNode; import org.apache.doris.nereids.memo.Group; import org.apache.doris.nereids.memo.GroupExpression; +import org.apache.doris.nereids.rules.exploration.mv.StructInfo; import org.apache.doris.nereids.trees.expressions.Alias; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.NamedExpression; @@ -428,6 +429,10 @@ private Pair buildForMv(Plan plan) { return Pair.of(child.first, child.second); } + if (StructInfo.isValidLimit(plan)) { + return this.buildForMv(plan.child(0)); + } + // process Other Node int idx = this.addStructInfoNode(plan); return Pair.of(new BitSet(), LongBitmap.newBitmap(idx)); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java index 365360e06b096c3..defa6185ef5125b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java @@ -40,6 +40,7 @@ import org.apache.doris.nereids.trees.plans.AbstractPlan; import org.apache.doris.nereids.trees.plans.GroupPlan; import org.apache.doris.nereids.trees.plans.JoinType; +import org.apache.doris.nereids.trees.plans.LimitPhase; import org.apache.doris.nereids.trees.plans.ObjectId; import org.apache.doris.nereids.trees.plans.Plan; import org.apache.doris.nereids.trees.plans.RelationId; @@ -55,11 +56,14 @@ import org.apache.doris.nereids.trees.plans.logical.LogicalFileScan.SelectedPartitions; import org.apache.doris.nereids.trees.plans.logical.LogicalFilter; import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; +import org.apache.doris.nereids.trees.plans.logical.LogicalLimit; import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan; +import org.apache.doris.nereids.trees.plans.logical.LogicalPartitionTopN; import org.apache.doris.nereids.trees.plans.logical.LogicalPlan; import org.apache.doris.nereids.trees.plans.logical.LogicalProject; import org.apache.doris.nereids.trees.plans.logical.LogicalRepeat; import org.apache.doris.nereids.trees.plans.logical.LogicalSort; +import org.apache.doris.nereids.trees.plans.logical.LogicalTopN; import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanVisitor; import org.apache.doris.nereids.trees.plans.visitor.ExpressionLineageReplacer; @@ -653,6 +657,15 @@ public static PlanCheckContext of(Set supportJoinTypes) { } } + /** + * Limit, topN or partitionTopN which is pushed down are valid + * */ + public static boolean isValidLimit(Plan plan) { + return (plan instanceof LogicalLimit && ((LogicalLimit) plan).getPhase() == LimitPhase.LOCAL) + || (plan instanceof LogicalPartitionTopN && ((LogicalPartitionTopN) plan).isPushed()) + || (plan instanceof LogicalTopN && ((LogicalTopN) plan).isPushed()); + } + /** * PlanPatternChecker, this is used to check the plan pattern is valid or not */ @@ -692,7 +705,7 @@ public Boolean visit(Plan plan, PlanCheckContext checkContext) { || plan instanceof LogicalSort || plan instanceof LogicalAggregate || plan instanceof GroupPlan - || plan instanceof LogicalRepeat) { + || plan instanceof LogicalRepeat || isValidLimit(plan)) { return doVisit(plan, checkContext); } return false; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/LimitAggToTopNAgg.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/LimitAggToTopNAgg.java index dfa1230a8f8f0eb..d7b1db120be98d7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/LimitAggToTopNAgg.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/LimitAggToTopNAgg.java @@ -61,7 +61,8 @@ public List buildRules() { return null; } List orderKeys = Lists.newArrayList(orderKeysOpt.get()); - return new LogicalTopN<>(orderKeys, limit.getLimit(), limit.getOffset(), agg); + return new LogicalTopN<>(orderKeys, limit.getLimit(), limit.getOffset(), agg, + false); }).toRule(RuleType.LIMIT_AGG_TO_TOPN_AGG), //limit->project->agg to topn->project->agg logicalLimit(logicalProject(logicalAggregate())) @@ -82,7 +83,7 @@ public List buildRules() { if (outputAllGroupKeys(limit, agg)) { result = new LogicalTopN<>(orderKeys, limit.getLimit(), - limit.getOffset(), project); + limit.getOffset(), project, false); } else { // add the first group by key to topn, and prune this key by upper project // topn order keys are prefix of group by keys @@ -100,7 +101,7 @@ public List buildRules() { project = project.withProjects(bottomProjections); } LogicalTopN topn = new LogicalTopN<>(orderKeys, limit.getLimit(), - limit.getOffset(), project); + limit.getOffset(), project, false); if (shouldPruneFirstGroupByKey) { List limitOutput = limit.getOutput().stream() .map(e -> (NamedExpression) e).collect(Collectors.toList()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/LimitSortToTopN.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/LimitSortToTopN.java index fa9abca9e58f865..1064ee50cfb5385 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/LimitSortToTopN.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/LimitSortToTopN.java @@ -43,7 +43,7 @@ public List buildRules() { return new LogicalTopN<>(sort.getOrderKeys(), limit.getLimit(), limit.getOffset(), - sort.child(0)); + sort.child(0), false); }).toRule(RuleType.LIMIT_SORT_TO_TOP_N), // limit -> proj -> sort ==> proj -> topN logicalLimit(logicalProject(logicalSort())) @@ -53,7 +53,7 @@ public List buildRules() { LogicalTopN topN = new LogicalTopN<>(sort.getOrderKeys(), limit.getLimit(), limit.getOffset(), - sort.child(0)); + sort.child(0), false); return project.withChildren(Lists.newArrayList(topN)); }).toRule(RuleType.LIMIT_SORT_TO_TOP_N) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/MergeTopNs.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/MergeTopNs.java index 39ea7a384df4430..763218041812653 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/MergeTopNs.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/MergeTopNs.java @@ -50,7 +50,7 @@ public Rule build() { long newOffset = offset + childOffset; // choose min limit long newLimit = Math.min(limit, childLimit); - return topN.withLimitChild(newLimit, newOffset, childTopN.child()); + return topN.withLimitChild(newLimit, newOffset, childTopN.child(), false); }).toRule(RuleType.MERGE_TOP_N); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughJoin.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughJoin.java index f2dde7ba2a8be52..6759e3812d1ed68 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughJoin.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughJoin.java @@ -98,7 +98,7 @@ private Plan pushTopNThroughJoin(LogicalTopN topN, LogicalJoin

left = topN.withLimitOrderKeyAndChild( topN.getLimit() + topN.getOffset(), 0, pushedOrderKeys, - PlanUtils.distinct(join.left())); + PlanUtils.distinct(join.left()), true); return join.withChildren(left, join.right()); } return null; @@ -109,7 +109,7 @@ private Plan pushTopNThroughJoin(LogicalTopN topN, LogicalJoin

right = topN.withLimitOrderKeyAndChild( topN.getLimit() + topN.getOffset(), 0, pushedOrderKeys, - PlanUtils.distinct(join.right())); + PlanUtils.distinct(join.right()), true); return join.withChildren(join.left(), right); } return null; @@ -122,14 +122,14 @@ private Plan pushTopNThroughJoin(LogicalTopN topN, LogicalJoin

rightPushedOrderKeys = getPushedOrderKeys(groupBySlots, join.right().getOutputSet(), topN.getOrderKeys()); if (!rightPushedOrderKeys.isEmpty()) { rightChild = topN.withLimitOrderKeyAndChild( topN.getLimit() + topN.getOffset(), 0, rightPushedOrderKeys, - PlanUtils.distinct(join.right())); + PlanUtils.distinct(join.right()), true); } if (leftChild == join.left() && rightChild == join.right()) { return null; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughUnion.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughUnion.java index f6e944a7a914f0f..7fc957cda1c4692 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughUnion.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughUnion.java @@ -79,7 +79,7 @@ public List buildRules() { ExpressionUtils.replace(orderKey.getExpr(), replaceMap))) .collect(ImmutableList.toImmutableList()); newChildren.add(new LogicalTopN<>(orderKeys, topN.getLimit() + topN.getOffset(), 0, - PlanUtils.distinct(child))); + PlanUtils.distinct(child), true)); } if (union.children().equals(newChildren)) { return null; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughJoin.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughJoin.java index 28a7f2688be8cd2..b88124a4cc55af5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughJoin.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughJoin.java @@ -90,7 +90,7 @@ private Plan pushLimitThroughJoin(LogicalTopN topN, LogicalJoin< case LEFT_OUTER_JOIN: if (join.left().getOutputSet().containsAll(orderbySlots)) { return join.withChildren( - topN.withLimitChild(topN.getLimit() + topN.getOffset(), 0, join.left()), + topN.withLimitChild(topN.getLimit() + topN.getOffset(), 0, join.left(), true), join.right()); } return null; @@ -98,19 +98,19 @@ private Plan pushLimitThroughJoin(LogicalTopN topN, LogicalJoin< if (join.right().getOutputSet().containsAll(orderbySlots)) { return join.withChildren( join.left(), - topN.withLimitChild(topN.getLimit() + topN.getOffset(), 0, join.right())); + topN.withLimitChild(topN.getLimit() + topN.getOffset(), 0, join.right(), true)); } return null; case CROSS_JOIN: if (join.left().getOutputSet().containsAll(orderbySlots)) { return join.withChildren( - topN.withLimitChild(topN.getLimit() + topN.getOffset(), 0, join.left()), + topN.withLimitChild(topN.getLimit() + topN.getOffset(), 0, join.left(), true), join.right()); } else if (join.right().getOutputSet().containsAll(orderbySlots)) { return join.withChildren( join.left(), - topN.withLimitChild(topN.getLimit() + topN.getOffset(), 0, join.right())); + topN.withLimitChild(topN.getLimit() + topN.getOffset(), 0, join.right(), true)); } else { return null; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughUnion.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughUnion.java index c13c1143efd8778..588e6491ba72cb3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughUnion.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughUnion.java @@ -75,7 +75,8 @@ public List buildRules() { ExpressionUtils.replace(orderKey.getExpr(), replaceMap))) .collect(ImmutableList.toImmutableList()); newChildren.add( - new LogicalTopN<>(orderKeys, topN.getLimit() + topN.getOffset(), 0, child)); + new LogicalTopN<>(orderKeys, topN.getLimit() + topN.getOffset(), 0, + child, true)); } if (union.children().equals(newChildren)) { return null; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopier.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopier.java index 20e72b81aa7872b..90010911ff915a8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopier.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopier.java @@ -214,7 +214,7 @@ public Plan visitLogicalTopN(LogicalTopN topN, DeepCopierContext .map(o -> new OrderKey(ExpressionDeepCopier.INSTANCE.deepCopy(o.getExpr(), context), o.isAsc(), o.isNullFirst())) .collect(ImmutableList.toImmutableList()); - return new LogicalTopN<>(orderKeys, topN.getLimit(), topN.getOffset(), child); + return new LogicalTopN<>(orderKeys, topN.getLimit(), topN.getOffset(), child, false); } @Override @@ -241,7 +241,7 @@ public Plan visitLogicalPartitionTopN(LogicalPartitionTopN parti .map(o -> (OrderExpression) ExpressionDeepCopier.INSTANCE.deepCopy(o, context)) .collect(ImmutableList.toImmutableList()); return new LogicalPartitionTopN<>(partitionTopN.getFunction(), partitionKeys, orderKeys, - partitionTopN.hasGlobalLimit(), partitionTopN.getPartitionLimit(), child); + partitionTopN.hasGlobalLimit(), partitionTopN.getPartitionLimit(), child, false); } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalPartitionTopN.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalPartitionTopN.java index 69da96e8f7ebcbb..09188a921bd2dfc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalPartitionTopN.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalPartitionTopN.java @@ -51,19 +51,20 @@ public class LogicalPartitionTopN extends LogicalUnary< private final List orderKeys; private final boolean hasGlobalLimit; private final long partitionLimit; + private final boolean pushed; public LogicalPartitionTopN(WindowExpression windowExpr, boolean hasGlobalLimit, long partitionLimit, - CHILD_TYPE child) { + CHILD_TYPE child, boolean pushed) { this(windowExpr.getFunction(), windowExpr.getPartitionKeys(), windowExpr.getOrderKeys(), hasGlobalLimit, partitionLimit, Optional.empty(), - Optional.empty(), child); + Optional.empty(), child, pushed); } public LogicalPartitionTopN(WindowFuncType windowFuncType, List partitionKeys, List orderKeys, boolean hasGlobalLimit, long partitionLimit, - CHILD_TYPE child) { + CHILD_TYPE child, boolean pushed) { this(windowFuncType, partitionKeys, orderKeys, hasGlobalLimit, partitionLimit, - Optional.empty(), Optional.empty(), child); + Optional.empty(), Optional.empty(), child, pushed); } /** @@ -72,7 +73,8 @@ public LogicalPartitionTopN(WindowFuncType windowFuncType, List part public LogicalPartitionTopN(WindowFuncType windowFuncType, List partitionKeys, List orderKeys, boolean hasGlobalLimit, long partitionLimit, Optional groupExpression, - Optional logicalProperties, CHILD_TYPE child) { + Optional logicalProperties, CHILD_TYPE child, + boolean pushed) { super(PlanType.LOGICAL_PARTITION_TOP_N, groupExpression, logicalProperties, child); this.function = windowFuncType; this.partitionKeys = ImmutableList.copyOf(Objects.requireNonNull(partitionKeys, @@ -81,6 +83,7 @@ public LogicalPartitionTopN(WindowFuncType windowFuncType, List part "orderKeys can not be null")); this.hasGlobalLimit = hasGlobalLimit; this.partitionLimit = partitionLimit; + this.pushed = pushed; } /** @@ -88,7 +91,7 @@ public LogicalPartitionTopN(WindowFuncType windowFuncType, List part */ public LogicalPartitionTopN(Expression expr, List partitionKeys, List orderKeys, boolean hasGlobalLimit, long partitionLimit, Optional groupExpression, - Optional logicalProperties, CHILD_TYPE child) { + Optional logicalProperties, CHILD_TYPE child, boolean pushed) { super(PlanType.LOGICAL_PARTITION_TOP_N, groupExpression, logicalProperties, child); if (expr instanceof RowNumber) { this.function = WindowFuncType.ROW_NUMBER; @@ -104,6 +107,7 @@ public LogicalPartitionTopN(Expression expr, List partitionKeys, Lis Objects.requireNonNull(orderKeys, "orderKeys can not be null")); this.hasGlobalLimit = hasGlobalLimit; this.partitionLimit = partitionLimit; + this.pushed = pushed; } @Override @@ -134,6 +138,10 @@ public long getPartitionLimit() { return partitionLimit; } + public boolean isPushed() { + return pushed; + } + @Override public String toString() { return Utils.toSqlString("LogicalPartitionTopN", @@ -180,20 +188,20 @@ public List getExpressions() { public LogicalPartitionTopN withPartitionKeysAndOrderKeys( List partitionKeys, List orderKeys) { return new LogicalPartitionTopN<>(function, partitionKeys, orderKeys, hasGlobalLimit, partitionLimit, - Optional.empty(), Optional.of(getLogicalProperties()), child()); + Optional.empty(), Optional.of(getLogicalProperties()), child(), this.pushed); } @Override public LogicalPartitionTopN withChildren(List children) { Preconditions.checkArgument(children.size() == 1); return new LogicalPartitionTopN<>(function, partitionKeys, orderKeys, hasGlobalLimit, partitionLimit, - children.get(0)); + children.get(0), this.pushed); } @Override public LogicalPartitionTopN withGroupExpression(Optional groupExpression) { return new LogicalPartitionTopN<>(function, partitionKeys, orderKeys, hasGlobalLimit, partitionLimit, - groupExpression, Optional.of(getLogicalProperties()), child()); + groupExpression, Optional.of(getLogicalProperties()), child(), this.pushed); } @Override @@ -201,6 +209,6 @@ public Plan withGroupExprLogicalPropChildren(Optional groupExpr Optional logicalProperties, List children) { Preconditions.checkArgument(children.size() == 1); return new LogicalPartitionTopN<>(function, partitionKeys, orderKeys, hasGlobalLimit, partitionLimit, - groupExpression, logicalProperties, children.get(0)); + groupExpression, logicalProperties, children.get(0), this.pushed); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalTopN.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalTopN.java index 9c7cfacad8dd33a..61d636b349b6049 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalTopN.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalTopN.java @@ -47,16 +47,18 @@ public class LogicalTopN extends LogicalUnary> expressions; + private final boolean pushed; - public LogicalTopN(List orderKeys, long limit, long offset, CHILD_TYPE child) { - this(orderKeys, limit, offset, Optional.empty(), Optional.empty(), child); + public LogicalTopN(List orderKeys, long limit, long offset, CHILD_TYPE child, boolean pushed) { + this(orderKeys, limit, offset, Optional.empty(), Optional.empty(), child, + pushed); } /** * Constructor for LogicalSort. */ public LogicalTopN(List orderKeys, long limit, long offset, Optional groupExpression, - Optional logicalProperties, CHILD_TYPE child) { + Optional logicalProperties, CHILD_TYPE child, boolean pushed) { super(PlanType.LOGICAL_TOP_N, groupExpression, logicalProperties, child); this.orderKeys = ImmutableList.copyOf(Objects.requireNonNull(orderKeys, "orderKeys can not be null")); this.limit = limit; @@ -68,6 +70,7 @@ public LogicalTopN(List orderKeys, long limit, long offset, Optional getExpressions() { public LogicalTopN withOrderKeys(List orderKeys) { return new LogicalTopN<>(orderKeys, limit, offset, - Optional.empty(), Optional.of(getLogicalProperties()), child()); + Optional.empty(), Optional.of(getLogicalProperties()), child(), this.pushed); } - public LogicalTopN withLimitChild(long limit, long offset, Plan child) { - return new LogicalTopN<>(orderKeys, limit, offset, child); + public LogicalTopN withLimitChild(long limit, long offset, Plan child, boolean pushed) { + return new LogicalTopN<>(orderKeys, limit, offset, child, pushed); } - public LogicalTopN withLimitOrderKeyAndChild(long limit, long offset, List orderKeys, Plan child) { - return new LogicalTopN<>(orderKeys, limit, offset, child); + public LogicalTopN withLimitOrderKeyAndChild(long limit, long offset, List orderKeys, Plan child, + boolean pushed) { + return new LogicalTopN<>(orderKeys, limit, offset, child, pushed); } @Override public LogicalTopN withChildren(List children) { Preconditions.checkArgument(children.size() == 1, "LogicalTopN should have 1 child, but input is %s", children.size()); - return new LogicalTopN<>(orderKeys, limit, offset, children.get(0)); + return new LogicalTopN<>(orderKeys, limit, offset, children.get(0), this.pushed); } @Override public LogicalTopN withGroupExpression(Optional groupExpression) { return new LogicalTopN<>(orderKeys, limit, offset, groupExpression, Optional.of(getLogicalProperties()), - child()); + child(), this.pushed); } @Override public Plan withGroupExprLogicalPropChildren(Optional groupExpression, Optional logicalProperties, List children) { Preconditions.checkArgument(children.size() == 1); - return new LogicalTopN<>(orderKeys, limit, offset, groupExpression, logicalProperties, children.get(0)); + return new LogicalTopN<>(orderKeys, limit, offset, groupExpression, logicalProperties, children.get(0), + this.pushed); } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalWindow.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalWindow.java index 5ee70afbf5ff86e..ed96239295e117c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalWindow.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalWindow.java @@ -319,7 +319,7 @@ && child(0).child(0) instanceof LogicalPartitionTopN)) { public Plan pushPartitionLimitThroughWindow(WindowExpression windowFunc, long partitionLimit, boolean hasGlobalLimit) { LogicalWindow window = (LogicalWindow) withChildren(new LogicalPartitionTopN<>(windowFunc, hasGlobalLimit, - partitionLimit, child(0))); + partitionLimit, child(0), true)); return window; }