danny0405 commented on code in PR #11008:
URL: https://github.com/apache/hudi/pull/11008#discussion_r1569737390


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/deltacommit/SparkUpsertDeltaCommitPartitioner.java:
##########
@@ -89,10 +89,13 @@ protected List<SmallFile> getSmallFiles(String 
partitionPath) {
   private List<FileSlice> getSmallFileCandidates(String partitionPath, 
HoodieInstant latestCommitInstant) {
     // If we can index log files, we can add more inserts to log files for 
fileIds NOT including those under
     // pending compaction
+    Comparator<FileSlice> comparator = Comparator.<FileSlice, 
Long>comparing(fileSlice -> getTotalFileSize(fileSlice))
+        .thenComparing(FileSlice::getFileId);
     if (table.getIndex().canIndexLogFiles()) {
       return table.getSliceView()
               .getLatestFileSlicesBeforeOrOn(partitionPath, 
latestCommitInstant.getTimestamp(), false)
               .filter(this::isSmallFile)
+              .sorted(comparator)
               .collect(Collectors.toList());

Review Comment:
   Fine, just fix all the test failures and let's see what use cases are 
affected.



-- 
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]

Reply via email to