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 @@ -345,18 +345,14 @@ public WriteFiles<UserT, DestinationT, OutputT> withNumShards(
* </tr>
* </table>
*
* <p>Note that value provided here cannot exceed the default value ({@link
* #DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE}).
* <p>The default value is {@link #DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE}.
*/
public WriteFiles<UserT, DestinationT, OutputT> withMaxNumWritersPerBundle(
int maxNumWritersPerBundle) {
checkArgument(
getMaxNumWritersPerBundle() != -1,
"Cannot use withMaxNumWritersPerBundle() after withNoSpilling() has been set.");
checkArgument(
maxNumWritersPerBundle > 0 && maxNumWritersPerBundle <= DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE,
"maxNumWritersPerBundle must be greater than 0 and less than or equal to %s",
DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE);
checkArgument(maxNumWritersPerBundle > 0, "maxNumWritersPerBundle must be greater than 0");
return toBuilder().setMaxNumWritersPerBundle(maxNumWritersPerBundle).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ public void testBuildWrite() {
assertTrue(write.withEvictWritersWhenFull().getEvictWritersWhenFull());
assertTrue(write.withEvictWritersWhenFull(true).getEvictWritersWhenFull());
assertFalse(write.withEvictWritersWhenFull(false).getEvictWritersWhenFull());
assertEquals(50, write.withMaxNumWritersPerBundle(50).getMaxNumWritersPerBundle());
assertThrows(IllegalArgumentException.class, () -> write.withMaxNumWritersPerBundle(0));
}

@Test
Expand Down
Loading