You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/12/01 10:05:06 UTC

[GitHub] [iceberg] openinx commented on a change in pull request #1704: Fix Repeated Rewrite for RewriteDataFilesAction

openinx commented on a change in pull request #1704:
URL: https://github.com/apache/iceberg/pull/1704#discussion_r533263788



##########
File path: core/src/main/java/org/apache/iceberg/actions/BaseRewriteDataFilesAction.java
##########
@@ -226,11 +226,16 @@ public RewriteDataFilesActionResult execute() {
           return TableScanUtil.planTasks(splitTasks, targetSizeInBytes, splitLookback, splitOpenFileCost);
         })
         .flatMap(Streams::stream)
+        .filter(task -> task.files().size() > 1)
         .collect(Collectors.toList());
 
+    if (combinedScanTasks.isEmpty()) {
+      return RewriteDataFilesActionResult.empty();
+    }
+
     List<DataFile> addedDataFiles = rewriteDataForTasks(combinedScanTasks);
-    List<DataFile> currentDataFiles = filteredGroupedTasks.values().stream()
-        .flatMap(tasks -> tasks.stream().map(FileScanTask::file))
+    List<DataFile> currentDataFiles = combinedScanTasks.stream()

Review comment:
       I think we should not rely on specific file-selection strategies here, because different selection strategies  may result in duplicated files for `currentDataFiles`.  The correct way is:  remove the duplicated files so that the `currentDataFiles` has correct files.
   
   I saw the [here](https://github.com/apache/iceberg/pull/1704/files#diff-a330da6f6014d3154bb0979281e53f2b69c9e32117d0223bdf94d514a05cf559R264) has used the `set` to remove duplicated files.  So it's OK now.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org