rajarshisarkar commented on a change in pull request #4433:
URL: https://github.com/apache/iceberg/pull/4433#discussion_r839490564



##########
File path: core/src/main/java/org/apache/iceberg/actions/BinPackStrategy.java
##########
@@ -140,28 +149,39 @@ public RewriteStrategy options(Map<String, String> 
options) {
         DELETE_FILE_THRESHOLD,
         DELETE_FILE_THRESHOLD_DEFAULT);
 
+    rewriteAll = PropertyUtil.propertyAsBoolean(options,
+        REWRITE_ALL,
+        REWRITE_ALL_DEFAULT);
+
     validateOptions();
     return this;
   }
 
   @Override
   public Iterable<FileScanTask> selectFilesToRewrite(Iterable<FileScanTask> 
dataFiles) {
-    return FluentIterable.from(dataFiles)
-        .filter(scanTask -> scanTask.length() < minFileSize || 
scanTask.length() > maxFileSize ||
-                taskHasTooManyDeletes(scanTask));
+    if (rewriteAll) {
+      return dataFiles;
+    } else {
+      return FluentIterable.from(dataFiles)
+          .filter(scanTask -> scanTask.length() < minFileSize || 
scanTask.length() > maxFileSize ||
+              taskHasTooManyDeletes(scanTask));
+    }
   }
 
   @Override
   public Iterable<List<FileScanTask>> planFileGroups(Iterable<FileScanTask> 
dataFiles) {
     ListPacker<FileScanTask> packer = new 
BinPacking.ListPacker<>(maxGroupSize, 1, false);
     List<List<FileScanTask>> potentialGroups = packer.pack(dataFiles, 
FileScanTask::length);
-
-    return potentialGroups.stream().filter(group ->
-            (group.size() >= minInputFiles && group.size() > 1) ||
-                (sizeOfInputFiles(group) > targetFileSize && group.size() > 1) 
||
-                sizeOfInputFiles(group) > maxFileSize ||
-                group.stream().anyMatch(this::taskHasTooManyDeletes)
-    ).collect(Collectors.toList());
+    if (rewriteAll) {
+      return potentialGroups;

Review comment:
       Thanks, I have made the changes.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to