This is an automated email from the ASF dual-hosted git repository.
lihaopeng 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 d3f63d53d17 [Bug](auto-partition) should check the expr of auto range
partition (#41626)
d3f63d53d17 is described below
commit d3f63d53d1758a376257fcc6495662dcd1ba43f7
Author: zhangstar333 <[email protected]>
AuthorDate: Mon Oct 14 17:59:14 2024 +0800
[Bug](auto-partition) should check the expr of auto range partition (#41626)
```
AUTO PARTITION BY RANGE (FUNC_CALL_EXPR)
(
)
FUNC_CALL_EXPR ::= date_trunc ( <partition_column>, '<interval>' )
should check the expr, now auto range partition only support date_trunc
```
---
.../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: [email protected]
For additional commands, e-mail: [email protected]