Skip to content
Merged
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 @@ -85,6 +85,7 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.Iterables.getOnlyElement;
Expand Down Expand Up @@ -1188,7 +1189,7 @@ public void testNestedFieldPartitioning()
assertThat(loadTable(tableName).newScan().planFiles()).hasSize(4);

assertUpdate("ALTER TABLE " + tableName + " SET PROPERTIES partitioning = ARRAY['\"state.name\"', '\"district.name\"']");
Table icebergTable = updateTableToV2(tableName);
Table icebergTable = loadTable(tableName);
assertThat(icebergTable.spec().fields().stream().map(PartitionField::name).toList())
.containsExactlyInAnyOrder("state.name", "district.name");

Expand Down Expand Up @@ -1246,7 +1247,7 @@ public void testHighlyNestedFieldPartitioning()
assertThat(loadTable(tableName).newScan().planFiles()).hasSize(2);

assertUpdate("ALTER TABLE " + tableName + " SET PROPERTIES partitioning = ARRAY['\"country.state.district.name\"', '\"country.state.name\"']");
Table icebergTable = updateTableToV2(tableName);
Table icebergTable = loadTable(tableName);
assertThat(icebergTable.spec().fields().stream().map(PartitionField::name).toList())
.containsExactlyInAnyOrder("country.state.district.name", "country.state.name");

Expand Down Expand Up @@ -1537,6 +1538,7 @@ private Table updateTableToV2(String tableName)
BaseTable table = loadTable(tableName);
TableOperations operations = table.operations();
TableMetadata currentMetadata = operations.current();
checkArgument(currentMetadata.formatVersion() != 2, "Format version is already 2: '%s'", tableName);
operations.commit(currentMetadata, currentMetadata.upgradeToFormatVersion(2));

return table;
Expand Down