diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java index de009b1524f484..71f96ef0496625 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java @@ -82,6 +82,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -333,16 +334,17 @@ private LogicalProject pushDownCountWithoutSlotRef( return canNotPush; } } - List projectExpr = project.getProjects() - .stream() - .flatMap(p -> Project.collectExpressions(p).stream()) - .collect(ImmutableList.toImmutableList()); - boolean noSlotRef = projectExpr.stream().allMatch(expr -> { + List projectExpr = new ArrayList<>(); + for (Expression p : project.getProjects()) { + projectExpr.addAll(Project.collectExpressions(p)); + } + boolean noSlotRef = true; + for (Expression expr : projectExpr) { if (expr instanceof SlotReference) { - return false; + noSlotRef = false; + break; } - return true; - }); + } if (!noSlotRef) { return canNotPush; }