[fix](planner) move join reorder to the single node planner (#15817)
Reorder in analyze phase would produce a stmt which its corresponding SQL could not be analyzed correctly and cause an analyze exception that may be happened in the stmt rewrite, since the rewriter will reset and reanalyze the rewritten stmt.
This commit is contained in:
@ -598,10 +598,6 @@ public class SelectStmt extends QueryStmt {
|
||||
if (needToSql) {
|
||||
sqlString = toSql();
|
||||
}
|
||||
if (analyzer.enableStarJoinReorder()) {
|
||||
LOG.debug("use old reorder logical in select stmt");
|
||||
reorderTable(analyzer);
|
||||
}
|
||||
|
||||
resolveInlineViewRefs(analyzer);
|
||||
|
||||
@ -793,7 +789,7 @@ public class SelectStmt extends QueryStmt {
|
||||
}
|
||||
}
|
||||
|
||||
protected void reorderTable(Analyzer analyzer) throws AnalysisException {
|
||||
public void reorderTable(Analyzer analyzer) throws AnalysisException {
|
||||
List<Pair<TableRef, Long>> candidates = Lists.newArrayList();
|
||||
ArrayList<TableRef> originOrderBackUp = Lists.newArrayList(fromClause.getTableRefs());
|
||||
// New pair of table ref and row count
|
||||
|
||||
@ -1116,6 +1116,11 @@ public class SingleNodePlanner {
|
||||
return createConstantSelectPlan(selectStmt, analyzer);
|
||||
}
|
||||
|
||||
if (analyzer.enableStarJoinReorder()) {
|
||||
LOG.debug("use old reorder logical in select stmt");
|
||||
selectStmt.reorderTable(analyzer);
|
||||
}
|
||||
|
||||
// Slot materialization:
|
||||
// We need to mark all slots as materialized that are needed during the execution
|
||||
// of selectStmt, and we need to do that prior to creating plans for the TableRefs
|
||||
|
||||
@ -67,23 +67,17 @@ public class AnalysisTaskExecutorTest extends TestWithFeService {
|
||||
.build();
|
||||
OlapAnalysisTask analysisJob = new OlapAnalysisTask(analysisTaskScheduler, analysisJobInfo);
|
||||
|
||||
new Expectations() {
|
||||
{
|
||||
analysisTaskScheduler.getPendingTasks();
|
||||
result = analysisJob;
|
||||
new MockUp<AnalysisTaskScheduler>() {
|
||||
public synchronized BaseAnalysisTask getPendingTasks() {
|
||||
return analysisJob;
|
||||
}
|
||||
};
|
||||
|
||||
AnalysisTaskExecutor analysisTaskExecutor = new AnalysisTaskExecutor(analysisTaskScheduler);
|
||||
BlockingQueue<AnalysisTaskWrapper> b = Deencapsulation.getField(analysisTaskExecutor, "jobQueue");
|
||||
AnalysisTaskWrapper analysisTaskWrapper = new AnalysisTaskWrapper(analysisTaskExecutor, analysisJob);
|
||||
Deencapsulation.setField(analysisTaskWrapper, "startTime", 5);
|
||||
b.put(analysisTaskWrapper);
|
||||
new Expectations() {
|
||||
{
|
||||
analysisTaskWrapper.cancel();
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
analysisTaskExecutor.start();
|
||||
BlockingCounter counter = Deencapsulation.getField(analysisTaskExecutor, "blockingCounter");
|
||||
int sleepTime = 500;
|
||||
|
||||
Reference in New Issue
Block a user