xzj7019 commented on code in PR #40126:
URL: https://github.com/apache/doris/pull/40126#discussion_r1737695146


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java:
##########
@@ -342,14 +342,9 @@ public ColumnStatistic visitMin(Min min, Statistics 
context) {
         if (columnStat.isUnKnown) {
             return ColumnStatistic.UNKNOWN;
         }
-        /*
-        we keep columnStat.min and columnStat.max, but set ndv=1.
-        if there is group-by keys, we will update count when visiting group 
clause
-        */
-        double width = min.child().getDataType().width();
-        return new 
ColumnStatisticBuilder().setCount(1).setNdv(1).setAvgSizeByte(width)
-                
.setMinValue(columnStat.minValue).setMinExpr(columnStat.minExpr)
-                
.setMaxValue(columnStat.maxValue).setMaxExpr(columnStat.maxExpr).build();
+        // if this is scalar agg, we will update count and ndv to 1 when 
visiting group clause

Review Comment:
   1) count's row count: if scalar, then 1, else, without change.
   2) sum/avg: clear min/max



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