kbuci commented on code in PR #18016:
URL: https://github.com/apache/hudi/pull/18016#discussion_r2886801840


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java:
##########
@@ -241,6 +243,21 @@ private Stream<String> 
getPartitionsForInstants(HoodieInstant instant) {
       } else {
         HoodieCommitMetadata commitMetadata =
             hoodieTable.getActiveTimeline().readCommitMetadata(instant);
+        WriteOperationType operationType = commitMetadata.getOperationType();
+        if (WriteOperationType.isUpsert(operationType) || 
WriteOperationType.isInsertWithoutReplace(operationType)) {
+          // Make sure we only filter for operatiions that can potentially 
create new file groups from new records
+          // This is a safeguard in case future types of operations (that 
aren't writes) use COMMIT_ACTION type
+          if (HoodieTimeline.COMMIT_ACTION.equals(instant.getAction()) && 
hoodieTable.getMetaClient().getTableType().equals(
+              HoodieTableType.COPY_ON_WRITE)) {
+            // For COW only check partitions where the write updated a file 
slice (leaving behind an older version of the file slice to clean)
+            // Since some partitions may have only had new file slices created 
(not leaving behind anything to clean yet)
+            return 
commitMetadata.getWritePartitionPathsWithUpdatedFileGroups().stream();
+          }
+          // For MOR, small file handling during inserts can cause 
deltacommits to create new base files (file slices) in existing file groups,

Review Comment:
   Context : https://github.com/apache/hudi/pull/18016#discussion_r2886782962 



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