This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 33220109f7e [Bug](materialized-view) fix analyze where clause failed
on mv (#39061) (#39209)
33220109f7e is described below
commit 33220109f7e44612e4a4167a22279f2395d3021f
Author: Pxl <[email protected]>
AuthorDate: Tue Aug 13 16:08:20 2024 +0800
[Bug](materialized-view) fix analyze where clause failed on mv (#39061)
(#39209)
## Proposed changes
pick from #39061
fix analyze where clause failed on mv
do not analyze slot after replaceSlot to avoid duplicate columns in desc
---
.../java/org/apache/doris/analysis/SlotRef.java | 5 ++
.../data/mv_p0/routine_load_mapping/test2 | 0
.../routine_load_mapping.groovy | 64 ++++++++++++++++++++++
3 files changed, 69 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 4cd58f23650..92f5224e0bc 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
@@ -694,6 +694,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..491282f7c85 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,68 @@ 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",
+"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",
+"inverted_index_storage_format" = "V2",
+"light_schema_change" = "true",
+"disable_auto_compaction" = "false",
+"enable_single_replica_compaction" = "false",
+"group_commit_interval_ms" = "10000",
+"group_commit_data_bytes" = "134217728"
+);
+ """
+
+ 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: [email protected]
For additional commands, e-mail: [email protected]