This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 3155548dfee [fix](case) fix test_schema_change_ck (#41654) (#44254)
3155548dfee is described below
commit 3155548dfee03487c1c0734480c0dfc7e7493a8b
Author: meiyi <[email protected]>
AuthorDate: Tue Nov 19 20:06:52 2024 +0800
[fix](case) fix test_schema_change_ck (#41654) (#44254)
pick https://github.com/apache/doris/pull/41654/
---
.../unique_with_mow_c_p0/test_schema_change_ck.out | 44 ++++-----
regression-test/suites/insert_p0/test_jdbc.groovy | 102 +++++++++++++++++++++
.../test_schema_change_ck.groovy | 4 +-
3 files changed, 126 insertions(+), 24 deletions(-)
diff --git
a/regression-test/data/unique_with_mow_c_p0/test_schema_change_ck.out
b/regression-test/data/unique_with_mow_c_p0/test_schema_change_ck.out
index a36d167747d..9c9baf209ad 100644
--- a/regression-test/data/unique_with_mow_c_p0/test_schema_change_ck.out
+++ b/regression-test/data/unique_with_mow_c_p0/test_schema_change_ck.out
@@ -154,28 +154,28 @@
210 200 39 20
-- !select_create_mv_mv --
-10 39
-11 38
-110 39
-111 38
-112 37
-113 36
-114 35
-115 34
-116 33
-117 32
-118 31
-119 30
-12 37
-13 36
-14 35
-15 34
-16 33
-17 32
-18 31
-19 30
-210 39
-211 38
+10 \N 29
+11 \N 28
+110 200 20
+111 200 21
+112 200 22
+113 200 23
+114 200 24
+115 200 25
+116 200 20
+117 200 20
+118 200 20
+119 200 20
+12 \N 26
+13 \N 27
+14 \N 20
+15 \N 20
+16 \N 20
+17 \N 20
+18 200 20
+19 200 20
+210 200 20
+211 200 21
-- !select_create_rollup_base --
11 \N 38 28
diff --git a/regression-test/suites/insert_p0/test_jdbc.groovy
b/regression-test/suites/insert_p0/test_jdbc.groovy
new file mode 100644
index 00000000000..acd275983aa
--- /dev/null
+++ b/regression-test/suites/insert_p0/test_jdbc.groovy
@@ -0,0 +1,102 @@
+// 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.
+
+import java.util.Arrays
+import java.util.stream.Collectors
+
+suite("test_jdbc") {
+ def user = context.config.jdbcUser
+ def password = context.config.jdbcPassword
+ def realDb = "regression_test_insert_p0"
+ def tableName = realDb + ".test_jdbc"
+
+ sql "CREATE DATABASE IF NOT EXISTS ${realDb}"
+ sql """ DROP TABLE IF EXISTS ${tableName} """
+ sql """
+ CREATE TABLE ${tableName} (
+ `id` int(11) NULL,
+ `phone` varchar(50) NULL,
+ ) ENGINE=OLAP
+ unique KEY(`id`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`id`) BUCKETS 1
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ // Parse url
+ String jdbcUrl = context.config.jdbcUrl
+ String urlWithoutSchema = jdbcUrl.substring(jdbcUrl.indexOf("://") + 3)
+ def sql_ip = urlWithoutSchema.substring(0, urlWithoutSchema.indexOf(":"))
+ def sql_port
+ if (urlWithoutSchema.indexOf("/") >= 0) {
+ // e.g: jdbc:mysql://localhost:8080/?a=b
+ sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") +
1, urlWithoutSchema.indexOf("/"))
+ } else {
+ // e.g: jdbc:mysql://localhost:8080
+ sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") +
1)
+ }
+ String url =
String.format("jdbc:mysql://%s:%s/%s?useLocalSessionState=true", sql_ip,
sql_port, realDb)
+ def batchSize = 5
+
+ def urls = [
+ url,
+ url + "&rewriteBatchedStatements=true",
+ url + "&rewriteBatchedStatements=true&allowMultiQueries=true",
+ url + "&rewriteBatchedStatements=true&allowMultiQueries=false"
+ ]
+
+ def insert = { jdbc_url ->
+ connect(user = user, password = password, url = jdbc_url) {
+ logger.info("insert url: {}", jdbc_url)
+ def ps = prepareStatement "insert into ${tableName} values(?, ?)"
+ for (int i = 0; i < batchSize; i++) {
+ String phone = UUID.randomUUID().toString()
+ ps.setInt(1, i + 1)
+ ps.setString(2, phone)
+ logger.info((i + 1) + ", " + phone)
+ ps.addBatch()
+ }
+ int[] results = ps.executeBatch()
+ logger.info("insert results: {}",
Arrays.stream(results).boxed().map(i ->
String.valueOf(i)).collect(Collectors.joining(", ")))
+ ps.close()
+ }
+ }
+
+ def update = { jdbc_url ->
+ connect(user = user, password = password, url = jdbc_url) {
+ logger.info("update url: {}", jdbc_url)
+ def ps = prepareStatement "update ${tableName} set phone = ? where
id = ?";
+ for (int i = 0; i < batchSize; i++) {
+ String phone = UUID.randomUUID().toString()
+ ps.setInt(2, i + 1)
+ ps.setString(1, phone)
+ logger.info((i + 1) + ", " + phone)
+ ps.addBatch()
+ }
+ int[] results = ps.executeBatch()
+ logger.info("update results: {}",
Arrays.stream(results).boxed().map(i ->
String.valueOf(i)).collect(Collectors.joining(", ")))
+ ps.close()
+ }
+ }
+
+ for (final def jdbc_url in urls) {
+ insert(jdbc_url)
+ update(jdbc_url)
+ }
+}
diff --git
a/regression-test/suites/unique_with_mow_c_p0/test_schema_change_ck.groovy
b/regression-test/suites/unique_with_mow_c_p0/test_schema_change_ck.groovy
index f37444e0d54..17f76f538f7 100644
--- a/regression-test/suites/unique_with_mow_c_p0/test_schema_change_ck.groovy
+++ b/regression-test/suites/unique_with_mow_c_p0/test_schema_change_ck.groovy
@@ -145,7 +145,7 @@ suite("test_schema_change_ck") {
/****** create mv ******/
def mv_name = "k2_c3"
sql """DROP MATERIALIZED VIEW IF EXISTS ${mv_name}"""
- createMV """ create materialized view ${mv_name} as select c1, c3 from
${tableName}; """
+ createMV """ create materialized view ${mv_name} as select c1, k2, c2 from
${tableName}; """
sql """ INSERT INTO ${tableName}(c1, c2, c3, k2) VALUES (211, 21, 38,
200), (210, 20, 39, 200) """
qt_select_create_mv_base """select * from ${tableName}"""
/*Awaitility.await().atMost(100, SECONDS).pollInterval(4, SECONDS).until(
@@ -154,7 +154,7 @@ suite("test_schema_change_ck") {
return result.contains(mv_name)
}
)*/
- order_qt_select_create_mv_mv """select c1, c3 from ${tableName}"""
+ order_qt_select_create_mv_mv """select c1, k2, c2 from ${tableName}"""
/****** create rollup ******/
sql """ alter table ${tableName} ADD ROLLUP r1(k2, c1, c2); """
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]