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


##########
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:
   what's mean about 8?



##########
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);

Review Comment:
   why we need do this? expressionToColumnStats do not contain and only contain 
all slot of plan's output?



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