the-other-tim-brown commented on code in PR #11008:
URL: https://github.com/apache/hudi/pull/11008#discussion_r1571633643


##########
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:
   @danny0405 the test failing is flakey. It is try to test some spark 
exception but it is non-deterministic. 



-- 
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-unsubscr...@hudi.apache.org

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

Reply via email to