You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/01/13 11:42:20 UTC

[doris] branch master updated: [fix](planner) move join reorder to the single node planner (#15817)

This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new bd2280b4ce [fix](planner) move join reorder to the single node planner (#15817)
bd2280b4ce is described below

commit bd2280b4ce702e24cc31ca1d379aeaf6f00ce69c
Author: AKIRA <33...@users.noreply.github.com>
AuthorDate: Fri Jan 13 19:42:12 2023 +0800

    [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.
---
 .../main/java/org/apache/doris/analysis/SelectStmt.java    |  6 +-----
 .../java/org/apache/doris/planner/SingleNodePlanner.java   |  5 +++++
 .../apache/doris/statistics/AnalysisTaskExecutorTest.java  | 14 ++++----------
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
index d29f366557..f4915a4e58 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
@@ -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
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
index 718cafd980..129c1691cf 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
@@ -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
diff --git a/fe/fe-core/src/test/java/org/apache/doris/statistics/AnalysisTaskExecutorTest.java b/fe/fe-core/src/test/java/org/apache/doris/statistics/AnalysisTaskExecutorTest.java
index 6d7b3b4e43..ba75d26cec 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/statistics/AnalysisTaskExecutorTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/statistics/AnalysisTaskExecutorTest.java
@@ -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;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org