Skip to content

Commit

Permalink
[test](regression) add non light schema change cases when enable memt…
Browse files Browse the repository at this point in the history
…able on sink node
  • Loading branch information
kaijchen committed Mar 6, 2024
1 parent 73d1fdc commit 3458156
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
12 changes: 12 additions & 0 deletions regression-test/data/load_p0/insert/test_insert_move_memtable.out
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 3458156

Please sign in to comment.