pick https://github.com/apache/doris/pull/40158
This commit is contained in:
@ -28,6 +28,7 @@ import org.apache.doris.analysis.SlotRef;
|
||||
import org.apache.doris.analysis.StringLiteral;
|
||||
import org.apache.doris.catalog.AggregateType;
|
||||
import org.apache.doris.catalog.PartitionType;
|
||||
import org.apache.doris.common.DdlException;
|
||||
import org.apache.doris.nereids.analyzer.UnboundFunction;
|
||||
import org.apache.doris.nereids.analyzer.UnboundSlot;
|
||||
import org.apache.doris.nereids.exceptions.AnalysisException;
|
||||
@ -269,6 +270,14 @@ public class PartitionTableInfo {
|
||||
|
||||
try {
|
||||
ArrayList<Expr> exprs = convertToLegacyAutoPartitionExprs(partitionList);
|
||||
|
||||
// only auto partition support partition expr
|
||||
if (!isAutoPartition) {
|
||||
if (exprs.stream().anyMatch(expr -> expr instanceof FunctionCallExpr)) {
|
||||
throw new DdlException("Non-auto partition table not support partition expr!");
|
||||
}
|
||||
}
|
||||
|
||||
// here we have already extracted identifierPartitionColumns
|
||||
if (partitionType.equals(PartitionType.RANGE.name())) {
|
||||
if (isAutoPartition) {
|
||||
|
||||
@ -407,4 +407,18 @@ suite("test_auto_partition_behavior") {
|
||||
sql """ insert into test_change values ("20001212"); """
|
||||
part_result = sql " show tablets from test_change "
|
||||
assertEquals(part_result.size, 52 * replicaNum)
|
||||
|
||||
test {
|
||||
sql """
|
||||
CREATE TABLE not_auto_expr (
|
||||
`TIME_STAMP` date NOT NULL
|
||||
)
|
||||
partition by range (date_trunc(`TIME_STAMP`, 'day'))()
|
||||
DISTRIBUTED BY HASH(`TIME_STAMP`) BUCKETS 10
|
||||
PROPERTIES (
|
||||
"replication_allocation" = "tag.location.default: 1"
|
||||
);
|
||||
"""
|
||||
exception "Non-auto partition table not support partition expr!"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user