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 c645310bb9a branch-3.0: [refactor](regression) Re-arrange cases for 
data-partitioning doc (#43637)
c645310bb9a is described below

commit c645310bb9a55afca219f70e89aa0fc4febcaa89
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Nov 14 20:27:00 2024 +0800

    branch-3.0: [refactor](regression) Re-arrange cases for data-partitioning 
doc (#43637)
    
    Cherry-picked from #43373
    
    Co-authored-by: bobhan1 <bh2444151...@outlook.com>
---
 .../auto-partitioning.md.groovy}                   | 158 +--------------------
 .../data-partitioning/basic-concepts.md.groovy     |  60 ++++++++
 .../dynamic-partitioning.md.groovy                 |  91 ++++++++++++
 .../manual-partitioning.md.groovy                  |  75 ++++++++++
 4 files changed, 228 insertions(+), 156 deletions(-)

diff --git a/regression-test/suites/doc/table-design/data-partition.md.groovy 
b/regression-test/suites/doc/table-design/data-partitioning/auto-partitioning.md.groovy
similarity index 50%
rename from regression-test/suites/doc/table-design/data-partition.md.groovy
rename to 
regression-test/suites/doc/table-design/data-partitioning/auto-partitioning.md.groovy
index ac81c6d8dbe..b8b40c87cf0 100644
--- a/regression-test/suites/doc/table-design/data-partition.md.groovy
+++ 
b/regression-test/suites/doc/table-design/data-partitioning/auto-partitioning.md.groovy
@@ -17,162 +17,8 @@
 
 import org.junit.jupiter.api.Assertions;
 
-suite("docs/table-design/data-partition.md") {
+suite("docs/table-design/data-partitioning/auto-partitioning.md") {
     try {
-        sql "drop table if exists example_range_tbl"
-        multi_sql """
-        -- Range Partition
-        CREATE TABLE IF NOT EXISTS example_range_tbl
-        (
-            `user_id` LARGEINT NOT NULL COMMENT "用户id",
-            `date` DATE NOT NULL COMMENT "数据灌入日期时间",
-            `timestamp` DATETIME NOT NULL COMMENT "数据灌入的时间戳",
-            `city` VARCHAR(20) COMMENT "用户所在城市",
-            `age` SMALLINT COMMENT "用户年龄",
-            `sex` TINYINT COMMENT "用户性别",
-            `last_visit_date` DATETIME REPLACE DEFAULT "1970-01-01 00:00:00" 
COMMENT "用户最后一次访问时间",
-            `cost` BIGINT SUM DEFAULT "0" COMMENT "用户总消费",
-            `max_dwell_time` INT MAX DEFAULT "0" COMMENT "用户最大停留时间",
-            `min_dwell_time` INT MIN DEFAULT "99999" COMMENT "用户最小停留时间"
-        )
-        ENGINE=OLAP
-        AGGREGATE KEY(`user_id`, `date`, `timestamp`, `city`, `age`, `sex`)
-        PARTITION BY RANGE(`date`)
-        (
-            PARTITION `p201701` VALUES LESS THAN ("2017-02-01"),
-            PARTITION `p201702` VALUES LESS THAN ("2017-03-01"),
-            PARTITION `p201703` VALUES LESS THAN ("2017-04-01"),
-            PARTITION `p2018` VALUES [("2018-01-01"), ("2019-01-01"))
-        )
-        DISTRIBUTED BY HASH(`user_id`) BUCKETS 16
-        PROPERTIES
-        (
-            "replication_num" = "1"
-        );
-        """
-
-        sql "show create table example_range_tbl"
-        sql "show partitions from example_range_tbl"
-        sql """ALTER TABLE example_range_tbl ADD  PARTITION p201704 VALUES 
LESS THAN("2020-05-01") DISTRIBUTED BY HASH(`user_id`) BUCKETS 5"""
-
-        sql "drop table if exists null_list"
-        multi_sql """
-        create table null_list(
-        k0 varchar null
-        )
-        partition by list (k0)
-        (
-        PARTITION pX values in ((NULL))
-        )
-        DISTRIBUTED BY HASH(`k0`) BUCKETS 1
-        properties("replication_num" = "1");
-        insert into null_list values (null);
-        select * from null_list;
-        """
-
-        sql "drop table if exists null_range"
-        multi_sql """
-        create table null_range(
-        k0 int null
-        )
-        partition by range (k0)
-        (
-        PARTITION p10 values less than (10),
-        PARTITION p100 values less than (100),
-        PARTITION pMAX values less than (maxvalue)
-        )
-        DISTRIBUTED BY HASH(`k0`) BUCKETS 1
-        properties("replication_num" = "1");
-        insert into null_range values (null);
-        select * from null_range partition(p10);
-        """
-
-        sql "drop table if exists null_range2"
-        sql """
-        create table null_range2(
-        k0 int null
-        )
-        partition by range (k0)
-        (
-        PARTITION p200 values [("100"), ("200"))
-        )
-        DISTRIBUTED BY HASH(`k0`) BUCKETS 1
-        properties("replication_num" = "1")
-        """
-        try {
-            sql " insert into null_range2 values (null) "
-            Assertions.fail("The SQL above should throw an exception as 
follows:\n\t\terrCode = 2, detailMessage = Insert has filtered data in strict 
mode. url: 
http://127.0.0.1:8040/api/_load_error_log?file=__shard_0/error_log_insert_stmt_b3a6d1f1fac74750-b3bb5d6e92a66da4_b3a6d1f1fac74750_b3bb5d6e92a66da4";)
-        } catch (Exception e) {
-            assertTrue(e.getMessage().contains("errCode = 2, detailMessage = 
Insert has filtered data in strict mode. url:"))
-        }
-
-        sql "drop table if exists tbl1"
-        sql """
-        CREATE TABLE tbl1
-        (
-            k1 DATE
-        )
-        PARTITION BY RANGE(k1) ()
-        DISTRIBUTED BY HASH(k1)
-        PROPERTIES
-        (
-            "dynamic_partition.enable" = "true",
-            "dynamic_partition.time_unit" = "DAY",
-            "dynamic_partition.start" = "-7",
-            "dynamic_partition.end" = "3",
-            "dynamic_partition.prefix" = "p",
-            "dynamic_partition.buckets" = "32",
-            "replication_num" = "1"
-        )
-        """
-
-        sql "drop table if exists tbl1"
-        sql """
-        CREATE TABLE tbl1
-        (
-            k1 DATETIME,
-        )
-        PARTITION BY RANGE(k1) ()
-        DISTRIBUTED BY HASH(k1)
-        PROPERTIES
-        (
-            "dynamic_partition.enable" = "true",
-            "dynamic_partition.time_unit" = "WEEK",
-            "dynamic_partition.start" = "-2",
-            "dynamic_partition.end" = "2",
-            "dynamic_partition.prefix" = "p",
-            "dynamic_partition.buckets" = "8",
-            "replication_num" = "1"
-        )
-        """
-
-        sql "drop table if exists tbl1"
-        sql """
-        CREATE TABLE tbl1
-        (
-            k1 DATE
-        )
-        PARTITION BY RANGE(k1) ()
-        DISTRIBUTED BY HASH(k1)
-        PROPERTIES
-        (
-            "dynamic_partition.enable" = "true",
-            "dynamic_partition.time_unit" = "MONTH",
-            "dynamic_partition.end" = "2",
-            "dynamic_partition.prefix" = "p",
-            "dynamic_partition.buckets" = "8",
-            "dynamic_partition.start_day_of_month" = "3",
-            "replication_num" = "1"
-        )
-        """
-
-        sql "SHOW DYNAMIC PARTITION TABLES"
-        sql """ ADMIN SET FRONTEND CONFIG ("dynamic_partition_enable" = 
"true") """
-        cmd """ curl --location-trusted -u 
${context.config.jdbcUser}:${context.config.jdbcPassword} -XGET 
http://${context.config.feHttpAddress}/api/_set_config?dynamic_partition_enable=true
 """
-
-        sql """ ADMIN SET FRONTEND CONFIG 
("dynamic_partition_check_interval_seconds" = "7200") """
-        cmd """ curl --location-trusted -u 
${context.config.jdbcUser}:${context.config.jdbcPassword} -XGET 
http://${context.config.feHttpAddress}/api/_set_config?dynamic_partition_check_interval_seconds=432000
 """
-
         sql "drop table if exists `DAILY_TRADE_VALUE`"
         sql """
         CREATE TABLE `DAILY_TRADE_VALUE`
@@ -306,6 +152,6 @@ suite("docs/table-design/data-partition.md") {
         assertTrue(res2[1].size() == 3)
 
     } catch (Throwable t) {
-        Assertions.fail("examples in docs/table-design/data-partition.md 
failed to exec, please fix it", t)
+        Assertions.fail("examples in 
docs/table-design/data-partitioning/auto-partitioning.md failed to exec, please 
fix it", t)
     }
 }
diff --git 
a/regression-test/suites/doc/table-design/data-partitioning/basic-concepts.md.groovy
 
b/regression-test/suites/doc/table-design/data-partitioning/basic-concepts.md.groovy
new file mode 100644
index 00000000000..b257b434a05
--- /dev/null
+++ 
b/regression-test/suites/doc/table-design/data-partitioning/basic-concepts.md.groovy
@@ -0,0 +1,60 @@
+// 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 org.junit.jupiter.api.Assertions;
+
+suite("docs/table-design/data-partitioning/basic-concepts.md") {
+    try {
+        sql "drop table if exists example_range_tbl"
+        multi_sql """
+        -- Range Partition
+        CREATE TABLE IF NOT EXISTS example_range_tbl
+        (
+            `user_id` LARGEINT NOT NULL COMMENT "用户id",
+            `date` DATE NOT NULL COMMENT "数据灌入日期时间",
+            `timestamp` DATETIME NOT NULL COMMENT "数据灌入的时间戳",
+            `city` VARCHAR(20) COMMENT "用户所在城市",
+            `age` SMALLINT COMMENT "用户年龄",
+            `sex` TINYINT COMMENT "用户性别",
+            `last_visit_date` DATETIME REPLACE DEFAULT "1970-01-01 00:00:00" 
COMMENT "用户最后一次访问时间",
+            `cost` BIGINT SUM DEFAULT "0" COMMENT "用户总消费",
+            `max_dwell_time` INT MAX DEFAULT "0" COMMENT "用户最大停留时间",
+            `min_dwell_time` INT MIN DEFAULT "99999" COMMENT "用户最小停留时间"
+        )
+        ENGINE=OLAP
+        AGGREGATE KEY(`user_id`, `date`, `timestamp`, `city`, `age`, `sex`)
+        PARTITION BY RANGE(`date`)
+        (
+            PARTITION `p201701` VALUES LESS THAN ("2017-02-01"),
+            PARTITION `p201702` VALUES LESS THAN ("2017-03-01"),
+            PARTITION `p201703` VALUES LESS THAN ("2017-04-01"),
+            PARTITION `p2018` VALUES [("2018-01-01"), ("2019-01-01"))
+        )
+        DISTRIBUTED BY HASH(`user_id`) BUCKETS 16
+        PROPERTIES
+        (
+            "replication_num" = "1"
+        );
+        """
+
+        sql "show create table example_range_tbl"
+        sql "show partitions from example_range_tbl"
+        sql """ALTER TABLE example_range_tbl ADD  PARTITION p201704 VALUES 
LESS THAN("2020-05-01") DISTRIBUTED BY HASH(`user_id`) BUCKETS 5"""
+    } catch (Throwable t) {
+        Assertions.fail("examples in 
docs/table-design/data-partitioning/basic-concepts.md failed to exec, please 
fix it", t)
+    }
+}
diff --git 
a/regression-test/suites/doc/table-design/data-partitioning/dynamic-partitioning.md.groovy
 
b/regression-test/suites/doc/table-design/data-partitioning/dynamic-partitioning.md.groovy
new file mode 100644
index 00000000000..8693e78d776
--- /dev/null
+++ 
b/regression-test/suites/doc/table-design/data-partitioning/dynamic-partitioning.md.groovy
@@ -0,0 +1,91 @@
+// 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 org.junit.jupiter.api.Assertions;
+
+suite("docs/table-design/data-partitioning/dynamic-partitioning.md") {
+    try {
+        sql "drop table if exists tbl1"
+        sql """
+        CREATE TABLE tbl1
+        (
+            k1 DATE
+        )
+        PARTITION BY RANGE(k1) ()
+        DISTRIBUTED BY HASH(k1)
+        PROPERTIES
+        (
+            "dynamic_partition.enable" = "true",
+            "dynamic_partition.time_unit" = "DAY",
+            "dynamic_partition.start" = "-7",
+            "dynamic_partition.end" = "3",
+            "dynamic_partition.prefix" = "p",
+            "dynamic_partition.buckets" = "32",
+            "replication_num" = "1"
+        )
+        """
+
+        sql "drop table if exists tbl1"
+        sql """
+        CREATE TABLE tbl1
+        (
+            k1 DATETIME,
+        )
+        PARTITION BY RANGE(k1) ()
+        DISTRIBUTED BY HASH(k1)
+        PROPERTIES
+        (
+            "dynamic_partition.enable" = "true",
+            "dynamic_partition.time_unit" = "WEEK",
+            "dynamic_partition.start" = "-2",
+            "dynamic_partition.end" = "2",
+            "dynamic_partition.prefix" = "p",
+            "dynamic_partition.buckets" = "8",
+            "replication_num" = "1"
+        )
+        """
+
+        sql "drop table if exists tbl1"
+        sql """
+        CREATE TABLE tbl1
+        (
+            k1 DATE
+        )
+        PARTITION BY RANGE(k1) ()
+        DISTRIBUTED BY HASH(k1)
+        PROPERTIES
+        (
+            "dynamic_partition.enable" = "true",
+            "dynamic_partition.time_unit" = "MONTH",
+            "dynamic_partition.end" = "2",
+            "dynamic_partition.prefix" = "p",
+            "dynamic_partition.buckets" = "8",
+            "dynamic_partition.start_day_of_month" = "3",
+            "replication_num" = "1"
+        )
+        """
+
+        sql "SHOW DYNAMIC PARTITION TABLES"
+        sql """ ADMIN SET FRONTEND CONFIG ("dynamic_partition_enable" = 
"true") """
+        cmd """ curl --location-trusted -u 
${context.config.jdbcUser}:${context.config.jdbcPassword} -XGET 
http://${context.config.feHttpAddress}/api/_set_config?dynamic_partition_enable=true
 """
+
+        sql """ ADMIN SET FRONTEND CONFIG 
("dynamic_partition_check_interval_seconds" = "7200") """
+        cmd """ curl --location-trusted -u 
${context.config.jdbcUser}:${context.config.jdbcPassword} -XGET 
http://${context.config.feHttpAddress}/api/_set_config?dynamic_partition_check_interval_seconds=432000
 """
+    } catch (Throwable t) {
+        Assertions.fail("examples in 
docs/table-design/data-partitioning/dynamic-partitioning.md failed to exec, 
please fix it", t)
+    }
+}
diff --git 
a/regression-test/suites/doc/table-design/data-partitioning/manual-partitioning.md.groovy
 
b/regression-test/suites/doc/table-design/data-partitioning/manual-partitioning.md.groovy
new file mode 100644
index 00000000000..2027e8c99ea
--- /dev/null
+++ 
b/regression-test/suites/doc/table-design/data-partitioning/manual-partitioning.md.groovy
@@ -0,0 +1,75 @@
+// 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 org.junit.jupiter.api.Assertions;
+
+suite("docs/table-design/data-partitioning/manual-partitioning.md") {
+    try {
+        sql "drop table if exists null_list"
+        multi_sql """
+        create table null_list(
+        k0 varchar null
+        )
+        partition by list (k0)
+        (
+        PARTITION pX values in ((NULL))
+        )
+        DISTRIBUTED BY HASH(`k0`) BUCKETS 1
+        properties("replication_num" = "1");
+        insert into null_list values (null);
+        select * from null_list;
+        """
+
+        sql "drop table if exists null_range"
+        multi_sql """
+        create table null_range(
+        k0 int null
+        )
+        partition by range (k0)
+        (
+        PARTITION p10 values less than (10),
+        PARTITION p100 values less than (100),
+        PARTITION pMAX values less than (maxvalue)
+        )
+        DISTRIBUTED BY HASH(`k0`) BUCKETS 1
+        properties("replication_num" = "1");
+        insert into null_range values (null);
+        select * from null_range partition(p10);
+        """
+
+        sql "drop table if exists null_range2"
+        sql """
+        create table null_range2(
+        k0 int null
+        )
+        partition by range (k0)
+        (
+        PARTITION p200 values [("100"), ("200"))
+        )
+        DISTRIBUTED BY HASH(`k0`) BUCKETS 1
+        properties("replication_num" = "1")
+        """
+        try {
+            sql " insert into null_range2 values (null) "
+            Assertions.fail("The SQL above should throw an exception as 
follows:\n\t\terrCode = 2, detailMessage = Insert has filtered data in strict 
mode. url: 
http://127.0.0.1:8040/api/_load_error_log?file=__shard_0/error_log_insert_stmt_b3a6d1f1fac74750-b3bb5d6e92a66da4_b3a6d1f1fac74750_b3bb5d6e92a66da4";)
+        } catch (Exception e) {
+            assertTrue(e.getMessage().contains("errCode = 2, detailMessage = 
Insert has filtered data in strict mode. url:"))
+        }
+    } catch (Throwable t) {
+        Assertions.fail("examples in 
docs/table-design/data-partitioning/manual-partitioning.md failed to exec, 
please fix it", t)
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to