This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new d87c8cc24b4 [test](flexible partial update) Add upgrade/downgrade case 
for flexible partial update (#42420)
d87c8cc24b4 is described below

commit d87c8cc24b4d5ddfa23ecb7809685c7e2468c97c
Author: bobhan1 <[email protected]>
AuthorDate: Tue Nov 19 14:20:00 2024 +0800

    [test](flexible partial update) Add upgrade/downgrade case for flexible 
partial update (#42420)
---
 .../unique_with_mow_p0/flexible/downgrade/test.out |  93 ++++++++++++++++
 .../flexible/downgrade/test1.json                  |   8 ++
 .../unique_with_mow_p0/flexible/upgrade/test.out   | 117 +++++++++++++++++++++
 .../unique_with_mow_p0/flexible/upgrade/test1.json |   8 ++
 .../flexible/downgrade/load.groovy                 |  65 ++++++++++++
 .../flexible/downgrade/test.groovy                 |  40 +++++++
 .../flexible/upgrade/load.groovy                   |  55 ++++++++++
 .../flexible/upgrade/test.groovy                   |  54 ++++++++++
 8 files changed, 440 insertions(+)

diff --git 
a/regression-test/data/unique_with_mow_p0/flexible/downgrade/test.out 
b/regression-test/data/unique_with_mow_p0/flexible/downgrade/test.out
new file mode 100644
index 00000000000..79d25e505ae
--- /dev/null
+++ b/regression-test/data/unique_with_mow_p0/flexible/downgrade/test.out
@@ -0,0 +1,93 @@
+-- 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      10      111     111     1       1
+2      2       20      2       222     25
+3      3       3       30      3       3
+4      43      4       99      20      4
+5      5       5       5       5       \N
+6      999     6       777     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      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      10      111     111     1       1
+2      2       20      2       222     25
+3      3       3       30      3       3
+4      43      4       99      20      4
+5      5       5       5       5       \N
+6      999     6       777     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      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
+
diff --git 
a/regression-test/data/unique_with_mow_p0/flexible/downgrade/test1.json 
b/regression-test/data/unique_with_mow_p0/flexible/downgrade/test1.json
new file mode 100644
index 00000000000..b61fbb04364
--- /dev/null
+++ b/regression-test/data/unique_with_mow_p0/flexible/downgrade/test1.json
@@ -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}
\ No newline at end of file
diff --git a/regression-test/data/unique_with_mow_p0/flexible/upgrade/test.out 
b/regression-test/data/unique_with_mow_p0/flexible/upgrade/test.out
new file mode 100644
index 00000000000..e1ae6f51247
--- /dev/null
+++ b/regression-test/data/unique_with_mow_p0/flexible/upgrade/test.out
@@ -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
+
diff --git 
a/regression-test/data/unique_with_mow_p0/flexible/upgrade/test1.json 
b/regression-test/data/unique_with_mow_p0/flexible/upgrade/test1.json
new file mode 100644
index 00000000000..b61fbb04364
--- /dev/null
+++ b/regression-test/data/unique_with_mow_p0/flexible/upgrade/test1.json
@@ -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}
\ No newline at end of file
diff --git 
a/regression-test/suites/unique_with_mow_p0/flexible/downgrade/load.groovy 
b/regression-test/suites/unique_with_mow_p0/flexible/downgrade/load.groovy
new file mode 100644
index 00000000000..bae20d3c68e
--- /dev/null
+++ b/regression-test/suites/unique_with_mow_p0/flexible/downgrade/load.groovy
@@ -0,0 +1,65 @@
+// 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_downgrade_base_data', 'p0,restart_fe') {
+    String db = context.config.getDbNameByFile(context.file)
+    for (def use_row_store : [false, true]) {
+        logger.info("current params: use_row_store: ${use_row_store}")
+        def tableName = "test_f_downgrade_${use_row_store}"
+        
+        sql "use ${db};"
+        def tbls = sql "show tables;"
+        boolean shouldSkip = false
+        for (def tbl : tbls) {
+            if (tbl[0] == tableName) {
+                logger.info("skip to create table ${tableName};")
+                shouldSkip = true
+                break;
+            }
+        }
+        if (shouldSkip) {
+            continue
+        }
+        
+        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",
+            "enable_unique_key_skip_bitmap_column" = "true",
+            "store_row_column" = "${use_row_store}"); """
+
+        sql """insert into ${tableName} select number, number, number, number, 
number, number from numbers("number" = "10"); """
+        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
+        }
+    }
+}
\ No newline at end of file
diff --git 
a/regression-test/suites/unique_with_mow_p0/flexible/downgrade/test.groovy 
b/regression-test/suites/unique_with_mow_p0/flexible/downgrade/test.groovy
new file mode 100644
index 00000000000..059324a1943
--- /dev/null
+++ b/regression-test/suites/unique_with_mow_p0/flexible/downgrade/test.groovy
@@ -0,0 +1,40 @@
+// 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_downgrade', 'p0,restart_fe') {
+    String db = context.config.getDbNameByFile(context.file)
+    for (def use_row_store : [false, true]) {
+        logger.info("current params: use_row_store: ${use_row_store}")
+        def tableName = "test_f_downgrade_${use_row_store}"
+        qt_sql "select k,v1,v2,v3,v4,v5 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;"
+    }
+}
\ No newline at end of file
diff --git 
a/regression-test/suites/unique_with_mow_p0/flexible/upgrade/load.groovy 
b/regression-test/suites/unique_with_mow_p0/flexible/upgrade/load.groovy
new file mode 100644
index 00000000000..df2fa79f8cb
--- /dev/null
+++ b/regression-test/suites/unique_with_mow_p0/flexible/upgrade/load.groovy
@@ -0,0 +1,55 @@
+// 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') {
+    String db = context.config.getDbNameByFile(context.file)
+    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 "use ${db};"
+        def tbls = sql "show tables;"
+        boolean shouldSkip = false
+        for (def tbl : tbls) {
+            if (tbl[0] == tableName) {
+                logger.info("skip to create table ${tableName};")
+                shouldSkip = true
+                break;
+            }
+        }
+        if (shouldSkip) {
+            continue
+        }
+        
+        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"); """
+    }
+}
\ No newline at end of file
diff --git 
a/regression-test/suites/unique_with_mow_p0/flexible/upgrade/test.groovy 
b/regression-test/suites/unique_with_mow_p0/flexible/upgrade/test.groovy
new file mode 100644
index 00000000000..91fa2267032
--- /dev/null
+++ b/regression-test/suites/unique_with_mow_p0/flexible/upgrade/test.groovy
@@ -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;"
+    }
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to