This is an automated email from the ASF dual-hosted git repository. zhangstar333 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 fb612c3be36 [Fix](testcase) Split auto and dynamic partition into individual case (#40307) fb612c3be36 is described below commit fb612c3be36c13a8aa24b135d608fb7c9135e868 Author: zclllhhjj <zhaochan...@selectdb.com> AuthorDate: Tue Sep 3 19:49:09 2024 +0800 [Fix](testcase) Split auto and dynamic partition into individual case (#40307) ## Proposed changes Issue Number: close #xxx `admin set frontend config ('dynamic_partition_check_interval_seconds' = '1')` will effect the results --- .../auto_partition/test_auto_dynamic.out | 6 + .../test_auto_partition_behavior.out | 5 - .../auto_partition/test_auto_dynamic.groovy | 130 +++++++++++++++++++++ .../test_auto_partition_behavior.groovy | 111 ------------------ 4 files changed, 136 insertions(+), 116 deletions(-) diff --git a/regression-test/data/partition_p0/auto_partition/test_auto_dynamic.out b/regression-test/data/partition_p0/auto_partition/test_auto_dynamic.out new file mode 100644 index 00000000000..0b588c49759 --- /dev/null +++ b/regression-test/data/partition_p0/auto_partition/test_auto_dynamic.out @@ -0,0 +1,6 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !sql_dynamic_auto -- +2024-01-01T00:00 +2900-01-01T00:00 +3000-01-01T00:00 + diff --git a/regression-test/data/partition_p0/auto_partition/test_auto_partition_behavior.out b/regression-test/data/partition_p0/auto_partition/test_auto_partition_behavior.out index 27d77c500f2..133a86cddab 100644 --- a/regression-test/data/partition_p0/auto_partition/test_auto_partition_behavior.out +++ b/regression-test/data/partition_p0/auto_partition/test_auto_partition_behavior.out @@ -114,8 +114,3 @@ Xxx -- !sql_non_order3 -- 3 2013-12-12T00:00 --- !sql_dynamic_auto -- -2024-01-01T00:00 -2900-01-01T00:00 -3000-01-01T00:00 - diff --git a/regression-test/suites/partition_p0/auto_partition/test_auto_dynamic.groovy b/regression-test/suites/partition_p0/auto_partition/test_auto_dynamic.groovy new file mode 100644 index 00000000000..c5fa8a736db --- /dev/null +++ b/regression-test/suites/partition_p0/auto_partition/test_auto_dynamic.groovy @@ -0,0 +1,130 @@ + + +// 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_auto_dynamic", "nonConcurrent") { + // PROHIBIT different timeunit of interval when use both auto & dynamic partition + test{ + sql """ + CREATE TABLE tbl3 + ( + k1 DATETIME NOT NULL, + col1 int + ) + auto partition by range (date_trunc(`k1`, 'year')) () + DISTRIBUTED BY HASH(k1) + PROPERTIES + ( + "replication_num" = "1", + "dynamic_partition.create_history_partition"="true", + "dynamic_partition.enable" = "true", + "dynamic_partition.time_unit" = "HOUR", + "dynamic_partition.start" = "-2", + "dynamic_partition.end" = "2", + "dynamic_partition.prefix" = "p", + "dynamic_partition.buckets" = "8" + ); + """ + exception "If support auto partition and dynamic partition at same time, they must have the same interval unit." + } + + sql " drop table if exists test_dynamic " + sql """ + create table test_dynamic( + k0 DATE not null + ) + auto partition by range (date_trunc(k0, 'year')) () + DISTRIBUTED BY HASH(`k0`) BUCKETS auto + properties("replication_num" = "1"); + """ + test { + sql """ + ALTER TABLE test_dynamic set ( + "dynamic_partition.enable" = "true", + "dynamic_partition.time_unit" = "DAY", + "dynamic_partition.end" = "3", + "dynamic_partition.prefix" = "p", + "dynamic_partition.buckets" = "32" + ); + """ + exception "If support auto partition and dynamic partition at same time, they must have the same interval unit." + } + sql """ + ALTER TABLE test_dynamic set ( + "dynamic_partition.enable" = "true", + "dynamic_partition.time_unit" = "YeAr", + "dynamic_partition.end" = "3", + "dynamic_partition.prefix" = "p", + "dynamic_partition.buckets" = "32" + ); + """ + + sql " drop table if exists auto_dynamic " + sql """ + create table auto_dynamic( + k0 datetime(6) NOT NULL + ) + auto partition by range (date_trunc(k0, 'hour')) + ( + ) + DISTRIBUTED BY HASH(`k0`) BUCKETS 2 + properties( + "dynamic_partition.enable" = "true", + "dynamic_partition.prefix" = "p", + "dynamic_partition.create_history_partition" = "true", + "dynamic_partition.start" = "-5", + "dynamic_partition.end" = "0", + "dynamic_partition.time_unit" = "hour", + "replication_num" = "1" + ); + """ + def part_result = sql " show partitions from auto_dynamic " + assertEquals(part_result.size, 6) + + sql " drop table if exists auto_dynamic " + sql """ + create table auto_dynamic( + k0 datetime(6) NOT NULL + ) + auto partition by range (date_trunc(k0, 'year')) + ( + ) + DISTRIBUTED BY HASH(`k0`) BUCKETS 2 + properties( + "dynamic_partition.enable" = "true", + "dynamic_partition.prefix" = "p", + "dynamic_partition.start" = "-50", + "dynamic_partition.end" = "0", + "dynamic_partition.time_unit" = "year", + "replication_num" = "1" + ); + """ + part_result = sql " show partitions from auto_dynamic " + assertEquals(part_result.size, 1) + + sql " insert into auto_dynamic values ('2024-01-01'), ('2900-01-01'), ('1900-01-01'), ('3000-01-01'); " + sql """ admin set frontend config ('dynamic_partition_check_interval_seconds' = '1') """ + sleep(2000) + part_result = sql " show partitions from auto_dynamic " + log.info("${part_result}".toString()) + assertEquals(part_result.size, 3) + + qt_sql_dynamic_auto "select * from auto_dynamic order by k0;" + + sql """ admin set frontend config ('dynamic_partition_check_interval_seconds' = '600') """ +} \ No newline at end of file diff --git a/regression-test/suites/partition_p0/auto_partition/test_auto_partition_behavior.groovy b/regression-test/suites/partition_p0/auto_partition/test_auto_partition_behavior.groovy index e5ce52af31e..01fdfd4d634 100644 --- a/regression-test/suites/partition_p0/auto_partition/test_auto_partition_behavior.groovy +++ b/regression-test/suites/partition_p0/auto_partition/test_auto_partition_behavior.groovy @@ -217,117 +217,6 @@ suite("test_auto_partition_behavior") { - // dynamic + auto partition - sql """ admin set frontend config ('dynamic_partition_check_interval_seconds' = '1') """ - // PROHIBIT different timeunit of interval when use both auto & dynamic partition - test{ - sql """ - CREATE TABLE tbl3 - ( - k1 DATETIME NOT NULL, - col1 int - ) - auto partition by range (date_trunc(`k1`, 'year')) () - DISTRIBUTED BY HASH(k1) - PROPERTIES - ( - "replication_num" = "1", - "dynamic_partition.create_history_partition"="true", - "dynamic_partition.enable" = "true", - "dynamic_partition.time_unit" = "HOUR", - "dynamic_partition.start" = "-2", - "dynamic_partition.end" = "2", - "dynamic_partition.prefix" = "p", - "dynamic_partition.buckets" = "8" - ); - """ - exception "If support auto partition and dynamic partition at same time, they must have the same interval unit." - } - - sql " drop table if exists test_dynamic " - sql """ - create table test_dynamic( - k0 DATE not null - ) - auto partition by range (date_trunc(k0, 'year')) () - DISTRIBUTED BY HASH(`k0`) BUCKETS auto - properties("replication_num" = "1"); - """ - test { - sql """ - ALTER TABLE test_dynamic set ( - "dynamic_partition.enable" = "true", - "dynamic_partition.time_unit" = "DAY", - "dynamic_partition.end" = "3", - "dynamic_partition.prefix" = "p", - "dynamic_partition.buckets" = "32" - ); - """ - exception "If support auto partition and dynamic partition at same time, they must have the same interval unit." - } - sql """ - ALTER TABLE test_dynamic set ( - "dynamic_partition.enable" = "true", - "dynamic_partition.time_unit" = "YeAr", - "dynamic_partition.end" = "3", - "dynamic_partition.prefix" = "p", - "dynamic_partition.buckets" = "32" - ); - """ - - sql " drop table if exists auto_dynamic " - sql """ - create table auto_dynamic( - k0 datetime(6) NOT NULL - ) - auto partition by range (date_trunc(k0, 'hour')) - ( - ) - DISTRIBUTED BY HASH(`k0`) BUCKETS 2 - properties( - "dynamic_partition.enable" = "true", - "dynamic_partition.prefix" = "p", - "dynamic_partition.create_history_partition" = "true", - "dynamic_partition.start" = "-5", - "dynamic_partition.end" = "0", - "dynamic_partition.time_unit" = "hour", - "replication_num" = "1" - ); - """ - def part_result = sql " show partitions from auto_dynamic " - assertEquals(part_result.size, 6) - - sql " drop table if exists auto_dynamic " - sql """ - create table auto_dynamic( - k0 datetime(6) NOT NULL - ) - auto partition by range (date_trunc(k0, 'year')) - ( - ) - DISTRIBUTED BY HASH(`k0`) BUCKETS 2 - properties( - "dynamic_partition.enable" = "true", - "dynamic_partition.prefix" = "p", - "dynamic_partition.start" = "-50", - "dynamic_partition.end" = "0", - "dynamic_partition.time_unit" = "year", - "replication_num" = "1" - ); - """ - part_result = sql " show partitions from auto_dynamic " - assertEquals(part_result.size, 1) - sql " insert into auto_dynamic values ('2024-01-01'), ('2900-01-01'), ('1900-01-01'), ('3000-01-01'); " - sleep(3000) - part_result = sql " show partitions from auto_dynamic " - log.info("${part_result}".toString()) - assertEquals(part_result.size, 3) - qt_sql_dynamic_auto "select * from auto_dynamic order by k0;" - sql """ admin set frontend config ('dynamic_partition_check_interval_seconds' = '600') """ - - - - // prohibit too long value for partition column sql "drop table if exists `long_value`" sql """ --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org