Skip to content

Commit 61aded4

Browse files
committed
[fix](fe) Align partition preloading with unified distribution
### What problem does this PR solve? Related PR: #69830 Problem Summary: Master added a pre-lock partition-view warmup decision that still calls the legacy distribute-planner switch. After coordinator unification that method no longer exists, and every executable or distributed EXPLAIN plan uses Nereids distribution. Remove the obsolete switch and dictionary exceptions, and share one finalization predicate between warmup selection and actual distribution. Update the existing planner tests to cover all EXPLAIN levels. ### Release note None ### Check List (For Author) - Test: 181 focused FE unit tests passed via run-fe-ut.sh, covering Coordinator, cloud workers, transport, INSERT, dictionary drop races, Nereids planning, partition preloading, CTE pruning, statement execution, and session variables. build.sh --fe --exclude-obs-dependencies --exclude-cos-dependencies passed with zero Checkstyle violations. Local output deployment used GNU cp to preserve existing configuration files without the macOS cp -n exit-status issue. - Behavior changed: No additional behavior beyond the unified-distribution refactor - Does this need documentation: No
1 parent 27b54c9 commit 61aded4

2 files changed

Lines changed: 18 additions & 47 deletions

File tree

‎fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java‎

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.apache.doris.common.util.Util;
3636
import org.apache.doris.foundation.format.FormatOptions;
3737
import org.apache.doris.mysql.FieldInfo;
38-
import org.apache.doris.nereids.analyzer.UnboundDictionarySink;
3938
import org.apache.doris.nereids.exceptions.AnalysisException;
4039
import org.apache.doris.nereids.glue.LogicalPlanAdapter;
4140
import org.apache.doris.nereids.glue.translator.PhysicalPlanTranslator;
@@ -65,7 +64,6 @@
6564
import org.apache.doris.nereids.trees.plans.distribute.DistributedPlan;
6665
import org.apache.doris.nereids.trees.plans.distribute.FragmentIdMapping;
6766
import org.apache.doris.nereids.trees.plans.logical.LogicalCatalogRelation;
68-
import org.apache.doris.nereids.trees.plans.logical.LogicalDictionarySink;
6967
import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan;
7068
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
7169
import org.apache.doris.nereids.trees.plans.logical.LogicalSqlCache;
@@ -171,9 +169,7 @@ public void plan(StatementBase queryStmt, org.apache.doris.thrift.TQueryOptions
171169
NereidsPlanner.runningPlanNum.incrementAndGet();
172170
try {
173171
boolean showPlanProcess = showPlanProcess(queryStmt.getExplainOptions());
174-
boolean willFinalizePhysicalPlan = shouldFinalizePhysicalPlan(explainLevel,
175-
SessionVariable.canUseNereidsDistributePlanner(statementContext.getConnectContext()),
176-
isDictionarySink(parsedPlan));
172+
boolean willFinalizePhysicalPlan = shouldFinalizePhysicalPlan(explainLevel);
177173
Consumer<Plan> distributeCallback = plan -> {
178174
setOptimizedPlan(plan);
179175
if (plan instanceof PhysicalPlan) {
@@ -774,8 +770,7 @@ protected void splitFragments(PhysicalPlan resultPlan) {
774770
}
775771

776772
protected void distribute(PhysicalPlan physicalPlan, ExplainLevel explainLevel) {
777-
if (explainLevel.isPlanLevel
778-
&& explainLevel != ExplainLevel.ALL_PLAN && explainLevel != ExplainLevel.DISTRIBUTED_PLAN) {
773+
if (!shouldFinalizePhysicalPlan(explainLevel)) {
779774
return;
780775
}
781776

@@ -1343,16 +1338,9 @@ private boolean showAnalyzeProcess(ExplainLevel explainLevel, boolean showPlanPr
13431338
}
13441339

13451340
@VisibleForTesting
1346-
static boolean isDictionarySink(Plan plan) {
1347-
return plan instanceof UnboundDictionarySink || plan instanceof LogicalDictionarySink;
1348-
}
1349-
1350-
@VisibleForTesting
1351-
static boolean shouldFinalizePhysicalPlan(ExplainLevel explainLevel,
1352-
boolean canUseNereidsDistributePlanner, boolean dictionarySink) {
1341+
static boolean shouldFinalizePhysicalPlan(ExplainLevel explainLevel) {
13531342
return !explainLevel.isPlanLevel
1354-
|| ((explainLevel == ExplainLevel.ALL_PLAN || explainLevel == ExplainLevel.DISTRIBUTED_PLAN)
1355-
&& (canUseNereidsDistributePlanner || dictionarySink));
1343+
|| explainLevel == ExplainLevel.ALL_PLAN || explainLevel == ExplainLevel.DISTRIBUTED_PLAN;
13561344
}
13571345

13581346
private boolean showRewriteProcess(ExplainLevel explainLevel, boolean showPlanProcess) {

‎fe/fe-core/src/test/java/org/apache/doris/nereids/NereidsPlannerTest.java‎

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@
1919

2020
import org.apache.doris.common.jmockit.Deencapsulation;
2121
import org.apache.doris.common.profile.SummaryProfile;
22-
import org.apache.doris.nereids.analyzer.UnboundDictionarySink;
2322
import org.apache.doris.nereids.jobs.executor.TableCollectAndHookInitializer;
2423
import org.apache.doris.nereids.trees.plans.commands.ExplainCommand.ExplainLevel;
25-
import org.apache.doris.nereids.trees.plans.logical.LogicalDictionarySink;
26-
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
2724
import org.apache.doris.qe.ConnectContext;
2825
import org.apache.doris.qe.OriginStatement;
2926
import org.apache.doris.qe.StmtExecutor;
@@ -49,36 +46,22 @@ public void testReplanningReusesPinnedBeExecVersion() {
4946
Assertions.assertEquals(13, retryAttempt.getBeExecVersion());
5047
}
5148

52-
@Test
53-
public void testDictionarySinkRecognitionBeforeAndAfterAnalysis() {
54-
Assertions.assertTrue(NereidsPlanner.isDictionarySink(Mockito.mock(UnboundDictionarySink.class)));
55-
Assertions.assertTrue(NereidsPlanner.isDictionarySink(Mockito.mock(LogicalDictionarySink.class)));
56-
Assertions.assertFalse(NereidsPlanner.isDictionarySink(Mockito.mock(LogicalPlan.class)));
57-
}
58-
5949
@Test
6050
public void testTopLevelPlanningFinalizesOnlyPlansThatReachDistribution() {
61-
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.NONE, false, false));
62-
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.NORMAL, false, false));
63-
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.VERBOSE, false, false));
64-
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.TREE, false, false));
65-
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.GRAPH, false, false));
66-
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.ALL_PLAN, false, false));
67-
Assertions.assertFalse(
68-
NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.DISTRIBUTED_PLAN, false, false));
69-
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.ALL_PLAN, true, false));
70-
Assertions.assertTrue(
71-
NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.DISTRIBUTED_PLAN, true, false));
72-
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.ALL_PLAN, false, true));
73-
Assertions.assertTrue(
74-
NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.DISTRIBUTED_PLAN, false, true));
75-
76-
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.PARSED_PLAN, true, true));
77-
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.ANALYZED_PLAN, true, true));
78-
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.REWRITTEN_PLAN, true, true));
79-
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.OPTIMIZED_PLAN, true, true));
80-
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.SHAPE_PLAN, true, true));
81-
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.MEMO_PLAN, true, true));
51+
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.NONE));
52+
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.NORMAL));
53+
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.VERBOSE));
54+
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.TREE));
55+
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.GRAPH));
56+
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.ALL_PLAN));
57+
Assertions.assertTrue(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.DISTRIBUTED_PLAN));
58+
59+
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.PARSED_PLAN));
60+
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.ANALYZED_PLAN));
61+
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.REWRITTEN_PLAN));
62+
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.OPTIMIZED_PLAN));
63+
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.SHAPE_PLAN));
64+
Assertions.assertFalse(NereidsPlanner.shouldFinalizePhysicalPlan(ExplainLevel.MEMO_PLAN));
8265
}
8366

8467
@Test

0 commit comments

Comments
 (0)