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

panxiaolei 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 d474d4e701c [Bug](rollup) fallback and disable tulpe when rollup 
select failed on old planner (#29226)
d474d4e701c is described below

commit d474d4e701c366822e87fe21b0946f34a3111416
Author: Pxl <[email protected]>
AuthorDate: Tue Jan 2 17:54:56 2024 +0800

    [Bug](rollup) fallback and disable tulpe when rollup select failed on old 
planner (#29226)
    
    * fallback and disable tulpe when rollup select failed on old planner
    
    * add case
---
 .../apache/doris/planner/SingleNodePlanner.java    |  4 +-
 .../data/mv_p0/test_28741/test_28741.out           |  4 ++
 .../suites/mv_p0/test_28741/test_28741.groovy      | 72 ++++++++++++++++++++++
 3 files changed, 78 insertions(+), 2 deletions(-)

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 1ba48b0b9df..3de53090c9b 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
@@ -1363,18 +1363,18 @@ public class SingleNodePlanner {
                 if (olapScanNode.getSelectedPartitionIds().size() == 0 && 
!FeConstants.runningUnitTest) {
                     continue;
                 }
+                boolean tupleSelectFailed = false;
 
                 try {
                     // select index by the old Rollup selector
                     olapScanNode.selectBestRollupByRollupSelector(analyzer);
                 } catch (UserException e) {
-                    LOG.debug("May no rollup index matched");
+                    tupleSelectFailed = true;
                 }
 
                 // select index by the new Materialized selector
                 MaterializedViewSelector.BestIndexInfo bestIndexInfo = 
materializedViewSelector
                         .selectBestMV(olapScanNode);
-                boolean tupleSelectFailed = false;
                 if (bestIndexInfo == null) {
                     tupleSelectFailed = true;
                 } else {
diff --git a/regression-test/data/mv_p0/test_28741/test_28741.out 
b/regression-test/data/mv_p0/test_28741/test_28741.out
new file mode 100644
index 00000000000..18ef056f851
--- /dev/null
+++ b/regression-test/data/mv_p0/test_28741/test_28741.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !select --
+-
+
diff --git a/regression-test/suites/mv_p0/test_28741/test_28741.groovy 
b/regression-test/suites/mv_p0/test_28741/test_28741.groovy
new file mode 100644
index 00000000000..a6c2c878a91
--- /dev/null
+++ b/regression-test/suites/mv_p0/test_28741/test_28741.groovy
@@ -0,0 +1,72 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import org.codehaus.groovy.runtime.IOGroovyMethods
+
+suite ("test_28741") {
+
+    sql """ DROP TABLE IF EXISTS test; """
+
+    sql """
+            CREATE TABLE test (
+            a tinyint(4) NULL DEFAULT "0" ,
+            b int(11) DEFAULT "0" ,
+            c int(11) DEFAULT "0" ,
+            t DATETIMEV2 COMMENT "时间",
+            d bigint(20) SUM NULL DEFAULT "0",
+            e bigint(20) SUM NULL DEFAULT "0"
+            )
+            AGGREGATE KEY(a, b, c, t)
+            DISTRIBUTED BY HASH(a) BUCKETS AUTO
+            PROPERTIES
+            (
+            "replication_num" = "1"
+            );
+        """
+    createMV ("CREATE MATERIALIZED VIEW mv_test AS SELECT a,b,t,SUM(d) FROM 
test GROUP BY 1,2,3")
+
+    sql "INSERT INTO test(a,b,c,t,d,e) VALUES (1,2,3,'2023-12-19 18:21:00', 
56, 78)"
+
+    sql """
+    ALTER TABLE test ADD COLUMN a1 INT KEY AFTER a, ADD COLUMN b1 
VARCHAR(1024) KEY AFTER b, ADD COLUMN d1 BIGINT SUM AFTER d;
+    """
+
+    def getJobState = { tableName ->
+         def jobStateResult = sql """  SHOW ALTER TABLE COLUMN WHERE 
IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """
+         return jobStateResult[0][9]
+    }
+
+    int max_try_time = 100
+    while (max_try_time--){
+        String result = getJobState("test")
+        if (result == "FINISHED") {
+            sleep(1000)
+            break
+        } else {
+            sleep(1000)
+            assertTrue(max_try_time>1)
+        }
+    }
+
+    sql "INSERT INTO test(a,a1,b,b1,c,t,d,d1,e) VALUES 
(1,1,2,'-',3,'2023-12-20 17:21:00', 56, 78, 89)"
+
+    explain {
+        sql("select b1 from test where t >= '2023-12-20 17:21:00'")
+        contains "(test)"
+    }
+    qt_select "select b1 from test where t >= '2023-12-20 17:21:00'"
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to