RussellSpitzer commented on code in PR #12824:
URL: https://github.com/apache/iceberg/pull/12824#discussion_r2059254400
##########
spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/actions/TestRewriteDataFilesAction.java:
##########
@@ -2011,6 +2011,40 @@ public void testZOrderRewriteWithSpecificOutputSpecId() {
shouldRewriteDataFilesWithPartitionSpec(table, outputSpecId);
}
+ @TestTemplate
+ public void testRewriteMaxFilesOption() {
+ Table table = createTablePartitioned(5, 4);
+ shouldHaveFiles(table, 20);
+ int desiredMaxFileCount = 5000;
+ Result result =
+ actions()
+ .rewriteDataFiles(table)
+ .option(RewriteDataFiles.MAX_FILES_TO_REWRITE,
String.valueOf(desiredMaxFileCount))
+ .execute();
+ table.refresh();
+ int filesReWritten = result.rewrittenDataFilesCount();
+ assertThat(filesReWritten).isLessThanOrEqualTo(desiredMaxFileCount);
+ }
+
+ @TestTemplate
+ public void testRewriteMaxFilesOptionEquality() {
+ Table table = createTablePartitioned(5, 4);
+ writeRecords(1, SCALE, 1);
+ writeRecords(2, SCALE, 2);
+ writeRecords(3, SCALE, 3);
+ writeRecords(4, SCALE, 4);
+ shouldHaveFiles(table, 50);
+ int desiredMaxFileCount = 10;
+ Result result =
+ actions()
+ .rewriteDataFiles(table)
+ .option(RewriteDataFiles.MAX_FILES_TO_REWRITE, "10")
+ .execute();
+ table.refresh();
+ int filesReWritten = result.rewrittenDataFilesCount();
+ assertThat(filesReWritten).isEqualTo(desiredMaxFileCount);
+ }
+
Review Comment:
I would add one test to our validation test (somewhere in this file) to test
that a - or 0 value for the new param errors out as expected
--
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]