You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "morrySnow (via GitHub)" <gi...@apache.org> on 2023/06/19 08:35:02 UTC

[GitHub] [doris] morrySnow commented on a diff in pull request #20978: [fix](nereids) compute output size in correct way

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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org