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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 68093350d58 revert [improvement](mv) Support to use cast when create 
sync materialized view #38008 (#39338)
68093350d58 is described below

commit 68093350d5848adea9d4d91146cff3db28519e4d
Author: seawinde <daydayup...@yeah.net>
AuthorDate: Wed Aug 14 14:37:34 2024 +0800

    revert [improvement](mv) Support to use cast when create sync materialized 
view #38008 (#39338)
    
    Please enter the commit message for your changes. Lines starting
---
 .../doris/analysis/CreateMaterializedViewStmt.java |   5 +-
 .../data/mv_p0/contain_cast/mv_contains_cast.out   |  11 --
 .../mv_p0/contain_cast/mv_contains_cast.groovy     | 128 ---------------------
 3 files changed, 2 insertions(+), 142 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
index 3a6a9718c72..575397d9f39 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
@@ -273,9 +273,8 @@ public class CreateMaterializedViewStmt extends DdlStmt {
 
             Expr selectListItemExpr = selectListItem.getExpr();
             selectListItemExpr.setDisableTableName(true);
-            Expr realItem = selectListItemExpr.unwrapExpr(false);
-            if (!(realItem instanceof SlotRef) && !(realItem instanceof 
FunctionCallExpr)
-                    && !(realItem instanceof ArithmeticExpr)) {
+            if (!(selectListItemExpr instanceof SlotRef) && 
!(selectListItemExpr instanceof FunctionCallExpr)
+                    && !(selectListItemExpr instanceof ArithmeticExpr)) {
                 throw new AnalysisException("The materialized view only 
support the single column or function expr. "
                         + "Error column: " + selectListItemExpr.toSql());
             }
diff --git a/regression-test/data/mv_p0/contain_cast/mv_contains_cast.out 
b/regression-test/data/mv_p0/contain_cast/mv_contains_cast.out
deleted file mode 100644
index 1d7f84992de..00000000000
--- a/regression-test/data/mv_p0/contain_cast/mv_contains_cast.out
+++ /dev/null
@@ -1,11 +0,0 @@
--- This file is automatically generated. You should know what you did if you 
want to edit this
--- !query_before --
-cc     2024-07-0300000:00      1
-cc     2024-07-0300015:00      1
-cd     2024-07-0300000:00      1
-
--- !query_after --
-cc     2024-07-0300000:00      1
-cc     2024-07-0300015:00      1
-cd     2024-07-0300000:00      1
-
diff --git a/regression-test/suites/mv_p0/contain_cast/mv_contains_cast.groovy 
b/regression-test/suites/mv_p0/contain_cast/mv_contains_cast.groovy
deleted file mode 100644
index 7e6bb32d970..00000000000
--- a/regression-test/suites/mv_p0/contain_cast/mv_contains_cast.groovy
+++ /dev/null
@@ -1,128 +0,0 @@
-// 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.
-
-suite("mv_contains_cast") {
-    String db = context.config.getDbNameByFile(context.file)
-    sql "use ${db}"
-    sql "set runtime_filter_mode=OFF";
-    sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'"
-
-    sql """
-    drop table if exists test;
-    """
-
-    sql """
-        CREATE TABLE IF NOT EXISTS test (
-        `app_name` VARCHAR(64) NULL COMMENT '标识', 
-        `event_id` VARCHAR(128) NULL COMMENT '标识', 
-        `decision` VARCHAR(32) NULL COMMENT '枚举值', 
-        `time` DATETIME NULL COMMENT '查询时间', 
-        `id` VARCHAR(35) NOT NULL COMMENT 'od', 
-        `code` VARCHAR(64) NULL COMMENT '标识', 
-        `event_type` VARCHAR(32) NULL COMMENT '事件类型' 
-        )
-        DUPLICATE KEY(app_name, event_id)
-        PARTITION BY RANGE(time)                                               
                                                                                
                                                                                
 
-        (                                                                      
                                                                                
                                                                                
-         FROM ("2024-07-01 00:00:00") TO ("2024-07-15 00:00:00") INTERVAL 1 
HOUR                                                                            
                                                                                
                  
-        )     
-        DISTRIBUTED BY HASH(event_id)
-        BUCKETS 3 PROPERTIES ("replication_num" = "1");
-    """
-
-    sql """
-    insert into test values
-    ('aa', 'bc', 'cc', '2024-07-03 01:15:30', 'dd', 'ee', 'ff'),
-    ('as', 'bd', 'cd', '2024-07-03 06:09:30', 'dd', 'ee', 'ff'),
-    ('ad', 'be', 'cc', '2024-07-03 07:06:30', 'dd', 'ee', 'ff'),
-    ('af', 'bf', 'ce', '2024-07-04 10:01:30', 'dd', 'ee', 'ff'),
-    ('ag', 'bc', 'cc', '2024-07-04 12:55:30', 'dd', 'ee', 'ff'),
-    ('aa', 'bc', 'cc', '2024-07-05 01:15:30', 'dd', 'ee', 'ff'),
-    ('as', 'bd', 'cd', '2024-07-05 06:09:30', 'dd', 'ee', 'ff'),
-    ('ad', 'be', 'cc', '2024-07-06 07:06:30', 'dd', 'ee', 'ff'),
-    ('af', 'bf', 'ce', '2024-07-07 10:01:30', 'dd', 'ee', 'ff'),
-    ('ag', 'bc', 'cc', '2024-07-08 12:55:30', 'dd', 'ee', 'ff');
-    """
-
-    def query_sql = """
-    SELECT 
-    decision, 
-    CONCAT(
-        CONCAT(
-          DATE_FORMAT(
-            `time`, '%Y-%m-%d'
-          ), 
-          '', 
-          LPAD(
-            cast(FLOOR(MINUTE(`time`) / 15) as decimal(9, 0)) * 15, 
-            5, 
-            '00'
-          ), 
-          ':00'
-        )
-      ) as time, 
-      count(id) as cnt 
-    from 
-      test 
-    where 
-    date_trunc(time, 'minute') BETWEEN '2024-07-02 18:00:00' 
-      AND '2024-07-03 20:00:00' 
-    group by 
-      decision, 
-      DATE_FORMAT(
-        `time`, "%Y-%m-%d"
-      ), 
-      cast(FLOOR(MINUTE(`time`) / 15) as decimal(9, 0));
-    """
-
-    order_qt_query_before "${query_sql}"
-
-    createMV("""
-    CREATE MATERIALIZED VIEW sync_mv
-    AS
-    SELECT 
-      decision,
-      code, 
-      app_name, 
-      event_id, 
-      event_type, 
-      date_trunc(time, 'minute'), 
-      DATE_FORMAT(
-        `time`, '%Y-%m-%d'
-      ), 
-      cast(FLOOR(MINUTE(time) / 15) as decimal(9, 0)),
-      count(id) as cnt
-    from 
-      test 
-    group by 
-      code, 
-      app_name, 
-      event_id, 
-      event_type, 
-      date_trunc(time, 'minute'), 
-      decision, 
-      DATE_FORMAT(time, '%Y-%m-%d'), 
-      cast(FLOOR(MINUTE(`time`) / 15) as decimal(9, 0));
-    """)
-
-    explain {
-        sql("""${query_sql}""")
-        contains "(sync_mv)"
-    }
-
-    order_qt_query_after "${query_sql}"
-}


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

Reply via email to