SteNicholas commented on code in PR #7372:
URL: https://github.com/apache/hudi/pull/7372#discussion_r1041908081
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/clustering/plan/strategy/SparkSizeBasedClusteringPlanStrategy.java:
##########
@@ -65,11 +65,19 @@ protected Stream<HoodieClusteringGroup>
buildClusteringGroupsForPartition(String
List<Pair<List<FileSlice>, Integer>> fileSliceGroups = new ArrayList<>();
List<FileSlice> currentGroup = new ArrayList<>();
+
+ // Sort fileSlices before dividing, which makes dividing more compact
+ List<FileSlice> sortedFileSlices = new ArrayList<>(fileSlices);
+ sortedFileSlices.sort((o1, o2) -> (int)
+ ((o2.getBaseFile().isPresent() ? o2.getBaseFile().get().getFileSize()
: writeConfig.getParquetMaxFileSize())
Review Comment:
```suggestion
((o2.getBaseFile().isPresent() && o1.getBaseFile().isPresent()) ?
o2.getBaseFile().get().getFileSize()-o1.getBaseFile().get().getFileSize() :
writeConfig.getParquetMaxFileSize()- writeConfig.getParquetMaxFileSize())
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]