From 34b048a2bdcaa0a3faad8ee2452f05134129bd12 Mon Sep 17 00:00:00 2001 From: minghong Date: Sun, 25 Jun 2023 21:37:55 +0800 Subject: [PATCH] [fix](nereids) update outer join estimation #21126 the row count of left outer join should be no less than left child row count. --- .../java/org/apache/doris/nereids/stats/JoinEstimation.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/JoinEstimation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/JoinEstimation.java index a45d2c6175..228b6936a7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/JoinEstimation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/JoinEstimation.java @@ -279,10 +279,12 @@ public class JoinEstimation { } else if (joinType == JoinType.LEFT_OUTER_JOIN) { Statistics innerJoinStats = estimateInnerJoin(leftStats, rightStats, join); double rowCount = Math.max(leftStats.getRowCount(), innerJoinStats.getRowCount()); + rowCount = Math.max(leftStats.getRowCount(), rowCount); return innerJoinStats.withRowCount(rowCount); } else if (joinType == JoinType.RIGHT_OUTER_JOIN) { Statistics innerJoinStats = estimateInnerJoin(leftStats, rightStats, join); double rowCount = Math.max(rightStats.getRowCount(), innerJoinStats.getRowCount()); + rowCount = Math.max(rowCount, rightStats.getRowCount()); return innerJoinStats.withRowCount(rowCount); } else if (joinType == JoinType.FULL_OUTER_JOIN) { Statistics innerJoinStats = estimateInnerJoin(leftStats, rightStats, join);