Skip to content

Commit

Permalink
add upgrade case
Browse files Browse the repository at this point in the history
  • Loading branch information
bobhan1 committed Oct 24, 2024
1 parent fffdca6 commit c2a02db
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 0 deletions.
117 changes: 117 additions & 0 deletions regression-test/data/unique_with_mow_p0/flexible/upgrade/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
0 0 0 0 0 0
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4
5 5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9

-- !sql --
0 0 0 0 0 0
1 10 111 111 1 1 4,5,6
2 2 20 2 222 25 1,3,6
3 3 3 30 3 3 1,2,4,5,6
4 43 4 99 20 4 2,5,6
5 5 5 5 5 \N 1,2,3,4,6
6 999 6 777 6 6 2,4,5,6
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9

-- !sql --
0 0 0 0 0 0
1 999 111 999 1 999
2 888 20 888 222 888
3 3 3 30 3 3
4 43 4 99 20 4
5 777 5 777 5 777
6 999 6 777 6 6
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9
20 555 9876 555 1234 555

-- !sql --
0 0 0 0 0 0
1 999 111 999 1 999
2 888 20 888 222 888
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9
20 555 9876 555 1234 555

-- !sql --
0 0 0 0 0 0
1 999 111 999 1 999
2 888 20 888 222 888
3 10 10 10 10 10
4 12 12 12 12 12
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9
20 555 9876 555 1234 555
30 11 11 11 11 11

-- !sql --
0 0 0 0 0 0
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4
5 5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9

-- !sql --
0 0 0 0 0 0
1 10 111 111 1 1 4,5,6
2 2 20 2 222 25 1,3,6
3 3 3 30 3 3 1,2,4,5,6
4 43 4 99 20 4 2,5,6
5 5 5 5 5 \N 1,2,3,4,6
6 999 6 777 6 6 2,4,5,6
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9

-- !sql --
0 0 0 0 0 0
1 999 111 999 1 999
2 888 20 888 222 888
3 3 3 30 3 3
4 43 4 99 20 4
5 777 5 777 5 777
6 999 6 777 6 6
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9
20 555 9876 555 1234 555

-- !sql --
0 0 0 0 0 0
1 999 111 999 1 999
2 888 20 888 222 888
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9
20 555 9876 555 1234 555

-- !sql --
0 0 0 0 0 0
1 999 111 999 1 999
2 888 20 888 222 888
3 10 10 10 10 10
4 12 12 12 12 12
7 7 7 7 7 7
8 8 8 8 8 8
9 9 9 9 9 9
20 555 9876 555 1234 555
30 11 11 11 11 11

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{"k": 1, "v1": 10}
{"k": 2, "v2": 20, "v5": 25}
{"k": 3, "v3": 30}
{"k": 4, "v4": 20, "v1": 43, "v3": 99}
{"k": 5, "v5": null}
{"k": 6, "v1": 999, "v3": 777}
{"k": 2, "v4": 222}
{"k": 1, "v2": 111, "v3": 111}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

suite('test_flexible_partial_update_upgrade_base_data', 'p0,restart_fe') {
for (def use_row_store : [false, true]) {
logger.info("current params: use_row_store: ${use_row_store}")
def tableName = "test_f_upgrade_${use_row_store}"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """ CREATE TABLE ${tableName} (
`k` int(11) NULL,
`v1` BIGINT NULL,
`v2` BIGINT NULL DEFAULT "9876",
`v3` BIGINT NOT NULL,
`v4` BIGINT NOT NULL DEFAULT "1234",
`v5` BIGINT NULL
) UNIQUE KEY(`k`) DISTRIBUTED BY HASH(`k`) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"store_row_column" = "${use_row_store}"); """

sql """insert into ${tableName} select number, number, number, number, number, number from numbers("number" = "10"); """
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

suite('test_flexible_partial_update_upgrade', 'p0,restart_fe') {

for (def use_row_store : [false, true]) {
logger.info("current params: use_row_store: ${use_row_store}")
def tableName = "test_f_upgrade_${use_row_store}"
sql """alter table ${tableName} enable feature "UPDATE_FLEXIBLE_COLUMNS"; """
show_res = sql "show create table ${tableName}"
assertTrue(show_res.toString().contains('"enable_unique_key_skip_bitmap_column" = "true"'))
qt_sql "select k,v1,v2,v3,v4,v5 from ${tableName} order by k;"

streamLoad {
table "${tableName}"
set 'format', 'json'
set 'read_json_by_line', 'true'
set 'strict_mode', 'false'
set 'unique_key_update_mode', 'UPDATE_FLEXIBLE_COLUMNS'
file "test1.json"
time 20000
}
qt_sql "select k,v1,v2,v3,v4,v5,BITMAP_TO_STRING(__DORIS_SKIP_BITMAP_COL__) from ${tableName} order by k;"

sql "set enable_unique_key_partial_update=true;"
sql "set enable_insert_strict=false;"
sql "sync;"
sql "insert into ${tableName}(k,v1,v3,v5) values(1,999,999,999),(2,888,888,888),(5,777,777,777),(20,555,555,555);"
sql "set enable_unique_key_partial_update=false;"
sql "set enable_insert_strict=true;"
sql "sync;"
qt_sql "select k,v1,v2,v3,v4,v5 from ${tableName} order by k;"

sql "delete from ${tableName} where k>=3 and k<=6;"
qt_sql "select k,v1,v2,v3,v4,v5 from ${tableName} order by k;"

sql "insert into ${tableName} values(3,10,10,10,10,10),(30,11,11,11,11,11),(4,12,12,12,12,12);"
qt_sql "select k,v1,v2,v3,v4,v5 from ${tableName} order by k;"
}
}

0 comments on commit c2a02db

Please sign in to comment.