diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalAggToPhysicalHashAgg.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalAggToPhysicalHashAgg.java index f6672aa7ee..46874ff526 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalAggToPhysicalHashAgg.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalAggToPhysicalHashAgg.java @@ -29,7 +29,8 @@ public class LogicalAggToPhysicalHashAgg extends OneImplementationRuleFactory { public Rule build() { return logicalAggregate().thenApply(ctx -> { boolean useStreamAgg = !ctx.connectContext.getSessionVariable().disableStreamPreaggregations - && !ctx.root.getGroupByExpressions().isEmpty(); + && !ctx.root.getGroupByExpressions().isEmpty() + && !ctx.root.isFinalPhase(); return new PhysicalAggregate<>( ctx.root.getGroupByExpressions(), ctx.root.getOutputExpressions(),