diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapTableSink.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapTableSink.java index dbe02884db..a04912f511 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapTableSink.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapTableSink.java @@ -203,7 +203,7 @@ public class PhysicalOlapTableSink extends PhysicalTabl if (distributionInfo instanceof HashDistributionInfo) { // Do not enable shuffle for duplicate key tables when its tablet num is less than threshold. if (targetTable.getKeysType() == KeysType.DUP_KEYS) { - final long partitionNums = targetTable.getPartitionInfo().getAllPartitions().size(); + final long partitionNums = Math.max(targetTable.getPartitionInfo().getAllPartitions().size(), 1); final long tabletNums = partitionNums * distributionInfo.getBucketNum(); if (tabletNums < Config.min_tablets_for_dup_table_shuffle) { return PhysicalProperties.ANY;