Skip to content

Commit

Permalink
[fix](case) fix mow cluster key case (#43066)
Browse files Browse the repository at this point in the history
  • Loading branch information
mymeiyi authored and Your Name committed Nov 22, 2024
1 parent cd59bc3 commit b3f8c97
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,6 @@
-- !sql15 --
2 3 \N \N \N

-- !sql21 --
1 1 1 1 1

-- !sql22 --

-- !sql23 --
1 1 1 1 1 1

-- !sql24 --
1 2 \N \N \N

-- !sql31 --
1 2 \N \N \N
2 2 2 2 2

-- !sql32 --

-- !sql33 --

-- !sql34 --
1 2 \N \N \N
2 2 2 2 2

-- !sql35 --
2 3 \N \N \N

-- !sql1 --
1 1 1 1 1

Expand All @@ -77,29 +51,3 @@
-- !sql15 --
2 3 \N \N \N

-- !sql21 --
1 1 1 1 1

-- !sql22 --

-- !sql23 --
1 1 1 1 1 1

-- !sql24 --
1 2 \N \N \N

-- !sql31 --
1 2 \N \N \N
2 2 2 2 2

-- !sql32 --

-- !sql33 --

-- !sql34 --
1 2 \N \N \N
2 2 2 2 2

-- !sql35 --
2 3 \N \N \N

Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ suite('test_new_partial_update_delete') {
PROPERTIES (
"disable_auto_compaction" = "true",
"enable_unique_key_merge_on_write" = "false",
"enable_mow_light_delete" = "false",
"replication_num" = "1",
"store_row_column" = "${use_row_store}"); """
sql """alter table ${tableMorName2} set ("enable_mow_light_delete"="true")"""
Expand All @@ -86,6 +87,7 @@ suite('test_new_partial_update_delete') {
DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES (
"disable_auto_compaction" = "true",
"enable_mow_light_delete" = "false",
"replication_num" = "1",
"store_row_column" = "${use_row_store}"); """

Expand Down Expand Up @@ -139,120 +141,6 @@ suite('test_new_partial_update_delete') {
sql "set enable_insert_strict=true;"

sql "drop table if exists ${tableName1};"



// old planner
try {
def tableMorName3 = "test_new_partial_update_mor_delete3"
sql "DROP TABLE IF EXISTS ${tableMorName3};"
sql """ CREATE TABLE IF NOT EXISTS ${tableMorName3} (
`k1` int NOT NULL,
`c1` int,
`c2` int,
`c3` int,
`c4` int
)UNIQUE KEY(k1)
DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES (
"disable_auto_compaction" = "true",
"enable_unique_key_merge_on_write" = "false",
"enable_mow_light_delete" = "true",
"replication_num" = "1",
"store_row_column" = "${use_row_store}"); """
} catch (Exception e) {
log.info(e.getMessage())
assertTrue(e.getMessage().contains('enable_mow_light_delete property is only supported for unique merge-on-write table'))
}

try {
def tableMorName4 = "test_new_partial_update_mor_delete4"
sql "DROP TABLE IF EXISTS ${tableMorName4};"
sql """ CREATE TABLE IF NOT EXISTS ${tableMorName4} (
`k1` int NOT NULL,
`c1` int,
`c2` int,
`c3` int,
`c4` int
)UNIQUE KEY(k1)
DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES (
"disable_auto_compaction" = "true",
"enable_unique_key_merge_on_write" = "false",
"replication_num" = "1",
"store_row_column" = "${use_row_store}"); """
sql """alter table ${tableMorName4} set ("enable_mow_light_delete"="true")"""
} catch (Exception e) {
log.info(e.getMessage())
assertTrue(e.getMessage().contains('enable_mow_light_delete property is only supported for unique merge-on-write table'))
}
sql "set enable_nereids_planner=false"
def tableName2 = "test_new_partial_update_delete2"
sql "DROP TABLE IF EXISTS ${tableName2};"
sql """ CREATE TABLE IF NOT EXISTS ${tableName2} (
`k1` int NOT NULL,
`c1` int,
`c2` int,
`c3` int,
`c4` int
)UNIQUE KEY(k1)
CLUSTER BY(c3, c2, c4)
DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES (
"disable_auto_compaction" = "true",
"replication_num" = "1",
"store_row_column" = "${use_row_store}"); """

def output3 = sql "show create table ${tableName2}"
assertTrue output3[0][1].contains("\"enable_mow_light_delete\" = \"false\"");
sql "insert into ${tableName2} values(1,1,1,1,1)"
// 1,1,1,1,1
qt_sql21 "select * from ${tableName2} order by k1;"
sql "delete from ${tableName2} where k1 = 1"
// empty
qt_sql22 "select * from ${tableName2} order by k1;"
sql "set show_hidden_columns = true;"
// 1,null,null,null,1
qt_sql23 "select k1,c1,c2,c3,c4,__DORIS_DELETE_SIGN__ from ${tableName2} order by k1;"
sql "set show_hidden_columns = false;"
sql "set enable_unique_key_partial_update=true;"
sql "set enable_insert_strict=false;"
sql "insert into ${tableName2} (k1,c1) values(1,2)"
// 1,2,NULL,NULL,NULL
qt_sql24 "select * from ${tableName2} order by k1;"



sql """alter table ${tableName2} set ("enable_mow_light_delete"="true") """
sql "set enable_unique_key_partial_update=false;"
sql "set enable_insert_strict=true;"
def output4 = sql "show create table ${tableName2}"
assertTrue output4[0][1].contains("\"enable_mow_light_delete\" = \"true\"");
sql "insert into ${tableName2} values(2,2,2,2,2)"
// 1,2,NULL,NULL,NULL
// 2,2,2,2,2
qt_sql31 "select * from ${tableName2} order by k1;"
sql "delete from ${tableName2} where k1 <= 2"
// empty
qt_sql32 "select * from ${tableName2} order by k1;"
sql "set show_hidden_columns = true;"
// empty
qt_sql33 "select * from ${tableName2} order by k1;"
sql "set show_hidden_columns = false;"
sql "set skip_delete_predicate = true;"
// 1,2,NULL,NULL,NULL
// 2,2,2,2,2
qt_sql34 "select * from ${tableName2} order by k1;"
sql "set skip_delete_predicate = false;"
sql "set enable_unique_key_partial_update=true;"
sql "set enable_insert_strict=false;"
sql "insert into ${tableName2} (k1,c1) values(2,3)"
// 2,3,2,2,2
qt_sql35 "select * from ${tableName2} order by k1;"
sql "set enable_unique_key_partial_update=false;"
sql "set enable_insert_strict=true;"

sql "drop table if exists ${tableName2};"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ suite('test_partial_update_delete') {
PROPERTIES (
"enable_unique_key_merge_on_write" = "true",
"disable_auto_compaction" = "true",
"enable_mow_light_delete" = "false",
"replication_num" = "1",
"store_row_column" = "${use_row_store}"); """

Expand All @@ -52,6 +53,7 @@ suite('test_partial_update_delete') {
PROPERTIES (
"enable_unique_key_merge_on_write" = "true",
"disable_auto_compaction" = "true",
"enable_mow_light_delete" = "false",
"replication_num" = "1",
"store_row_column" = "${use_row_store}"); """

Expand Down Expand Up @@ -88,20 +90,19 @@ suite('test_partial_update_delete') {
PROPERTIES (
"enable_unique_key_merge_on_write" = "true",
"disable_auto_compaction" = "true",
"enable_mow_light_delete" = "false",
"replication_num" = "1",
"store_row_column" = "${use_row_store}"); """

sql "insert into ${tableName3} values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5);"
qt_sql "select k1,c1,c2,c3,c4 from ${tableName3} order by k1,c1,c2,c3,c4;"
streamLoad {
table "${tableName3}"

set 'column_separator', ','
set 'format', 'csv'
set 'columns', 'k1'
set 'partial_columns', 'true'
set 'merge_type', 'DELETE'

file 'partial_update_delete.csv'
time 10000

Expand Down

0 comments on commit b3f8c97

Please sign in to comment.