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 fd74762b26f [regression test](schema change) add case for partition
(#30195)
fd74762b26f is described below
commit fd74762b26fd03a2c3d38ce472b82fe2b4817349
Author: Guangdong Liu <[email protected]>
AuthorDate: Wed Jan 24 17:15:07 2024 +0800
[regression test](schema change) add case for partition (#30195)
---
.../data/schema_change_p0/test_partition.out | 14 +++++
.../suites/schema_change_p0/test_partition.groovy | 68 ++++++++++++++++++++++
2 files changed, 82 insertions(+)
diff --git a/regression-test/data/schema_change_p0/test_partition.out
b/regression-test/data/schema_change_p0/test_partition.out
new file mode 100644
index 00000000000..a661aa01d20
--- /dev/null
+++ b/regression-test/data/schema_change_p0/test_partition.out
@@ -0,0 +1,14 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !sql --
+1 1 xxx 1
+2 1 yyy 1
+
+-- !sql_1 --
+1 1 xxx 1
+2 1 yyy 1
+3 1 xxx 1
+
+-- !sql_2 --
+1 1 xxx 1
+2 1 yyy 1
+
diff --git a/regression-test/suites/schema_change_p0/test_partition.groovy
b/regression-test/suites/schema_change_p0/test_partition.groovy
new file mode 100644
index 00000000000..d3d00d9feed
--- /dev/null
+++ b/regression-test/suites/schema_change_p0/test_partition.groovy
@@ -0,0 +1,68 @@
+// 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_partition") {
+
+ def checkPartition = {tblName ->
+ def results = sql """SHOW PARTITIONS FROM ${tblName};"""
+ for (def result : results) {
+ logger.info("result:${result}")
+ if (["old_p1", "old_p2", "new_p1", "new_p2"].contains(result[1])) {
+ continue;
+ }
+ assertTrue(false);
+ }
+ }
+
+ String tblName = "test_partition"
+ sql """DROP TABLE IF EXISTS ${tblName} FORCE; """
+
+ sql """
+ CREATE TABLE `${tblName}`
+ (
+ `siteid` INT DEFAULT '10',
+ `citycode` SMALLINT,
+ `username` VARCHAR(32) DEFAULT 'test',
+ `pv` BIGINT SUM DEFAULT '0'
+ )
+ AGGREGATE KEY(`siteid`, `citycode`, `username`)
+ PARTITION BY RANGE(`siteid`)
+ (
+ partition `old_p1` values [("1"), ("2")),
+ partition `old_p2` values [("2"), ("3"))
+ )
+ DISTRIBUTED BY HASH(siteid) BUCKETS 1
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ sql """INSERT INTO ${tblName}(siteid, citycode, username, pv) VALUES (1,
1, "xxx", 1), (2, 1, "yyy", 1);"""
+ sql """SYNC;"""
+ order_qt_sql """SELECT * from ${tblName};"""
+
+ // add partition
+ sql """ALTER TABLE ${tblName} add PARTITION new_p1 values [("3"),
("4"));"""
+ sql """INSERT INTO ${tblName}(siteid, citycode, username, pv) VALUES (3,
1, "xxx", 1);"""
+ order_qt_sql_1 """SELECT * from ${tblName};"""
+ checkPartition(tblName);
+ // del partition
+ sql """ALTER TABLE ${tblName} DROP PARTITION new_p1;"""
+ order_qt_sql_2 """SELECT * from ${tblName};"""
+ checkPartition(tblName);
+ sql """DROP TABLE IF EXISTS ${tblName} FORCE; """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]