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 @@ -1109,6 +1109,22 @@ public void testAddFilesPartitionedWithParallelism() {
sql("SELECT id, name, dept, subdept FROM %s ORDER BY id", tableName));
}

@TestTemplate
public void testAddFilesWithInvalidParallelism() {
createUnpartitionedHiveTable();

createIcebergTable(
"id Integer, name String, dept String, subdept String", "PARTITIONED BY (id)");

assertThatThrownBy(
() ->
sql(
"CALL %s.system.add_files(table => '%s', source_table => '%s', parallelism => -1)",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Testing with the boundary value 0 is more natural. I know testMigrateWithInvalidParallelism uses -1, though.

catalogName, tableName, sourceTableName))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Parallelism should be larger than 0");
}

@TestTemplate
public void testAddFilesToTableWithManySpecs() {
createPartitionedHiveTable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public InternalRow[] call(InternalRow args) {
boolean checkDuplicateFiles = input.asBoolean(CHECK_DUPLICATE_FILES_PARAM, true);

int parallelism = input.asInt(PARALLELISM, 1);
Preconditions.checkArgument(parallelism > 0, "Parallelism should be larger than 0");

return importToIceberg(
tableIdent, sourceIdent, partitionFilter, checkDuplicateFiles, parallelism);
Expand Down