You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2024/09/08 08:51:26 UTC

(doris) branch branch-2.0 updated: [Bug](materialized-view) fix analyze where clause failed on mv #39061 (#40501)

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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new d7aa3360045 [Bug](materialized-view) fix analyze where clause failed on mv #39061 (#40501)
d7aa3360045 is described below

commit d7aa3360045d69f0094146fdbd0aadcdc1e5fcf3
Author: Kang <kx...@gmail.com>
AuthorDate: Sun Sep 8 16:51:17 2024 +0800

    [Bug](materialized-view) fix analyze where clause failed on mv #39061 (#40501)
    
    Co-authored-by: Pxl <px...@qq.com>
---
 .../java/org/apache/doris/analysis/SlotRef.java    |  5 ++
 .../data/mv_p0/routine_load_mapping/test2          |  0
 .../routine_load_mapping.groovy                    | 62 ++++++++++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java
index 7275572c5b4..b2eb0f10212 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java
@@ -650,6 +650,11 @@ public class SlotRef extends Expr {
 
     @Override
     public void replaceSlot(TupleDescriptor tuple) {
+        // do not analyze slot after replaceSlot to avoid duplicate columns in desc
         desc = tuple.getColumnSlot(col);
+        type = desc.getType();
+        if (!isAnalyzed) {
+            analysisDone();
+        }
     }
 }
diff --git a/regression-test/data/mv_p0/routine_load_mapping/test2 b/regression-test/data/mv_p0/routine_load_mapping/test2
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/regression-test/suites/mv_p0/routine_load_mapping/routine_load_mapping.groovy b/regression-test/suites/mv_p0/routine_load_mapping/routine_load_mapping.groovy
index 1188e3031c0..e7d04317c67 100644
--- a/regression-test/suites/mv_p0/routine_load_mapping/routine_load_mapping.groovy
+++ b/regression-test/suites/mv_p0/routine_load_mapping/routine_load_mapping.groovy
@@ -49,4 +49,66 @@ suite ("routine_load_mapping") {
 
     qt_select "select * from test order by 1,2,3;"
     qt_select_mv "select * from test index m_view order by 1,2;"
+
+
+     sql """ DROP TABLE IF EXISTS rt_new; """
+
+      sql """
+        CREATE TABLE `rt_new` (
+  `battery_id` VARCHAR(50) NULL ,
+  `create_time` DATETIME(3) NULL ,
+  `imei` VARCHAR(50) NULL ,
+  `event_id` VARCHAR(50) NULL ,
+  `event_name` VARCHAR(50) NULL,
+  `heart_type` INT NULL
+) ENGINE=OLAP
+DUPLICATE KEY(`battery_id`, `create_time`)
+PARTITION BY RANGE(`create_time`)
+(PARTITION p20240421 VALUES [('2024-04-21 00:00:00'), ('2024-04-22 00:00:00')),
+PARTITION p20240422 VALUES [('2024-04-22 00:00:00'), ('2024-04-23 00:00:00')),
+PARTITION p20240804 VALUES [('2024-08-04 00:00:00'), ('2024-08-05 00:00:00')))
+DISTRIBUTED BY HASH(`battery_id`) BUCKETS AUTO
+PROPERTIES (
+"replication_allocation" = "tag.location.default: 1",
+"is_being_synced" = "false",
+"dynamic_partition.enable" = "true",
+"dynamic_partition.time_unit" = "DAY",
+"dynamic_partition.time_zone" = "Asia/Shanghai",
+"dynamic_partition.start" = "-2147483648",
+"dynamic_partition.end" = "3",
+"dynamic_partition.prefix" = "p",
+"dynamic_partition.buckets" = "10",
+"dynamic_partition.create_history_partition" = "true",
+"dynamic_partition.history_partition_num" = "100",
+"dynamic_partition.hot_partition_num" = "0",
+"dynamic_partition.reserved_history_periods" = "NULL",
+"storage_medium" = "hdd",
+"storage_format" = "V2",
+"light_schema_change" = "true",
+"disable_auto_compaction" = "false",
+"enable_single_replica_compaction" = "false"
+);
+        """
+
+         createMV("""CREATE MATERIALIZED VIEW location_rt_mv AS
+        SELECT
+        battery_id,
+        create_time
+        FROM
+        rt_new
+        WHERE
+        heart_type = 1
+        ;""")
+
+    sql """ ALTER TABLE rt_new MODIFY COLUMN event_id VARCHAR(51) NULL;"""
+    Thread.sleep(1000)
+
+    streamLoad {
+        table "rt_new"
+        set 'column_separator', ','
+        set 'columns', '`battery_id`,`create_time`,`imei`,`event_id`,`event_name`,`heart_type`'
+
+        file './test2'
+        time 10000 // limit inflight 10s
+    }
 }


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