From 6d2b2e84167869d0d02f77f7ce0a76ad287fd86f Mon Sep 17 00:00:00 2001 From: minghong Date: Tue, 10 Sep 2024 17:26:28 +0800 Subject: [PATCH] skip if ut or hint --- .../java/org/apache/doris/nereids/NereidsPlanner.java | 8 ++++++-- .../org/apache/doris/nereids/stats/StatsCalculator.java | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java index 663b78ec4fc5444..5d616314d0f1879 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java @@ -22,6 +22,7 @@ import org.apache.doris.analysis.StatementBase; import org.apache.doris.catalog.Column; import org.apache.doris.catalog.TableIf; +import org.apache.doris.common.FeConstants; import org.apache.doris.common.FormatOptions; import org.apache.doris.common.NereidsException; import org.apache.doris.common.Pair; @@ -257,8 +258,11 @@ private Plan planWithoutLock( return rewrittenPlan; } } - List scans = getAllOlapScans(cascadesContext.getRewritePlan()); - StatsCalculator.disableJoinReorderIfTableRowCountNotAvailable(scans, cascadesContext); + + if (!FeConstants.runningUnitTest && !cascadesContext.isLeadingDisableJoinReorder()) { + List scans = getAllOlapScans(cascadesContext.getRewritePlan()); + StatsCalculator.disableJoinReorderIfTableRowCountNotAvailable(scans, cascadesContext); + } optimize(); if (statementContext.getConnectContext().getExecutor() != null) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java index 7710926c2cda212..15a973a19d5e3d6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java @@ -222,6 +222,7 @@ public static void disableJoinReorderIfTableRowCountNotAvailable( LOG.info("disable join reorder since row count not available: " + scan.getTable().getNameWithFullQualifiers()); ConnectContext.get().getSessionVariable().setDisableJoinReorder(true); + return; } } }