Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public abstract class BinPackStrategy implements RewriteStrategy {
* <p>
* Defaults to Integer.MAX_VALUE, which means this feature is not enabled by default.
*/
public static final String MIN_DELETES_PER_FILE = "min-deletes-per-file";
public static final int MIN_DELETES_PER_FILE_DEFAULT = Integer.MAX_VALUE;
public static final String DELETE_FILE_THRESHOLD = "delete-file-threshold";
public static final int DELETE_FILE_THRESHOLD_DEFAULT = Integer.MAX_VALUE;

private int minInputFiles;
private int minDeletesPerFile;
Expand All @@ -103,7 +103,7 @@ public String name() {
public Set<String> validOptions() {
return ImmutableSet.of(
MIN_INPUT_FILES,
MIN_DELETES_PER_FILE,
DELETE_FILE_THRESHOLD,
MIN_FILE_SIZE_BYTES,
MAX_FILE_SIZE_BYTES
);
Expand Down Expand Up @@ -135,8 +135,8 @@ public RewriteStrategy options(Map<String, String> options) {
MIN_INPUT_FILES_DEFAULT);

minDeletesPerFile = PropertyUtil.propertyAsInt(options,
MIN_DELETES_PER_FILE,
MIN_DELETES_PER_FILE_DEFAULT);
DELETE_FILE_THRESHOLD,
DELETE_FILE_THRESHOLD_DEFAULT);

validateOptions();
return this;
Expand Down Expand Up @@ -265,6 +265,6 @@ private void validateOptions() {

Preconditions.checkArgument(minDeletesPerFile > 0,
"Cannot set %s is less than 1. All values less than 1 have the same effect as 1. %d < 1",
MIN_DELETES_PER_FILE, minDeletesPerFile);
DELETE_FILE_THRESHOLD, minDeletesPerFile);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void testFilteringWithDeletes() {
RewriteStrategy strategy = defaultBinPack().options(ImmutableMap.of(
BinPackStrategy.MAX_FILE_SIZE_BYTES, Long.toString(550 * MB),
BinPackStrategy.MIN_FILE_SIZE_BYTES, Long.toString(490 * MB),
BinPackStrategy.MIN_DELETES_PER_FILE, Integer.toString(2)
BinPackStrategy.DELETE_FILE_THRESHOLD, Integer.toString(2)
));

List<FileScanTask> testFiles = filesOfSize(500, 500, 480, 480, 560, 520);
Expand Down Expand Up @@ -173,7 +173,7 @@ public void testGroupingWithDeletes() {
BinPackStrategy.MIN_INPUT_FILES, Integer.toString(5),
BinPackStrategy.MAX_FILE_SIZE_BYTES, Long.toString(550 * MB),
BinPackStrategy.MIN_FILE_SIZE_BYTES, Long.toString(490 * MB),
BinPackStrategy.MIN_DELETES_PER_FILE, Integer.toString(2)
BinPackStrategy.DELETE_FILE_THRESHOLD, Integer.toString(2)
));

List<FileScanTask> testFiles = Lists.newArrayList();
Expand Down Expand Up @@ -239,7 +239,7 @@ public void testInvalidOptions() {
AssertHelpers.assertThrows("Should not allow min deletes per file smaller than 1",
IllegalArgumentException.class, () -> {
defaultBinPack().options(ImmutableMap.of(
BinPackStrategy.MIN_DELETES_PER_FILE, Long.toString(-5)));
BinPackStrategy.DELETE_FILE_THRESHOLD, Long.toString(-5)));
});

AssertHelpers.assertThrows("Should not allow negative target size",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public void testBinPackWithDeletes() throws Exception {
.option(BinPackStrategy.MIN_FILE_SIZE_BYTES, "0")
.option(RewriteDataFiles.TARGET_FILE_SIZE_BYTES, Long.toString(Long.MAX_VALUE - 1))
.option(BinPackStrategy.MAX_FILE_SIZE_BYTES, Long.toString(Long.MAX_VALUE))
.option(BinPackStrategy.MIN_DELETES_PER_FILE, "4")
.option(BinPackStrategy.DELETE_FILE_THRESHOLD, "4")
.execute();
Assert.assertEquals("Action should rewrite 4 data files", 4, result.rewrittenDataFilesCount());

Expand Down