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 2022/03/14 12:31:35 UTC
[GitHub] [iceberg] rajarshisarkar commented on a change in pull request #3676: Core : Dont consider groups for compaction if they have a single file…
rajarshisarkar commented on a change in pull request #3676:
URL: https://github.com/apache/iceberg/pull/3676#discussion_r825888334
##########
File path: core/src/main/java/org/apache/iceberg/actions/BinPackStrategy.java
##########
@@ -155,9 +155,12 @@ public RewriteStrategy options(Map<String, String> options) {
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 || sizeOfInputFiles(group) > targetFileSize ||
- group.stream().anyMatch(this::taskHasTooManyDeletes)
+ (group.size() >= minInputFiles && group.size() > 1) ||
+ sizeOfInputFiles(group) > targetFileSize ||
+ group.stream().anyMatch(this::taskHasTooManyDeletes) ||
+ (group.stream().anyMatch(this::taskHasDeletes) && group.size() == 1)
Review comment:
In a file group, shouldn't we rewrite a single file if it is very large?
##########
File path: core/src/main/java/org/apache/iceberg/actions/BinPackStrategy.java
##########
@@ -245,6 +248,10 @@ private boolean taskHasTooManyDeletes(FileScanTask task) {
return task.deletes() != null && task.deletes().size() >= deleteFileThreshold;
}
+ private boolean taskHasDeletes(FileScanTask task) {
+ return task.deletes() != null && task.deletes().size() >= 1;
Review comment:
You can use `return task.deletes() != null && !task.deletes().isEmpty();`
##########
File path: core/src/main/java/org/apache/iceberg/actions/BinPackStrategy.java
##########
@@ -245,6 +248,10 @@ private boolean taskHasTooManyDeletes(FileScanTask task) {
return task.deletes() != null && task.deletes().size() >= deleteFileThreshold;
}
+ private boolean taskHasDeletes(FileScanTask task) {
+ return task.deletes() != null && task.deletes().size() >= 1;
Review comment:
You can use `return task.deletes() != null && !task.deletes().isEmpty();`
--
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: issues-unsubscribe@iceberg.apache.org
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