englefly commented on code in PR #41127:
URL: https://github.com/apache/doris/pull/41127#discussion_r1770870663


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:
##########
@@ -136,7 +137,8 @@ public List<Rule> buildRules() {
                     .when(agg -> agg.getGroupByExpressions().isEmpty())
                     .when(agg -> {
                         Set<AggregateFunction> funcs = 
agg.getAggregateFunctions();
-                        return !funcs.isEmpty() && funcs.stream().allMatch(f 
-> f instanceof Count && !f.isDistinct());
+                        return !funcs.isEmpty() && funcs.stream().allMatch(f 
-> f instanceof Count && !f.isDistinct()
+                            && (((Count) f).isCountStar() || f.child(0) 
instanceof Slot));

Review Comment:
   f.child(0) could be constant (not only literal). f.child(0).isConstant()
   example
   select count(1) from T; 
   --------
   another question about this rule:
   does it work for the pattern, in which there is a project?
   agg->project->filter->scan



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to