singhpk234 commented on a change in pull request #3676:
URL: https://github.com/apache/iceberg/pull/3676#discussion_r827356760
##########
File path:
core/src/test/java/org/apache/iceberg/actions/TestBinPackStrategy.java
##########
@@ -138,6 +138,43 @@ public void testGroupingMinInputFilesInvalid() {
0, Iterables.size(grouped));
}
+ @Test
+ public void testGroupingMinInputFilesAsOne() {
+ RewriteStrategy strategy = defaultBinPack().options(ImmutableMap.of(
+ BinPackStrategy.MIN_INPUT_FILES, Integer.toString(1),
+ BinPackStrategy.MAX_FILE_SIZE_BYTES, Long.toString(3 * MB),
+ RewriteDataFiles.TARGET_FILE_SIZE_BYTES, Long.toString(2 * MB),
+ BinPackStrategy.MIN_FILE_SIZE_BYTES, Long.toString(MB),
+ BinPackStrategy.DELETE_FILE_THRESHOLD, Integer.toString(2)
+ ));
+
+ // single file within a group, with size within threshold and no deletes
should be considered as NOOP.
+ Iterable<FileScanTask> testFiles1 = filesOfSize(1);
+ Iterable<List<FileScanTask>> grouped1 =
strategy.planFileGroups(testFiles1);
+
+ Assert.assertEquals("Should plan 0 group, as 1 minInputFile with size
within threshold and no deletes should be " +
+ "treated as NOOP",
+ 0, Iterables.size(grouped1));
+
+ // group with single file with size > targetFileSize should not be planed
+ Iterable<FileScanTask> testFiles2 = filesOfSize(1);
+ Iterable<List<FileScanTask>> grouped2 =
strategy.planFileGroups(testFiles2);
Review comment:
Thanks, you are correct these two are exactly the same .
Added test case where
- multiple files less than target file size and less than minInputFiles will
not be planned
- multiple files greater than target file size and less than minInputFiles
will be planned
##########
File path:
core/src/test/java/org/apache/iceberg/actions/TestBinPackStrategy.java
##########
@@ -138,6 +138,43 @@ public void testGroupingMinInputFilesInvalid() {
0, Iterables.size(grouped));
}
+ @Test
+ public void testGroupingMinInputFilesAsOne() {
+ RewriteStrategy strategy = defaultBinPack().options(ImmutableMap.of(
+ BinPackStrategy.MIN_INPUT_FILES, Integer.toString(1),
+ BinPackStrategy.MAX_FILE_SIZE_BYTES, Long.toString(3 * MB),
+ RewriteDataFiles.TARGET_FILE_SIZE_BYTES, Long.toString(2 * MB),
+ BinPackStrategy.MIN_FILE_SIZE_BYTES, Long.toString(MB),
+ BinPackStrategy.DELETE_FILE_THRESHOLD, Integer.toString(2)
+ ));
+
+ // single file within a group, with size within threshold and no deletes
should be considered as NOOP.
+ Iterable<FileScanTask> testFiles1 = filesOfSize(1);
+ Iterable<List<FileScanTask>> grouped1 =
strategy.planFileGroups(testFiles1);
+
+ Assert.assertEquals("Should plan 0 group, as 1 minInputFile with size
within threshold and no deletes should be " +
+ "treated as NOOP",
+ 0, Iterables.size(grouped1));
+
+ // group with single file with size > targetFileSize should not be planed
+ Iterable<FileScanTask> testFiles2 = filesOfSize(1);
+ Iterable<List<FileScanTask>> grouped2 =
strategy.planFileGroups(testFiles2);
Review comment:
Thanks, you are correct these two are exactly the same
Added test case where
- multiple files less than target file size and less than minInputFiles will
not be planned
- multiple files greater than target file size and less than minInputFiles
will be planned
--
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]