This is an automated email from the ASF dual-hosted git repository. zhangstar333 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 162c5a1a176 [cherry-pick](branch-30) should check the expr of auto range partition (#41626) (#41873) 162c5a1a176 is described below commit 162c5a1a176edbde273304c7502201279cfb5e83 Author: zhangstar333 <87313068+zhangstar...@users.noreply.github.com> AuthorDate: Wed Oct 23 17:08:19 2024 +0800 [cherry-pick](branch-30) should check the expr of auto range partition (#41626) (#41873) ## Proposed changes cherry-pick from master (#41626) <!--Describe your changes.--> --- .../org/apache/doris/analysis/PartitionDesc.java | 4 +-- .../test_auto_partition_behavior.groovy | 31 ++++++++++++++++++++++ .../test_auto_range_partition.groovy | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java index eb22ff06e44..ae1763fbfb1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java @@ -129,9 +129,9 @@ public class PartitionDesc { + expr.toSql()); } } else if (expr instanceof SlotRef) { - if (isAutoPartition && !colNames.isEmpty() && !isListPartition) { + if (isAutoPartition && !isListPartition) { throw new AnalysisException( - "auto create partition only support one slotRef in expr of RANGE partition. " + "auto create partition only support date_trunc function of RANGE partition. " + expr.toSql()); } colNames.add(((SlotRef) expr).getColumnName()); 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 0a6d46290a7..808bb6a8798 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 @@ -314,4 +314,35 @@ suite("test_auto_partition_behavior") { sql "insert into test_change select * from empty_range" sql "create table if not exists empty_list like long_value" sql "insert into long_value select * from empty_list" + + + // test not auto partition have expr. + test { + sql """ + CREATE TABLE if not exists dup_dynamic_t_logs ( + `timestamp` datetime NOT NULL, + `source` text NULL, + `node` text NULL, + `level` text NULL, + `component` text NULL, + `clientRequestId` varchar(50) NULL, + `message` text NULL, + `properties` variant NULL, + INDEX idx_source (`source`) USING INVERTED COMMENT '', + INDEX idx_node (`node`) USING INVERTED COMMENT '', + INDEX idx_level (`level`) USING INVERTED COMMENT '', + INDEX idx_component (`component`) USING INVERTED COMMENT '', + INDEX idx_clientRequestId (`clientRequestId`) USING INVERTED COMMENT '', + INDEX idx_message (`message`) USING INVERTED PROPERTIES("parser"="english") COMMENT '', + -- INDEX idx_properties (`properties`) USING INVERTED COMMENT '', + ) ENGINE=OLAP + DUPLICATE KEY(`timestamp`) + AUTO PARTITION BY RANGE (`timestamp`)() + DISTRIBUTED BY RANDOM BUCKETS 100 + PROPERTIES ( + "file_cache_ttl_seconds" = "600" + ); + """ + exception "auto create partition only support date_trunc function of RANGE partition" + } } diff --git a/regression-test/suites/partition_p0/auto_partition/test_auto_range_partition.groovy b/regression-test/suites/partition_p0/auto_partition/test_auto_range_partition.groovy index eadbcff4107..845bc2320fe 100644 --- a/regression-test/suites/partition_p0/auto_partition/test_auto_range_partition.groovy +++ b/regression-test/suites/partition_p0/auto_partition/test_auto_range_partition.groovy @@ -184,7 +184,7 @@ suite("test_auto_range_partition") { "replication_num" = "1" ); """ - exception "Auto Range Partition need FunctionCallExpr" + exception "auto create partition only support date_trunc function of RANGE partition" } test { sql """ --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org