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


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/SparkInsertOverwriteCommitActionExecutor.java:
##########
@@ -96,8 +96,8 @@ protected Map<String, List<String>> 
getPartitionToReplacedFileIds(HoodieWriteMet
   }
 
   protected List<String> getAllExistingFileIds(String partitionPath) {
-    // because new commit is not complete. it is safe to mark all existing 
file Ids as old files
-    return 
table.getSliceView().getLatestFileSlices(partitionPath).map(FileSlice::getFileId).distinct().collect(Collectors.toList());
+    // we should only fetch the latest merged file slices with committed data
+    return 
table.getSliceView().getLatestMergedFileSlicesBeforeOrOn(partitionPath, 
instantTime).filter(slice -> 
!slice.isEmpty()).map(FileSlice::getFileId).distinct().collect(Collectors.toList());

Review Comment:
   In which case the file slice is empty?



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