From 5c9f68fdc89eccfc90603a641956bf0e6f4396b5 Mon Sep 17 00:00:00 2001 From: Kaijie Chen Date: Tue, 23 Apr 2024 22:19:07 +0800 Subject: [PATCH] [test](regression) add non light schema change cases when enable memtable on sink node (#31851) --- .../insert/test_insert_move_memtable.out | 12 +++++ .../test_stream_load_move_memtable.out | 4 ++ .../insert/test_insert_move_memtable.groovy | 30 +++++++++++ .../test_stream_load_move_memtable.groovy | 51 +++++++++++++++++++ 4 files changed, 97 insertions(+) diff --git a/regression-test/data/load_p0/insert/test_insert_move_memtable.out b/regression-test/data/load_p0/insert/test_insert_move_memtable.out index dcb5b854a747ad..0ff345a2459d45 100644 --- a/regression-test/data/load_p0/insert/test_insert_move_memtable.out +++ b/regression-test/data/load_p0/insert/test_insert_move_memtable.out @@ -11,6 +11,18 @@ true 3021 10 15 true 25699 6 21 true 2147483647 3 24 +-- !sql2 -- +false -2147483647 7 7 +false 103 9 16 +false 1002 2 18 +false 5014 5 23 +false 2147483647 8 31 +true -2147483647 4 4 +true 3021 1 15 +true 3021 10 15 +true 25699 6 21 +true 2147483647 3 24 + -- !select -- true 10 10000 10000000 92233720368547758 19223372036854775807 3.14159 hello world, today is 15/06/2023 2023-06-15 2023-06-15T16:10:15 true 10 10000 10000000 92233720368547758 19223372036854775807 3.14159 hello world, today is 15/06/2023 2023-06-15 2023-06-15T16:10:15 diff --git a/regression-test/data/load_p0/stream_load/test_stream_load_move_memtable.out b/regression-test/data/load_p0/stream_load/test_stream_load_move_memtable.out index 1e96cbfaca7a96..7c5b91c3214f56 100644 --- a/regression-test/data/load_p0/stream_load/test_stream_load_move_memtable.out +++ b/regression-test/data/load_p0/stream_load/test_stream_load_move_memtable.out @@ -3,6 +3,10 @@ -2 -51 \N 1 \N \N \N \N \N \N \N 2 \N \N -2 -50 \N 1 \N \N \N \N \N \N \N \N j \N +-- !sql2 -- +-2 -51 \N 1 \N \N \N \N \N \N \N 2 \N \N +-2 -50 \N 1 \N \N \N \N \N \N \N \N j \N + -- !sql1 -- 2019 9 9 9 7.700 a 2019-09-09 1970-01-01T08:33:39 k7 9.0 9.0 diff --git a/regression-test/suites/load_p0/insert/test_insert_move_memtable.groovy b/regression-test/suites/load_p0/insert/test_insert_move_memtable.groovy index 189db974fbfa2a..036a975cc9c3ad 100644 --- a/regression-test/suites/load_p0/insert/test_insert_move_memtable.groovy +++ b/regression-test/suites/load_p0/insert/test_insert_move_memtable.groovy @@ -51,6 +51,36 @@ suite("test_insert_move_memtable") { qt_sql1 "select * from ${insert_tbl} order by 1, 2, 3, 4" + def insert_tbl2 = "test_insert_tbl_no_light_schema_change"; + + sql """ DROP TABLE IF EXISTS ${insert_tbl2}""" + sql """ + CREATE TABLE ${insert_tbl2} ( + `k1` char(5) NULL, + `k2` int(11) NULL, + `k3` tinyint(4) NULL, + `k4` int(11) NULL + ) ENGINE=OLAP + DUPLICATE KEY(`k1`, `k2`, `k3`, `k4`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`k1`) BUCKETS 5 + PROPERTIES ( + "replication_num"="1", + "light_schema_change" = "false" + ); + """ + + sql """ + INSERT INTO ${insert_tbl2} + SELECT a.k6, a.k3, b.k1 + , sum(b.k1) OVER (PARTITION BY a.k6 ORDER BY a.k3) AS w_sum + FROM ${test_baseall} a + JOIN ${test_bigtable} b ON a.k1 = b.k1 + 5 + ORDER BY a.k6, a.k3, a.k1, w_sum + """ + + qt_sql2 "select * from ${insert_tbl2} order by 1, 2, 3, 4" + def insert_tbl_dft = "test_insert_dft_tbl_mm" sql """ DROP TABLE IF EXISTS ${insert_tbl_dft}""" diff --git a/regression-test/suites/load_p0/stream_load/test_stream_load_move_memtable.groovy b/regression-test/suites/load_p0/stream_load/test_stream_load_move_memtable.groovy index 3696bfea550e87..ca0256d49af8b0 100644 --- a/regression-test/suites/load_p0/stream_load/test_stream_load_move_memtable.groovy +++ b/regression-test/suites/load_p0/stream_load/test_stream_load_move_memtable.groovy @@ -68,6 +68,57 @@ suite("test_stream_load_move_memtable", "p0") { sql "sync" qt_sql "select * from ${tableName} order by k1, k2" + def tableNameNoLSC = "test_stream_load_strict_mm_no_lsc" + + sql """ DROP TABLE IF EXISTS ${tableNameNoLSC} """ + sql """ + CREATE TABLE IF NOT EXISTS ${tableNameNoLSC} ( + `k1` bigint(20) NULL, + `k2` bigint(20) NULL, + `v1` tinyint(4) SUM NULL, + `v2` tinyint(4) REPLACE NULL, + `v3` tinyint(4) REPLACE_IF_NOT_NULL NULL, + `v4` smallint(6) REPLACE_IF_NOT_NULL NULL, + `v5` int(11) REPLACE_IF_NOT_NULL NULL, + `v6` bigint(20) REPLACE_IF_NOT_NULL NULL, + `v7` largeint(40) REPLACE_IF_NOT_NULL NULL, + `v8` datetime REPLACE_IF_NOT_NULL NULL, + `v9` date REPLACE_IF_NOT_NULL NULL, + `v10` char(10) REPLACE_IF_NOT_NULL NULL, + `v11` varchar(6) REPLACE_IF_NOT_NULL NULL, + `v12` decimal(27, 9) REPLACE_IF_NOT_NULL NULL + ) ENGINE=OLAP + AGGREGATE KEY(`k1`, `k2`) + COMMENT 'OLAP' + PARTITION BY RANGE(`k1`) + (PARTITION partition_a VALUES [("-9223372036854775808"), ("100000")), + PARTITION partition_b VALUES [("100000"), ("1000000000")), + PARTITION partition_c VALUES [("1000000000"), ("10000000000")), + PARTITION partition_d VALUES [("10000000000"), (MAXVALUE))) + DISTRIBUTED BY HASH(`k1`, `k2`) BUCKETS 3 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "light_schema_change" = "false" + ); + """ + + // test strict_mode success + streamLoad { + table "${tableNameNoLSC}" + + set 'column_separator', '\t' + set 'columns', 'k1, k2, v2, v10, v11' + set 'partitions', 'partition_a, partition_b, partition_c, partition_d' + set 'strict_mode', 'true' + set 'memtable_on_sink_node', 'true' + + file 'test_strict_mode.csv' + time 10000 // limit inflight 10s + } + + sql "sync" + qt_sql2 "select * from ${tableNameNoLSC} order by k1, k2" + // test strict_mode fail streamLoad { table "${tableName}"