From 5c70fe35ea82bdac6cdf0c58c36b97010e6b30ef Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:18:41 +0800 Subject: [PATCH] [fix](Nereids) sink distribute is wrong when table is unpartitioned (#40541) (#40901) pick from master #40541 --- .../nereids/trees/plans/physical/PhysicalOlapTableSink.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 dbe02884db2e4e..a04912f5119879 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 PhysicalProperties getRequirePhysicalProperties() { 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;