From 0c29e7cfa1dfa01efb5d8b66bf57a5fe10205ae1 Mon Sep 17 00:00:00 2001 From: englefly Date: Tue, 28 Nov 2023 03:51:59 +0800 Subject: [PATCH] fix --- .../doris/nereids/cost/CostModelV1.java | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java index aac41e8b9705e1..30e58d25d4d973 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java @@ -322,21 +322,24 @@ private double skewPenalty(PhysicalHashJoin phys int totalInstanceNumber) { double penalty = 1.0; for (Expression conj : physicalHashJoin.getHashJoinConjuncts()) { - EqualTo eq = (EqualTo) JoinUtils.swapEqualToForChildrenOrder( - (EqualTo) conj, physicalHashJoin.left().getOutputSet()); - ColumnStatistic leftColStats = probeStats.findColumnStatistics(eq.left()); - if (leftColStats != null && !leftColStats.isUnKnown()) { - if (leftColStats.ndv < beNumber) { - penalty = Math.max(totalInstanceNumber / Math.max(1.0, leftColStats.ndv), penalty); - break; + // TODO: NullSafeEqualTo need refactor + if (conj instanceof EqualTo) { + EqualTo eq = (EqualTo) JoinUtils.swapEqualToForChildrenOrder( + (EqualTo) conj, physicalHashJoin.left().getOutputSet()); + ColumnStatistic leftColStats = probeStats.findColumnStatistics(eq.left()); + if (leftColStats != null && !leftColStats.isUnKnown()) { + if (leftColStats.ndv < beNumber) { + penalty = Math.max(totalInstanceNumber / Math.max(1.0, leftColStats.ndv), penalty); + break; + } } - } - ColumnStatistic rightColStats = buildStats.findColumnStatistics(eq.right()); - if (rightColStats != null && !rightColStats.isUnKnown()) { - if (rightColStats.ndv < beNumber) { - penalty = Math.max(totalInstanceNumber / Math.max(1.0, rightColStats.ndv), penalty); - break; + ColumnStatistic rightColStats = buildStats.findColumnStatistics(eq.right()); + if (rightColStats != null && !rightColStats.isUnKnown()) { + if (rightColStats.ndv < beNumber) { + penalty = Math.max(totalInstanceNumber / Math.max(1.0, rightColStats.ndv), penalty); + break; + } } } }