diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/NereidsCoordinator.java b/fe/fe-core/src/main/java/org/apache/doris/qe/NereidsCoordinator.java index 0d1b8df9d3dd45a..83ef98fdcca9e35 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/NereidsCoordinator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/NereidsCoordinator.java @@ -162,20 +162,7 @@ private void setForBucketScanSource(FInstanceExecParam instanceExecParam, if (scanNode instanceof OlapScanNode) { OlapScanNode olapScanNode = (OlapScanNode) scanNode; if (!fragmentIdToSeqToAddressMap.containsKey(scanNode.getFragmentId())) { - // In bucket shuffle join, we have 2 situation. - // 1. Only one partition: in this case, we use scanNode.getTotalTabletsNum() - // to get the right bucket num because when table turn on dynamic partition, - // the bucket number in default distribution info - // is not correct. - // 2. Table is colocated: in this case, table could have more than one partition, - // but all partition's bucket number must be same, so we use default bucket num is ok. - int bucketNum = 0; - if (olapScanNode.getOlapTable().isColocateTable()) { - bucketNum = olapScanNode.getOlapTable().getDefaultDistributionInfo() - .getBucketNum(); - } else { - bucketNum = (int) (olapScanNode.getTotalTabletsNum()); - } + int bucketNum = olapScanNode.getBucketNum(); fragmentIdToSeqToAddressMap.put(olapScanNode.getFragmentId(), new HashMap<>()); bucketShuffleJoinController.fragmentIdBucketSeqToScanRangeMap .put(scanNode.getFragmentId(), new BucketSeqToScanRange());