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


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/Statistics.java:
##########
@@ -149,21 +155,28 @@ public Statistics merge(Statistics statistics) {
         return this;
     }
 
-    private double computeTupleSize() {
+    private double computeTupleSize(Plan plan) {
         if (tupleSize <= 0) {
-            tupleSize = expressionToColumnStats.values().stream()
-                    .map(s -> s.avgSizeByte).reduce(0D, Double::sum);
+            tupleSize = 0;
+            for (Slot slot : plan.getOutput()) {
+                ColumnStatistic colStats = expressionToColumnStats.get(slot);
+                if (colStats != null) {
+                    tupleSize += colStats.avgSizeByte;
+                } else {
+                    tupleSize += 8;

Review Comment:
   some output columns are not in that map.
   These columns are global Agg function column. for example, there is 
"partial_sum" column in map, but we want "sum".
     
   



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