Skip to content

Commit

Permalink
[Refactor] Remove meaningless tag "execPlanBuildByNewPlanner" (StarRo…
Browse files Browse the repository at this point in the history
…cks#45353)

Signed-off-by: HangyuanLiu <[email protected]>
  • Loading branch information
HangyuanLiu authored May 10, 2024
1 parent 26f9599 commit 8f20fcb
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,8 @@ public void execute() throws Exception {
context.setExplainLevel(null);
}

// execPlan is the output of new planner
// execPlan is the output of planner
ExecPlan execPlan = null;
boolean execPlanBuildByNewPlanner = false;

try (Timer ignored = Tracers.watchScope("Total")) {
redirectStatus = parsedStmt.getRedirectStatus();
if (!isForwardToLeader()) {
Expand Down Expand Up @@ -525,7 +523,6 @@ public void execute() throws Exception {
context.getDumpInfo().setExplainInfo(execPlan.getExplainString(TExplainLevel.COSTS));
}
}
execPlanBuildByNewPlanner = true;
}
} catch (SemanticException e) {
dumpException(e);
Expand All @@ -535,7 +532,7 @@ public void execute() throws Exception {
if (e.getType().equals(ErrorType.USER_ERROR)) {
throw e;
} else {
LOG.warn("New planner error: " + originStmt.originStmt, e);
LOG.warn("Planner error: " + originStmt.originStmt, e);
throw e;
}
}
Expand Down Expand Up @@ -588,7 +585,6 @@ public void execute() throws Exception {
new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits()));
}

Preconditions.checkState(execPlanBuildByNewPlanner, "must use new planner");
handleQueryStmt(retryContext.getExecPlan());
break;
} catch (Exception e) {
Expand Down Expand Up @@ -640,11 +636,7 @@ public void execute() throws Exception {
} else if (parsedStmt instanceof SetCatalogStmt) {
handleSetCatalogStmt();
} else if (parsedStmt instanceof CreateTableAsSelectStmt) {
if (execPlanBuildByNewPlanner) {
handleCreateTableAsSelectStmt(beginTimeInNanoSecond);
} else {
throw new AnalysisException("old planner does not support CTAS statement");
}
handleCreateTableAsSelectStmt(beginTimeInNanoSecond);
} else if (parsedStmt instanceof DmlStmt) {
handleDMLStmtWithProfile(execPlan, (DmlStmt) parsedStmt);
} else if (parsedStmt instanceof DdlStmt) {
Expand Down Expand Up @@ -832,7 +824,7 @@ private void handleCreateTableAsSelectStmt(long beginTimeInNanoSecond) throws Ex
// and for other cases the exception will throw and the rest of the code will not be executed.
try {
InsertStmt insertStmt = createTableAsSelectStmt.getInsertStmt();
ExecPlan execPlan = new StatementPlanner().plan(insertStmt, context);
ExecPlan execPlan = StatementPlanner.plan(insertStmt, context);
handleDMLStmtWithProfile(execPlan, ((CreateTableAsSelectStmt) parsedStmt).getInsertStmt());
if (context.getState().getStateType() == MysqlStateType.ERR) {
dropTableCreatedByCTAS(createTableAsSelectStmt);
Expand Down Expand Up @@ -1235,10 +1227,10 @@ private void executeAnalyze(ConnectContext statsConnectCtx, AnalyzeStmt analyzeS
if (analyzeStmt.isExternal()) {
if (analyzeStmt.getAnalyzeTypeDesc().isHistogram()) {
statisticExecutor.collectStatistics(statsConnectCtx,
new ExternalHistogramStatisticsCollectJob(analyzeStmt.getTableName().getCatalog(),
db, table, analyzeStmt.getColumnNames(), analyzeStmt.getColumnTypes(),
StatsConstants.AnalyzeType.HISTOGRAM, StatsConstants.ScheduleType.ONCE,
analyzeStmt.getProperties()),
new ExternalHistogramStatisticsCollectJob(analyzeStmt.getTableName().getCatalog(),
db, table, analyzeStmt.getColumnNames(), analyzeStmt.getColumnTypes(),
StatsConstants.AnalyzeType.HISTOGRAM, StatsConstants.ScheduleType.ONCE,
analyzeStmt.getProperties()),
analyzeStatus,
false);
} else {
Expand Down

0 comments on commit 8f20fcb

Please sign in to comment.