This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new eea916e4668 [cherry-pick](branch-21) should check the expr of auto
range partition (#41626) (#41872)
eea916e4668 is described below
commit eea916e466845a47f31a8140a4382fcb50c80fe5
Author: zhangstar333 <[email protected]>
AuthorDate: Thu Oct 17 12:45:49 2024 +0800
[cherry-pick](branch-21) should check the expr of auto range partition
(#41626) (#41872)
## 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 f4adfe9c19a..a51dfac488d 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
@@ -425,4 +425,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 1ba228bbd54..c08cb74e6c9 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
@@ -182,7 +182,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: [email protected]
For additional commands, e-mail: [email protected]