This is an automated email from the ASF dual-hosted git repository.

dataroaring 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 bfab7a2537c [fix](shuffle) fix tablets num calculation in shuffle 
condition (#36050) (#36339)
bfab7a2537c is described below

commit bfab7a2537c2ace6ad21cf4c31694ae19c8a6a76
Author: Kaijie Chen <[email protected]>
AuthorDate: Sat Jun 15 23:06:00 2024 +0800

    [fix](shuffle) fix tablets num calculation in shuffle condition (#36050) 
(#36339)
    
    cherry-pick #36050
---
 .../nereids/trees/plans/physical/PhysicalOlapTableSink.java      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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 fee098ce166..dbe02884db2 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
@@ -202,9 +202,12 @@ public class PhysicalOlapTableSink<CHILD_TYPE extends 
Plan> extends PhysicalTabl
             DistributionInfo distributionInfo = 
targetTable.getDefaultDistributionInfo();
             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
-                        && distributionInfo.getBucketNum() < 
Config.min_tablets_for_dup_table_shuffle) {
-                    return PhysicalProperties.ANY;
+                if (targetTable.getKeysType() == KeysType.DUP_KEYS) {
+                    final long partitionNums = 
targetTable.getPartitionInfo().getAllPartitions().size();
+                    final long tabletNums = partitionNums * 
distributionInfo.getBucketNum();
+                    if (tabletNums < Config.min_tablets_for_dup_table_shuffle) 
{
+                        return PhysicalProperties.ANY;
+                    }
                 }
                 return PhysicalProperties.TABLET_ID_SHUFFLE;
             } else if (distributionInfo instanceof RandomDistributionInfo) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to