Skip to content

Commit

Permalink
fixut
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Sep 12, 2024
1 parent 12fd243 commit 1e008b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,14 @@ private Plan planWithoutLock(
}
}

if (!FeConstants.runningUnitTest && !cascadesContext.isLeadingDisableJoinReorder()) {
List<LogicalOlapScan> scans = getAllOlapScans(cascadesContext.getRewritePlan());
// if we cannot get table row count, skip join reorder
// except:
// 1. user set leading hint
// 2. ut test. In ut test, FeConstants.enableInternalSchemaDb is false or FeConstants.runningUnitTest is true
if ((FeConstants.enableInternalSchemaDb || !FeConstants.runningUnitTest)
&& !cascadesContext.isLeadingDisableJoinReorder()) {
List<LogicalOlapScan> scans = cascadesContext.getRewritePlan()
.collectToList(LogicalOlapScan.class::isInstance);
StatsCalculator.disableJoinReorderIfTableRowCountNotAvailable(scans, cascadesContext);
}

Expand Down Expand Up @@ -296,18 +302,6 @@ private Plan planWithoutLock(
return physicalPlan;
}

private List<LogicalOlapScan> getAllOlapScans(Plan plan) {
List<LogicalOlapScan> scans = Lists.newArrayList();
if (plan instanceof LogicalOlapScan) {
scans.add((LogicalOlapScan) plan);
} else {
for (Plan child : plan.children()) {
scans.addAll(getAllOlapScans(child));
}
}
return scans;
}

private LogicalPlan preprocess(LogicalPlan logicalPlan) {
return new PlanPreprocessors(statementContext).process(logicalPlan);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ public Set<Integer> getEnableNereidsRules() {
@BeforeAll
public final void beforeAll() throws Exception {
FeConstants.enableInternalSchemaDb = false;
FeConstants.runningUnitTest = true;
beforeCreatingConnectContext();
connectContext = createDefaultCtx();
beforeCluster();
Expand Down

0 comments on commit 1e008b6

Please sign in to comment.