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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/JoinEstimation.java:
##########
@@ -137,7 +137,7 @@ private static Statistics estimateHashJoin(Statistics 
leftStats, Statistics righ
             outputRowCount = outputRowCount * Math.pow(0.9, 
unTrustableCondition.size());
         } else {
             outputRowCount = Math.max(leftStats.getRowCount(), 
rightStats.getRowCount());
-            Optional<Double> ratio = 
unTrustEqualRatio.stream().max(Double::compareTo);
+            Optional<Double> ratio = 
unTrustEqualRatio.stream().min(Double::compareTo);

Review Comment:
   there are some difference. consider two condition: A left join B on A.x=B.x 
and A.y=B.y
   suppose
   A left join B on A.x=B.x, output expand A by 3 times,
   A left join B on A.y=B.y, output expand A by 5 times.
   
   ‘ A left join B on A.x=B.x and A.y=B.y’ output should be less than ‘A left 
join B on A.x=B.x’
   



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/JoinEstimation.java:
##########
@@ -137,7 +137,7 @@ private static Statistics estimateHashJoin(Statistics 
leftStats, Statistics righ
             outputRowCount = outputRowCount * Math.pow(0.9, 
unTrustableCondition.size());
         } else {
             outputRowCount = Math.max(leftStats.getRowCount(), 
rightStats.getRowCount());
-            Optional<Double> ratio = 
unTrustEqualRatio.stream().max(Double::compareTo);
+            Optional<Double> ratio = 
unTrustEqualRatio.stream().min(Double::compareTo);

Review Comment:
   there are some difference. consider two condition: A left join B on A.x=B.x 
and A.y=B.y
   suppose
   A left join B on A.x=B.x, output expand A by 3 times,
   A left join B on A.y=B.y, output expand A by 5 times.
   
   ‘ A left join B on A.x=B.x and A.y=B.y’ output should be less than ‘A left 
join B on A.x=B.x’
   



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