Kikyou1997 commented on code in PR #17790:
URL: https://github.com/apache/doris/pull/17790#discussion_r1136989717


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -436,12 +437,44 @@ private Statistics computeAggregate(Aggregate<? extends 
Plan> aggregate) {
         // TODO: since we have no column stats here. just use a fix ratio to 
compute the row count.
         List<Expression> groupByExpressions = 
aggregate.getGroupByExpressions();
         Statistics childStats = groupExpression.childStatistics(0);
-        Map<Expression, ColumnStatistic> childSlotToColumnStats = 
childStats.columnStatistics();
-        double resultSetCount = groupByExpressions.stream().flatMap(expr -> 
expr.getInputSlots().stream())
-                
.filter(childSlotToColumnStats::containsKey).map(childSlotToColumnStats::get).map(s
 -> s.ndv)
-                .reduce(1d, (a, b) -> a * b);
-        if (resultSetCount <= 0) {
-            resultSetCount = 1L;
+        double resultSetCount = 1;
+        if (!groupByExpressions.isEmpty()) {

Review Comment:
   这一块不必要的分支判断有点多



-- 
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