[fix](nereids) update outer join estimation #21126

the row count of left outer join should be no less than left child row count.
This commit is contained in:
minghong
2023-06-25 21:37:55 +08:00
committed by GitHub
parent af2b67e65a
commit 34b048a2bd

View File

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