You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2023/01/19 12:05:35 UTC

[GitHub] [hudi] SteNicholas commented on a diff in pull request #7159: [HUDI-5173]Skip if there is only one file in clusteringGroup

SteNicholas commented on code in PR #7159:
URL: https://github.com/apache/hudi/pull/7159#discussion_r1081174963


##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/client/clustering/plan/strategy/FlinkSizeBasedClusteringPlanStrategy.java:
##########
@@ -70,9 +70,11 @@ protected Stream<HoodieClusteringGroup> buildClusteringGroupsForPartition(String
       // check if max size is reached and create new group, if needed.
       // in now, every clustering group out put is 1 file group.
       if (totalSizeSoFar >= writeConfig.getClusteringTargetFileMaxBytes() && !currentGroup.isEmpty()) {
-        LOG.info("Adding one clustering group " + totalSizeSoFar + " max bytes: "
-            + writeConfig.getClusteringMaxBytesInGroup() + " num input slices: " + currentGroup.size());
-        fileSliceGroups.add(Pair.of(currentGroup, 1));
+        if (currentGroup.size() > 1 || writeConfig.isClusteringSortEnabled()) {
+          LOG.info("Adding one clustering group " + totalSizeSoFar + " max bytes: "
+                  + writeConfig.getClusteringMaxBytesInGroup() + " num input slices: " + currentGroup.size());
+          fileSliceGroups.add(Pair.of(currentGroup, 1));

Review Comment:
   At present every clustering group out put is 1 file group, therefore the right of `fileSliceGroups` is always 1 which could set `numOutputFileGroups` to 1 and no need use `Pair`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org