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


##########
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:
   I've been trying but do not understand why these tests are coupled to small 
file handling. I think that the approach to testing is a bit strange to rely on 
that feature to test something in delta streamer for example.



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