morrySnow commented on code in PR #35162:
URL: https://github.com/apache/doris/pull/35162#discussion_r1609820626


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:
##########
@@ -306,6 +316,45 @@ && couldConvertToMulti(agg))
         );
     }
 
+    /*
+     *  select 66 from baseall_dup; could use pushAggOp=COUNT to not scan real 
data.
+     */
+    private LogicalProject<? extends Plan> pushDownCountWithoutSlotRef(
+            LogicalProject<? extends Plan> project,
+            LogicalOlapScan logicalScan,
+            CascadesContext cascadesContext) {
+        final LogicalProject<? extends Plan> canNotPush = project;
+        if (!enablePushDownNoGroupAgg()) {
+            return canNotPush;
+        }
+        if (logicalScan != null) {
+            KeysType keysType = logicalScan.getTable().getKeysType();
+            if (keysType != KeysType.DUP_KEYS) {
+                return canNotPush;
+            }
+        }
+        List<Expression> projectExpr = project.getProjects()
+                .stream()
+                .flatMap(p -> Project.collectExpressions(p).stream())
+                .collect(ImmutableList.toImmutableList());
+        boolean noSlotRef = projectExpr.stream().allMatch(expr -> {
+            if (expr instanceof SlotReference) {
+                return false;
+            }
+            return true;
+        });

Review Comment:
   use `e.anyMatch(SlotReference.class::isInstance)`



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:
##########
@@ -306,6 +316,45 @@ && couldConvertToMulti(agg))
         );
     }
 
+    /*
+     *  select 66 from baseall_dup; could use pushAggOp=COUNT to not scan real 
data.
+     */
+    private LogicalProject<? extends Plan> pushDownCountWithoutSlotRef(
+            LogicalProject<? extends Plan> project,
+            LogicalOlapScan logicalScan,
+            CascadesContext cascadesContext) {
+        final LogicalProject<? extends Plan> canNotPush = project;
+        if (!enablePushDownNoGroupAgg()) {
+            return canNotPush;
+        }
+        if (logicalScan != null) {
+            KeysType keysType = logicalScan.getTable().getKeysType();
+            if (keysType != KeysType.DUP_KEYS) {
+                return canNotPush;
+            }
+        }
+        List<Expression> projectExpr = project.getProjects()
+                .stream()
+                .flatMap(p -> Project.collectExpressions(p).stream())
+                .collect(ImmutableList.toImmutableList());

Review Comment:
   do not use stream api, it hurt performance



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to