diff --git a/api/src/main/java/org/apache/iceberg/PartitionSpec.java b/api/src/main/java/org/apache/iceberg/PartitionSpec.java index 0c29edea364f..3edb5e992d21 100644 --- a/api/src/main/java/org/apache/iceberg/PartitionSpec.java +++ b/api/src/main/java/org/apache/iceberg/PartitionSpec.java @@ -49,8 +49,8 @@ * represented by a named {@link PartitionField}. */ public class PartitionSpec implements Serializable { - // IDs for partition fields start at 1000 - private static final int PARTITION_DATA_ID_START = 1000; + // IDs for partition fields start at 10000 + private static final int PARTITION_DATA_ID_START = 10000; private final Schema schema; @@ -575,8 +575,8 @@ static void checkCompatibility(PartitionSpec spec, Schema schema) { } static boolean hasSequentialIds(PartitionSpec spec) { - for (int i = 0; i < spec.fields.length; i += 1) { - if (spec.fields[i].fieldId() != PARTITION_DATA_ID_START + i) { + for (int i = 1; i < spec.fields.length; i += 1) { + if (spec.fields[i].fieldId() != spec.fields[i - 1].fieldId() + 1) { return false; } } diff --git a/api/src/test/java/org/apache/iceberg/TestPartitionSpecValidation.java b/api/src/test/java/org/apache/iceberg/TestPartitionSpecValidation.java index eb0e74164688..5d52c6b3e010 100644 --- a/api/src/test/java/org/apache/iceberg/TestPartitionSpecValidation.java +++ b/api/src/test/java/org/apache/iceberg/TestPartitionSpecValidation.java @@ -297,26 +297,26 @@ public void testAutoSettingPartitionFieldIds() { .truncate("s", 1, "custom_truncate") .build(); - assertThat(spec.fields().get(0).fieldId()).isEqualTo(1000); - assertThat(spec.fields().get(1).fieldId()).isEqualTo(1001); - assertThat(spec.fields().get(2).fieldId()).isEqualTo(1002); - assertThat(spec.fields().get(3).fieldId()).isEqualTo(1003); - assertThat(spec.lastAssignedFieldId()).isEqualTo(1003); + assertThat(spec.fields().get(0).fieldId()).isEqualTo(10000); + assertThat(spec.fields().get(1).fieldId()).isEqualTo(10001); + assertThat(spec.fields().get(2).fieldId()).isEqualTo(10002); + assertThat(spec.fields().get(3).fieldId()).isEqualTo(10003); + assertThat(spec.lastAssignedFieldId()).isEqualTo(10003); } @Test public void testAddPartitionFieldsWithFieldIds() { PartitionSpec spec = PartitionSpec.builderFor(SCHEMA) - .add(1, 1005, "id_partition1", Transforms.bucket(4)) - .add(1, 1006, "id_partition2", Transforms.bucket(5)) - .add(1, 1002, "id_partition3", Transforms.bucket(6)) + .add(1, 10005, "id_partition1", Transforms.bucket(4)) + .add(1, 10006, "id_partition2", Transforms.bucket(5)) + .add(1, 10002, "id_partition3", Transforms.bucket(6)) .build(); - assertThat(spec.fields().get(0).fieldId()).isEqualTo(1005); - assertThat(spec.fields().get(1).fieldId()).isEqualTo(1006); - assertThat(spec.fields().get(2).fieldId()).isEqualTo(1002); - assertThat(spec.lastAssignedFieldId()).isEqualTo(1006); + assertThat(spec.fields().get(0).fieldId()).isEqualTo(10005); + assertThat(spec.fields().get(1).fieldId()).isEqualTo(10006); + assertThat(spec.fields().get(2).fieldId()).isEqualTo(10002); + assertThat(spec.lastAssignedFieldId()).isEqualTo(10006); } @Test @@ -324,13 +324,13 @@ public void testAddPartitionFieldsWithAndWithoutFieldIds() { PartitionSpec spec = PartitionSpec.builderFor(SCHEMA) .add(1, "id_partition2", Transforms.bucket(5)) - .add(1, 1005, "id_partition1", Transforms.bucket(4)) + .add(1, 10005, "id_partition1", Transforms.bucket(4)) .truncate("s", 1, "custom_truncate") .build(); - assertThat(spec.fields().get(0).fieldId()).isEqualTo(1000); - assertThat(spec.fields().get(1).fieldId()).isEqualTo(1005); - assertThat(spec.fields().get(2).fieldId()).isEqualTo(1006); - assertThat(spec.lastAssignedFieldId()).isEqualTo(1006); + assertThat(spec.fields().get(0).fieldId()).isEqualTo(10000); + assertThat(spec.fields().get(1).fieldId()).isEqualTo(10005); + assertThat(spec.fields().get(2).fieldId()).isEqualTo(10006); + assertThat(spec.lastAssignedFieldId()).isEqualTo(10006); } } diff --git a/core/src/test/java/org/apache/iceberg/TestContentFileParser.java b/core/src/test/java/org/apache/iceberg/TestContentFileParser.java index 4fda388159ec..e2ecfab02a4e 100644 --- a/core/src/test/java/org/apache/iceberg/TestContentFileParser.java +++ b/core/src/test/java/org/apache/iceberg/TestContentFileParser.java @@ -126,7 +126,7 @@ private static String dataFileJsonWithRequiredOnly(PartitionSpec spec) { + "\"partition\":{},\"file-size-in-bytes\":10,\"record-count\":1,\"sort-order-id\":0}"; } else { return "{\"spec-id\":0,\"content\":\"DATA\",\"file-path\":\"/path/to/data-a.parquet\",\"file-format\":\"PARQUET\"," - + "\"partition\":{\"1000\":1},\"file-size-in-bytes\":10,\"record-count\":1,\"sort-order-id\":0}"; + + "\"partition\":{\"10000\":1},\"file-size-in-bytes\":10,\"record-count\":1,\"sort-order-id\":0}"; } } @@ -144,7 +144,7 @@ private static String dataFileJsonWithAllOptional(PartitionSpec spec) { + "\"split-offsets\":[128,256],\"sort-order-id\":1}"; } else { return "{\"spec-id\":0,\"content\":\"DATA\",\"file-path\":\"/path/to/data-with-stats.parquet\"," - + "\"file-format\":\"PARQUET\",\"partition\":{\"1000\":1},\"file-size-in-bytes\":350,\"record-count\":10," + + "\"file-format\":\"PARQUET\",\"partition\":{\"10000\":1},\"file-size-in-bytes\":350,\"record-count\":10," + "\"column-sizes\":{\"keys\":[3,4],\"values\":[100,200]}," + "\"value-counts\":{\"keys\":[3,4],\"values\":[90,180]}," + "\"null-value-counts\":{\"keys\":[3,4],\"values\":[10,20]}," @@ -281,7 +281,7 @@ private static String deleteFileJsonWithRequiredOnly(PartitionSpec spec) { + "\"file-format\":\"PARQUET\",\"partition\":{},\"file-size-in-bytes\":1234,\"record-count\":9}"; } else { return "{\"spec-id\":0,\"content\":\"POSITION_DELETES\",\"file-path\":\"/path/to/delete-a.parquet\"," - + "\"file-format\":\"PARQUET\",\"partition\":{\"1000\":9},\"file-size-in-bytes\":1234,\"record-count\":9}"; + + "\"file-format\":\"PARQUET\",\"partition\":{\"10000\":9},\"file-size-in-bytes\":1234,\"record-count\":9}"; } } @@ -299,7 +299,7 @@ private static String deleteFileJsonWithAllOptional(PartitionSpec spec) { + "\"split-offsets\":[128],\"equality-ids\":[3],\"sort-order-id\":1}"; } else { return "{\"spec-id\":0,\"content\":\"EQUALITY_DELETES\",\"file-path\":\"/path/to/delete-with-stats.parquet\"," - + "\"file-format\":\"PARQUET\",\"partition\":{\"1000\":9},\"file-size-in-bytes\":1234,\"record-count\":10," + + "\"file-format\":\"PARQUET\",\"partition\":{\"10000\":9},\"file-size-in-bytes\":1234,\"record-count\":10," + "\"column-sizes\":{\"keys\":[3,4],\"values\":[100,200]}," + "\"value-counts\":{\"keys\":[3,4],\"values\":[90,180]}," + "\"null-value-counts\":{\"keys\":[3,4],\"values\":[10,20]}," diff --git a/core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java b/core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java index 42785c7a778e..46d827397e75 100644 --- a/core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java +++ b/core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java @@ -70,16 +70,16 @@ private String expectedFileScanTaskJson() { + "{\"id\":3,\"name\":\"id\",\"required\":true,\"type\":\"int\"}," + "{\"id\":4,\"name\":\"data\",\"required\":true,\"type\":\"string\"}]}," + "\"spec\":{\"spec-id\":0,\"fields\":[{\"name\":\"data_bucket\"," - + "\"transform\":\"bucket[16]\",\"source-id\":4,\"field-id\":1000}]}," + + "\"transform\":\"bucket[16]\",\"source-id\":4,\"field-id\":10000}]}," + "\"data-file\":{\"spec-id\":0,\"content\":\"DATA\",\"file-path\":\"/path/to/data-a.parquet\"," - + "\"file-format\":\"PARQUET\",\"partition\":{\"1000\":0}," + + "\"file-format\":\"PARQUET\",\"partition\":{\"10000\":0}," + "\"file-size-in-bytes\":10,\"record-count\":1,\"sort-order-id\":0}," + "\"start\":0,\"length\":10," + "\"delete-files\":[{\"spec-id\":0,\"content\":\"POSITION_DELETES\"," + "\"file-path\":\"/path/to/data-a-deletes.parquet\",\"file-format\":\"PARQUET\"," - + "\"partition\":{\"1000\":0},\"file-size-in-bytes\":10,\"record-count\":1}," + + "\"partition\":{\"10000\":0},\"file-size-in-bytes\":10,\"record-count\":1}," + "{\"spec-id\":0,\"content\":\"EQUALITY_DELETES\",\"file-path\":\"/path/to/data-a2-deletes.parquet\"," - + "\"file-format\":\"PARQUET\",\"partition\":{\"1000\":0},\"file-size-in-bytes\":10," + + "\"file-format\":\"PARQUET\",\"partition\":{\"10000\":0},\"file-size-in-bytes\":10," + "\"record-count\":1,\"equality-ids\":[1],\"sort-order-id\":0}]," + "\"residual-filter\":{\"type\":\"eq\",\"term\":\"id\",\"value\":1}}"; } diff --git a/core/src/test/java/org/apache/iceberg/TestManifestReader.java b/core/src/test/java/org/apache/iceberg/TestManifestReader.java index 44b09081d7a3..99c1d1d7c0be 100644 --- a/core/src/test/java/org/apache/iceberg/TestManifestReader.java +++ b/core/src/test/java/org/apache/iceberg/TestManifestReader.java @@ -88,7 +88,7 @@ public void testManifestReaderWithPartitionMetadata() throws IOException { List fields = ((PartitionData) entry.file().partition()).getPartitionType().fields(); assertThat(fields).hasSize(1); - assertThat(fields.get(0).fieldId()).isEqualTo(1000); + assertThat(fields.get(0).fieldId()).isEqualTo(10000); assertThat(fields.get(0).name()).isEqualTo("data_bucket"); assertThat(fields.get(0).type()).isEqualTo(Types.IntegerType.get()); } @@ -108,11 +108,11 @@ public void testManifestReaderWithUpdatedPartitionMetadataForV1Table() throws IO List fields = ((PartitionData) entry.file().partition()).getPartitionType().fields(); assertThat(fields).hasSize(2); - assertThat(fields.get(0).fieldId()).isEqualTo(1000); + assertThat(fields.get(0).fieldId()).isEqualTo(10000); assertThat(fields.get(0).name()).isEqualTo("id_bucket"); assertThat(fields.get(0).type()).isEqualTo(Types.IntegerType.get()); - assertThat(fields.get(1).fieldId()).isEqualTo(1001); + assertThat(fields.get(1).fieldId()).isEqualTo(10001); assertThat(fields.get(1).name()).isEqualTo("data_bucket"); assertThat(fields.get(1).type()).isEqualTo(Types.IntegerType.get()); } diff --git a/core/src/test/java/org/apache/iceberg/TestMergeAppend.java b/core/src/test/java/org/apache/iceberg/TestMergeAppend.java index 39c9ac4b6c21..bcd0c7ac2644 100644 --- a/core/src/test/java/org/apache/iceberg/TestMergeAppend.java +++ b/core/src/test/java/org/apache/iceberg/TestMergeAppend.java @@ -1277,28 +1277,28 @@ public void testUpdatePartitionSpecFieldIdsForV1Table() { List partitionSpecs = table.ops().current().specs(); PartitionSpec partitionSpec = partitionSpecs.get(0); - Assert.assertEquals(1000, partitionSpec.lastAssignedFieldId()); + Assert.assertEquals(10000, partitionSpec.lastAssignedFieldId()); Types.StructType structType = partitionSpec.partitionType(); List fields = structType.fields(); Assert.assertEquals(1, fields.size()); Assert.assertEquals("data_bucket", fields.get(0).name()); - Assert.assertEquals(1000, fields.get(0).fieldId()); + Assert.assertEquals(10000, fields.get(0).fieldId()); partitionSpec = partitionSpecs.get(1); - Assert.assertEquals(1003, partitionSpec.lastAssignedFieldId()); + Assert.assertEquals(10003, partitionSpec.lastAssignedFieldId()); structType = partitionSpec.partitionType(); fields = structType.fields(); Assert.assertEquals(4, fields.size()); Assert.assertEquals("id_bucket", fields.get(0).name()); - Assert.assertEquals(1000, fields.get(0).fieldId()); + Assert.assertEquals(10000, fields.get(0).fieldId()); Assert.assertEquals("data", fields.get(1).name()); - Assert.assertEquals(1001, fields.get(1).fieldId()); + Assert.assertEquals(10001, fields.get(1).fieldId()); Assert.assertEquals("data_bucket", fields.get(2).name()); - Assert.assertEquals(1002, fields.get(2).fieldId()); + Assert.assertEquals(10002, fields.get(2).fieldId()); Assert.assertEquals("data_partition", fields.get(3).name()); - Assert.assertEquals(1003, fields.get(3).fieldId()); + Assert.assertEquals(10003, fields.get(3).fieldId()); } @Test @@ -1375,10 +1375,10 @@ public void testManifestEntryFieldIdsForChangedPartitionSpecForV1Table() { .next(); Types.NestedField field = ((PartitionData) entry.file().partition()).getPartitionType().fields().get(0); - Assert.assertEquals(1000, field.fieldId()); + Assert.assertEquals(10000, field.fieldId()); Assert.assertEquals("id_bucket", field.name()); field = ((PartitionData) entry.file().partition()).getPartitionType().fields().get(1); - Assert.assertEquals(1001, field.fieldId()); + Assert.assertEquals(10001, field.fieldId()); Assert.assertEquals("data_bucket", field.name()); entry = @@ -1387,7 +1387,7 @@ public void testManifestEntryFieldIdsForChangedPartitionSpecForV1Table() { .iterator() .next(); field = ((PartitionData) entry.file().partition()).getPartitionType().fields().get(0); - Assert.assertEquals(1000, field.fieldId()); + Assert.assertEquals(10000, field.fieldId()); Assert.assertEquals("data_bucket", field.name()); } diff --git a/core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java b/core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java index 4c5f1d240f57..1e4aeb11ed50 100644 --- a/core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java +++ b/core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java @@ -351,7 +351,7 @@ public void testPartitionsTableScanNoFilter() { required( 1, "partition", - Types.StructType.of(optional(1000, "data_bucket", Types.IntegerType.get())))) + Types.StructType.of(optional(10000, "data_bucket", Types.IntegerType.get())))) .asStruct(); TableScan scanNoFilter = partitionsTable.newScan().select("partition.data_bucket"); assertThat(scanNoFilter.schema().asStruct()).isEqualTo(expected); @@ -573,11 +573,11 @@ public void testFilesTableScanWithDroppedPartition() throws IOException { Types.StructType actualType = schema.findField(DataFile.PARTITION_ID).type().asStructType(); Types.StructType expectedType = Types.StructType.of( - Types.NestedField.optional(1000, "data_bucket", Types.IntegerType.get()), - Types.NestedField.optional(1001, "data_bucket_16", Types.IntegerType.get()), - Types.NestedField.optional(1002, "data_trunc_2", Types.StringType.get())); + Types.NestedField.optional(10000, "data_bucket", Types.IntegerType.get()), + Types.NestedField.optional(10001, "data_bucket_16", Types.IntegerType.get()), + Types.NestedField.optional(10002, "data_trunc_2", Types.StringType.get())); assertThat(actualType).as("Partition type must match").isEqualTo(expectedType); - Accessor accessor = schema.accessorForField(1000); + Accessor accessor = schema.accessorForField(10000); try (CloseableIterable tasks = scan.planFiles()) { Set results = diff --git a/core/src/test/java/org/apache/iceberg/TestMetadataTableScansWithPartitionEvolution.java b/core/src/test/java/org/apache/iceberg/TestMetadataTableScansWithPartitionEvolution.java index faccdcb3dd95..e1102fa53b0b 100644 --- a/core/src/test/java/org/apache/iceberg/TestMetadataTableScansWithPartitionEvolution.java +++ b/core/src/test/java/org/apache/iceberg/TestMetadataTableScansWithPartitionEvolution.java @@ -145,8 +145,8 @@ public void testPartitionsTableScanWithAddPartitionOnNestedField() { 1, "partition", Types.StructType.of( - optional(1000, "id", Types.IntegerType.get()), - optional(1001, "nested.id", Types.IntegerType.get())))) + optional(10000, "id", Types.IntegerType.get()), + optional(10001, "nested.id", Types.IntegerType.get())))) .asStruct(); TableScan scanNoFilter = partitionsTable.newScan().select("partition"); diff --git a/core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java b/core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java index 64e01f8cd8ff..dcc523003c93 100644 --- a/core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java +++ b/core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java @@ -180,12 +180,12 @@ public void testAddPartitionSpecFromJsonWithFieldId() { + "\"name\":\"id_bucket\"," + "\"transform\":\"bucket[8]\"," + "\"source-id\":1," - + "\"field-id\":1000" + + "\"field-id\":10000" + "},{" + "\"name\":\"data_bucket\"," + "\"transform\":\"bucket[16]\"," + "\"source-id\":2," - + "\"field-id\":1001" + + "\"field-id\":10001" + "}]" + "}"; @@ -209,8 +209,8 @@ public void testAddPartitionSpecFromJsonWithFieldId() { @Test public void testAddPartitionSpecFromJsonWithoutFieldId() { - // partition field ids are missing in old PartitionSpec, they always auto-increment from 1000 in - // declared order + // partition field ids are missing in old PartitionSpec, they always auto-increment from 10000 + // in declared order String action = MetadataUpdateParser.ADD_PARTITION_SPEC; String specString = "{" @@ -252,12 +252,12 @@ public void testAddPartitionSpecToJson() { + "\"name\":\"id_bucket\"," + "\"transform\":\"bucket[8]\"," + "\"source-id\":1," - + "\"field-id\":1000" + + "\"field-id\":10000" + "},{" + "\"name\":\"data_bucket\"," + "\"transform\":\"bucket[16]\"," + "\"source-id\":2," - + "\"field-id\":1001" + + "\"field-id\":10001" + "}]" + "}"; diff --git a/core/src/test/java/org/apache/iceberg/TestPartitionSpecParser.java b/core/src/test/java/org/apache/iceberg/TestPartitionSpecParser.java index 1d88e97f9925..308965bf5fc1 100644 --- a/core/src/test/java/org/apache/iceberg/TestPartitionSpecParser.java +++ b/core/src/test/java/org/apache/iceberg/TestPartitionSpecParser.java @@ -35,7 +35,7 @@ public void testToJsonForV1Table() { + " \"name\" : \"data_bucket\",\n" + " \"transform\" : \"bucket[16]\",\n" + " \"source-id\" : 2,\n" - + " \"field-id\" : 1000\n" + + " \"field-id\" : 10000\n" + " } ]\n" + "}"; Assert.assertEquals(expected, PartitionSpecParser.toJson(table.spec(), true)); @@ -52,12 +52,12 @@ public void testToJsonForV1Table() { + " \"name\" : \"id_bucket\",\n" + " \"transform\" : \"bucket[8]\",\n" + " \"source-id\" : 1,\n" - + " \"field-id\" : 1000\n" + + " \"field-id\" : 10000\n" + " }, {\n" + " \"name\" : \"data_bucket\",\n" + " \"transform\" : \"bucket[16]\",\n" + " \"source-id\" : 2,\n" - + " \"field-id\" : 1001\n" + + " \"field-id\" : 10001\n" + " } ]\n" + "}"; Assert.assertEquals(expected, PartitionSpecParser.toJson(table.spec(), true)); @@ -72,12 +72,12 @@ public void testFromJsonWithFieldId() { + " \"name\" : \"id_bucket\",\n" + " \"transform\" : \"bucket[8]\",\n" + " \"source-id\" : 1,\n" - + " \"field-id\" : 1001\n" + + " \"field-id\" : 10001\n" + " }, {\n" + " \"name\" : \"data_bucket\",\n" + " \"transform\" : \"bucket[16]\",\n" + " \"source-id\" : 2,\n" - + " \"field-id\" : 1000\n" + + " \"field-id\" : 10000\n" + " } ]\n" + "}"; @@ -85,8 +85,8 @@ public void testFromJsonWithFieldId() { Assert.assertEquals(2, spec.fields().size()); // should be the field ids in the JSON - Assert.assertEquals(1001, spec.fields().get(0).fieldId()); - Assert.assertEquals(1000, spec.fields().get(1).fieldId()); + Assert.assertEquals(10001, spec.fields().get(0).fieldId()); + Assert.assertEquals(10000, spec.fields().get(1).fieldId()); } @Test @@ -109,8 +109,8 @@ public void testFromJsonWithoutFieldId() { Assert.assertEquals(2, spec.fields().size()); // should be the default assignment - Assert.assertEquals(1000, spec.fields().get(0).fieldId()); - Assert.assertEquals(1001, spec.fields().get(1).fieldId()); + Assert.assertEquals(10000, spec.fields().get(0).fieldId()); + Assert.assertEquals(10001, spec.fields().get(1).fieldId()); } @Test diff --git a/core/src/test/java/org/apache/iceberg/TestPartitioning.java b/core/src/test/java/org/apache/iceberg/TestPartitioning.java index 4de62e3cfee3..1899c4ba70f7 100644 --- a/core/src/test/java/org/apache/iceberg/TestPartitioning.java +++ b/core/src/test/java/org/apache/iceberg/TestPartitioning.java @@ -75,8 +75,8 @@ public void testPartitionTypeWithSpecEvolutionInV1Tables() { StructType expectedType = StructType.of( - NestedField.optional(1000, "data", Types.StringType.get()), - NestedField.optional(1001, "category_bucket_8", Types.IntegerType.get())); + NestedField.optional(10000, "data", Types.StringType.get()), + NestedField.optional(10001, "category_bucket_8", Types.IntegerType.get())); StructType actualType = Partitioning.partitionType(table); Assert.assertEquals("Types must match", expectedType, actualType); @@ -97,8 +97,8 @@ public void testPartitionTypeWithSpecEvolutionInV2Tables() { StructType expectedType = StructType.of( - NestedField.optional(1000, "data", Types.StringType.get()), - NestedField.optional(1001, "category", Types.StringType.get())); + NestedField.optional(10000, "data", Types.StringType.get()), + NestedField.optional(10001, "category", Types.StringType.get())); StructType actualType = Partitioning.partitionType(table); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -115,8 +115,8 @@ public void testPartitionTypeWithRenamesInV1Table() { StructType expectedType = StructType.of( - NestedField.optional(1000, "p2", Types.StringType.get()), - NestedField.optional(1001, "category", Types.StringType.get())); + NestedField.optional(10000, "p2", Types.StringType.get()), + NestedField.optional(10001, "category", Types.StringType.get())); StructType actualType = Partitioning.partitionType(table); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -133,8 +133,8 @@ public void testPartitionTypeWithAddingBackSamePartitionFieldInV1Table() { // in v1, we use void transforms instead of dropping partition fields StructType expectedType = StructType.of( - NestedField.optional(1000, "data_1000", Types.StringType.get()), - NestedField.optional(1001, "data", Types.StringType.get())); + NestedField.optional(10000, "data_10000", Types.StringType.get()), + NestedField.optional(10001, "data", Types.StringType.get())); StructType actualType = Partitioning.partitionType(table); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -150,7 +150,7 @@ public void testPartitionTypeWithAddingBackSamePartitionFieldInV2Table() { // in v2, we should be able to reuse the original partition spec StructType expectedType = - StructType.of(NestedField.optional(1000, "data", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "data", Types.StringType.get())); StructType actualType = Partitioning.partitionType(table); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -183,7 +183,7 @@ public void testGroupingKeyTypeWithSpecEvolutionInV1Tables() { Assert.assertEquals("Should have 2 specs", 2, table.specs().size()); StructType expectedType = - StructType.of(NestedField.optional(1000, "data", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "data", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(table.schema(), table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -198,7 +198,7 @@ public void testGroupingKeyTypeWithSpecEvolutionInV2Tables() { Assert.assertEquals("Should have 2 specs", 2, table.specs().size()); StructType expectedType = - StructType.of(NestedField.optional(1000, "data", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "data", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(table.schema(), table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -214,7 +214,7 @@ public void testGroupingKeyTypeWithDroppedPartitionFieldInV1Tables() { Assert.assertEquals("Should have 2 specs", 2, table.specs().size()); StructType expectedType = - StructType.of(NestedField.optional(1000, "data", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "data", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(table.schema(), table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -230,7 +230,7 @@ public void testGroupingKeyTypeWithDroppedPartitionFieldInV2Tables() { Assert.assertEquals("Should have 2 specs", 2, table.specs().size()); StructType expectedType = - StructType.of(NestedField.optional(1000, "data", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "data", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(table.schema(), table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -246,7 +246,7 @@ public void testGroupingKeyTypeWithRenamesInV1Table() { table.updateSpec().renameField("p1", "p2").commit(); StructType expectedType = - StructType.of(NestedField.optional(1000, "p2", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "p2", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(table.schema(), table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -262,7 +262,7 @@ public void testGroupingKeyTypeWithRenamesInV2Table() { table.updateSpec().renameField("p1", "p2").commit(); StructType expectedType = - StructType.of(NestedField.optional(1000, "p2", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "p2", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(table.schema(), table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -305,7 +305,7 @@ public void testGroupingKeyTypeWithAddingBackSamePartitionFieldInV1Table() { table.updateSpec().addField("data").commit(); StructType expectedType = - StructType.of(NestedField.optional(1000, "category", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "category", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(table.schema(), table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -320,7 +320,7 @@ public void testGroupingKeyTypeWithAddingBackSamePartitionFieldInV2Table() { table.updateSpec().addField("data").commit(); StructType expectedType = - StructType.of(NestedField.optional(1000, "category", Types.StringType.get())); + StructType.of(NestedField.optional(10000, "category", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(table.schema(), table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } @@ -361,7 +361,7 @@ public void testGroupingKeyTypeWithProjectedSchema() { Schema projectedSchema = table.schema().select("id", "data"); StructType expectedType = - StructType.of(NestedField.optional(1001, "data", Types.StringType.get())); + StructType.of(NestedField.optional(10001, "data", Types.StringType.get())); StructType actualType = Partitioning.groupingKeyType(projectedSchema, table.specs().values()); Assert.assertEquals("Types must match", expectedType, actualType); } diff --git a/core/src/test/java/org/apache/iceberg/TestTableMetadata.java b/core/src/test/java/org/apache/iceberg/TestTableMetadata.java index 826f3ad1e778..8869264ddacf 100644 --- a/core/src/test/java/org/apache/iceberg/TestTableMetadata.java +++ b/core/src/test/java/org/apache/iceberg/TestTableMetadata.java @@ -1092,8 +1092,8 @@ public void testNewTableMetadataReassignmentAllIds() throws Exception { PartitionSpec expected = PartitionSpec.builderFor(metadata.schema()) .withSpecId(0) - .add(1, 1000, "x_partition", Transforms.bucket(4)) - .add(3, 1001, "z_partition", Transforms.bucket(8)) + .add(1, 10000, "x_partition", Transforms.bucket(4)) + .add(3, 10001, "z_partition", Transforms.bucket(8)) .build(); Assert.assertEquals(expected, metadata.spec()); @@ -1101,12 +1101,16 @@ public void testNewTableMetadataReassignmentAllIds() throws Exception { @Test public void testInvalidUpdatePartitionSpecForV1Table() throws Exception { - Schema schema = new Schema(Types.NestedField.required(1, "x", Types.LongType.get())); + Schema schema = + new Schema( + Types.NestedField.required(1, "x", Types.LongType.get()), + Types.NestedField.required(2, "y", Types.LongType.get())); PartitionSpec spec = PartitionSpec.builderFor(schema) .withSpecId(5) - .add(1, 1005, "x_partition", Transforms.bucket(4)) + .add(1, 10005, "x_partition", Transforms.bucket(4)) + .add(2, 10008, "y_partition", Transforms.bucket(4)) .build(); String location = "file://tmp/db/table"; TableMetadata metadata = @@ -1150,9 +1154,9 @@ public void testBuildReplacementForV1Table() { PartitionSpec expected = PartitionSpec.builderFor(updated.schema()) .withSpecId(1) - .add(1, 1000, "x", Transforms.identity()) - .add(2, 1001, "y", Transforms.alwaysNull()) - .add(3, 1002, "z_bucket", Transforms.bucket(8)) + .add(1, 10000, "x", Transforms.identity()) + .add(2, 10001, "y", Transforms.alwaysNull()) + .add(3, 10002, "z_bucket", Transforms.bucket(8)) .build(); Assert.assertEquals( "Should reassign the partition field IDs and reuse any existing IDs for equivalent fields", @@ -1186,8 +1190,8 @@ public void testBuildReplacementForV2Table() { PartitionSpec expected = PartitionSpec.builderFor(updated.schema()) .withSpecId(1) - .add(3, 1002, "z_bucket", Transforms.bucket(8)) - .add(1, 1000, "x", Transforms.identity()) + .add(3, 10002, "z_bucket", Transforms.bucket(8)) + .add(1, 10000, "x", Transforms.identity()) .build(); Assert.assertEquals( "Should reassign the partition field IDs and reuse any existing IDs for equivalent fields", diff --git a/core/src/test/java/org/apache/iceberg/TestTableUpdatePartitionSpec.java b/core/src/test/java/org/apache/iceberg/TestTableUpdatePartitionSpec.java index f3bfdf669e33..5a008bbe9b5a 100644 --- a/core/src/test/java/org/apache/iceberg/TestTableUpdatePartitionSpec.java +++ b/core/src/test/java/org/apache/iceberg/TestTableUpdatePartitionSpec.java @@ -48,7 +48,7 @@ public TestTableUpdatePartitionSpec(int formatVersion) { public void verifyInitialSpec() { PartitionSpec initialSpec = PartitionSpec.builderFor(table.schema()).bucket("data", 16).build(); Assert.assertEquals("Should use the expected initial spec", initialSpec, table.spec()); - Assert.assertEquals(1000, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10000, table.spec().lastAssignedFieldId()); Assert.assertEquals(0, table.spec().specId()); } @@ -63,7 +63,7 @@ public void testCommitUpdatedSpec() { .bucket("id", 8, "id_bucket_8") .build(); Assert.assertEquals("Should append a partition field to the spec", evolvedSpec, table.spec()); - Assert.assertEquals(1001, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10001, table.spec().lastAssignedFieldId()); table .updateSpec() @@ -86,11 +86,11 @@ public void testCommitUpdatedSpec() { "Should hard delete id and data buckets", PartitionSpec.builderFor(table.schema()) .withSpecId(2) - .add(2, 1002, "data_trunc_8", Transforms.truncate(8)) + .add(2, 10002, "data_trunc_8", Transforms.truncate(8)) .build(), table.spec()); - Assert.assertEquals(1002, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10002, table.spec().lastAssignedFieldId()); } @Test @@ -131,7 +131,7 @@ public void testRenameField() { .build(); Assert.assertEquals("should match evolved spec", evolvedSpec, table.spec()); - Assert.assertEquals(1001, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10001, table.spec().lastAssignedFieldId()); table .updateSpec() @@ -148,7 +148,7 @@ public void testRenameField() { .build(); Assert.assertEquals("should match evolved spec", evolvedSpec, table.spec()); - Assert.assertEquals(1002, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10002, table.spec().lastAssignedFieldId()); } @Test @@ -162,7 +162,7 @@ public void testRenameOnlyEvolution() { .build(); Assert.assertEquals("should match evolved spec", evolvedSpec, table.spec()); - Assert.assertEquals(1000, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10000, table.spec().lastAssignedFieldId()); } @Test @@ -182,11 +182,11 @@ public void testRemoveAndAddField() { "Should hard delete data bucket", PartitionSpec.builderFor(table.schema()) .withSpecId(1) - .add(1, 1001, "id_bucket_8", Transforms.bucket(8)) + .add(1, 10001, "id_bucket_8", Transforms.bucket(8)) .build(), table.spec()); - Assert.assertEquals(1001, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10001, table.spec().lastAssignedFieldId()); } @Test @@ -202,7 +202,7 @@ public void testRemoveAndAddYearField() { .build(); Assert.assertEquals("should match evolved spec", evolvedSpec, table.spec()); - Assert.assertEquals(1001, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10001, table.spec().lastAssignedFieldId()); table.updateSpec().removeField("year_field_year").addField(year("year_field")).commit(); @@ -220,11 +220,11 @@ public void testRemoveAndAddYearField() { PartitionSpec.builderFor(table.schema()) .withSpecId(1) .bucket("data", 16) - .add(3, 1001, "year_field_year", Transforms.year()) + .add(3, 10001, "year_field_year", Transforms.year()) .build(), table.spec()); - Assert.assertEquals(1001, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10001, table.spec().lastAssignedFieldId()); } @Test @@ -243,10 +243,10 @@ public void testAddAndRemoveField() { "Should remove and then add a bucket field", PartitionSpec.builderFor(table.schema()) .withSpecId(1) - .add(2, 1001, "data_bucket_6", Transforms.bucket(6)) + .add(2, 10001, "data_bucket_6", Transforms.bucket(6)) .build(), table.spec()); - Assert.assertEquals(1001, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10001, table.spec().lastAssignedFieldId()); } @Test @@ -261,14 +261,14 @@ public void testAddAfterLastFieldRemoved() { .build(), table.spec()); V1Assert.assertEquals( - "Should match the last assigned field id", 1000, table.spec().lastAssignedFieldId()); + "Should match the last assigned field id", 10000, table.spec().lastAssignedFieldId()); V2Assert.assertEquals( "Should add a new id bucket", PartitionSpec.builderFor(table.schema()).withSpecId(1).build(), table.spec()); V2Assert.assertEquals( - "Should match the last assigned field id", 999, table.spec().lastAssignedFieldId()); - Assert.assertEquals(1000, table.ops().current().lastAssignedPartitionId()); + "Should match the last assigned field id", 9999, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10000, table.ops().current().lastAssignedPartitionId()); table.updateSpec().addField(bucket("id", 8)).commit(); @@ -284,10 +284,10 @@ public void testAddAfterLastFieldRemoved() { "Should add a new id bucket", PartitionSpec.builderFor(table.schema()) .withSpecId(2) - .add(1, 1001, "id_bucket_8", Transforms.bucket(8)) + .add(1, 10001, "id_bucket_8", Transforms.bucket(8)) .build(), table.spec()); - Assert.assertEquals(1001, table.spec().lastAssignedFieldId()); - Assert.assertEquals(1001, table.ops().current().lastAssignedPartitionId()); + Assert.assertEquals(10001, table.spec().lastAssignedFieldId()); + Assert.assertEquals(10001, table.ops().current().lastAssignedPartitionId()); } } diff --git a/core/src/test/java/org/apache/iceberg/TestUpdatePartitionSpec.java b/core/src/test/java/org/apache/iceberg/TestUpdatePartitionSpec.java index 5ecf138870ad..f64efe6ab2e8 100644 --- a/core/src/test/java/org/apache/iceberg/TestUpdatePartitionSpec.java +++ b/core/src/test/java/org/apache/iceberg/TestUpdatePartitionSpec.java @@ -214,8 +214,8 @@ public void testAddHourToDay() { Assert.assertEquals( "Should have a day and an hour time field", ImmutableList.of( - new PartitionField(2, 1000, "ts_day", Transforms.day()), - new PartitionField(2, 1001, "ts_hour", Transforms.hour())), + new PartitionField(2, 10000, "ts_day", Transforms.day()), + new PartitionField(2, 10001, "ts_hour", Transforms.hour())), byHour.fields()); } @@ -254,8 +254,8 @@ public void testRemoveIdentityByName() { PartitionSpec v2Expected = PartitionSpec.builderFor(SCHEMA) - .add(id("ts"), 1001, "ts_day", Transforms.day()) - .add(id("id"), 1002, "shard", Transforms.bucket(16)) + .add(id("ts"), 10001, "ts_day", Transforms.day()) + .add(id("id"), 10002, "shard", Transforms.bucket(16)) .build(); V2Assert.assertEquals("Should match expected spec", v2Expected, updated); @@ -277,8 +277,8 @@ public void testRemoveBucketByName() { PartitionSpec v2Expected = PartitionSpec.builderFor(SCHEMA) - .add(id("category"), 1000, "category", Transforms.identity()) - .add(id("ts"), 1001, "ts_day", Transforms.day()) + .add(id("category"), 10000, "category", Transforms.identity()) + .add(id("ts"), 10001, "ts_day", Transforms.day()) .build(); V2Assert.assertEquals("Should match expected spec", v2Expected, updated); @@ -302,8 +302,8 @@ public void testRemoveIdentityByEquivalent() { PartitionSpec v2Expected = PartitionSpec.builderFor(SCHEMA) - .add(id("ts"), 1001, "ts_day", Transforms.day()) - .add(id("id"), 1002, "shard", Transforms.bucket(16)) + .add(id("ts"), 10001, "ts_day", Transforms.day()) + .add(id("id"), 10002, "shard", Transforms.bucket(16)) .build(); V2Assert.assertEquals("Should match expected spec", v2Expected, updated); @@ -325,8 +325,8 @@ public void testRemoveDayByEquivalent() { PartitionSpec v2Expected = PartitionSpec.builderFor(SCHEMA) - .add(id("category"), 1000, "category", Transforms.identity()) - .add(id("id"), 1002, "shard", Transforms.bucket(16)) + .add(id("category"), 10000, "category", Transforms.identity()) + .add(id("id"), 10002, "shard", Transforms.bucket(16)) .build(); V2Assert.assertEquals("Should match expected spec", v2Expected, updated); @@ -388,9 +388,9 @@ public void testMultipleChanges() { PartitionSpec v2Expected = PartitionSpec.builderFor(SCHEMA) - .add(id("category"), 1000, "category", Transforms.identity()) - .add(id("id"), 1002, "id_bucket", Transforms.bucket(16)) - .add(id("data"), 1003, "prefix", Transforms.truncate(4)) + .add(id("category"), 10000, "category", Transforms.identity()) + .add(id("id"), 10002, "id_bucket", Transforms.bucket(16)) + .add(id("data"), 10003, "prefix", Transforms.truncate(4)) .build(); V2Assert.assertEquals("Should match expected spec", v2Expected, updated); @@ -687,7 +687,7 @@ public void testRemoveAndUpdateWithDifferentTransformation() { Assert.assertEquals("Should match expected spec field size", 2, updated.fields().size()); Assert.assertEquals( "Should match expected field name", - "ts_transformed_1000", + "ts_transformed_10000", updated.fields().get(0).name()); Assert.assertEquals( "Should match expected field name", "ts_transformed", updated.fields().get(1).name()); diff --git a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java index a5895d380708..7722d53629e9 100644 --- a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java +++ b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java @@ -60,7 +60,7 @@ public void testRoundTripSerDe() throws JsonProcessingException { "{\"name\":\"test_tbl\",\"location\":\"file://tmp/location/\",\"schema\":{\"type\":\"struct\"," + "\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"id\",\"required\":true,\"type\":\"int\"}," + "{\"id\":2,\"name\":\"data\",\"required\":false,\"type\":\"string\"}]},\"partition-spec\":{\"spec-id\":0," - + "\"fields\":[{\"name\":\"id_bucket\",\"transform\":\"bucket[16]\",\"source-id\":1,\"field-id\":1000}]}," + + "\"fields\":[{\"name\":\"id_bucket\",\"transform\":\"bucket[16]\",\"source-id\":1,\"field-id\":10000}]}," + "\"write-order\":{\"order-id\":1,\"fields\":" + "[{\"transform\":\"identity\",\"source-id\":2,\"direction\":\"asc\",\"null-order\":\"nulls-last\"}]}," + "\"properties\":{\"owner\":\"Hank\"},\"stage-create\":false}"; diff --git a/core/src/test/resources/TableMetadataStatisticsFiles.json b/core/src/test/resources/TableMetadataStatisticsFiles.json index 150e2891efc0..f89dc41a2da2 100644 --- a/core/src/test/resources/TableMetadataStatisticsFiles.json +++ b/core/src/test/resources/TableMetadataStatisticsFiles.json @@ -27,7 +27,7 @@ "fields": [] } ], - "last-partition-id": 1000, + "last-partition-id": 10000, "default-sort-order-id": 0, "sort-orders": [ { diff --git a/core/src/test/resources/TableMetadataV2MissingSortOrder.json b/core/src/test/resources/TableMetadataV2MissingSortOrder.json index fbbcf415d264..765e32b1d6f2 100644 --- a/core/src/test/resources/TableMetadataV2MissingSortOrder.json +++ b/core/src/test/resources/TableMetadataV2MissingSortOrder.json @@ -40,12 +40,12 @@ "name": "x", "transform": "identity", "source-id": 1, - "field-id": 1000 + "field-id": 10000 } ] } ], - "last-partition-id": 1000, + "last-partition-id": 10000, "properties": {}, "current-snapshot-id": -1, "snapshots": [], diff --git a/core/src/test/resources/TableMetadataV2Valid.json b/core/src/test/resources/TableMetadataV2Valid.json index 0dc89de58c42..1c7bee4c1aa7 100644 --- a/core/src/test/resources/TableMetadataV2Valid.json +++ b/core/src/test/resources/TableMetadataV2Valid.json @@ -63,7 +63,7 @@ ] } ], - "last-partition-id": 1000, + "last-partition-id": 10000, "default-sort-order-id": 3, "sort-orders": [ { diff --git a/format/spec.md b/format/spec.md index 397057a97456..400bf7b06170 100644 --- a/format/spec.md +++ b/format/spec.md @@ -1116,7 +1116,7 @@ Partition specs are serialized as a JSON object with the following fields: |Field|JSON representation|Example| |--- |--- |--- | |**`spec-id`**|`JSON int`|`0`| -|**`fields`**|`JSON list: [`
  `,`
  `...`
`]`|`[ {`
  `"source-id": 4,`
  `"field-id": 1000,`
  `"name": "ts_day",`
  `"transform": "day"`
`}, {`
  `"source-id": 1,`
  `"field-id": 1001,`
  `"name": "id_bucket",`
  `"transform": "bucket[16]"`
`} ]`| +|**`fields`**|`JSON list: [`
  `,`
  `...`
`]`|`[ {`
  `"source-id": 4,`
  `"field-id": 10000,`
  `"name": "ts_day",`
  `"transform": "day"`
`}, {`
  `"source-id": 1,`
  `"field-id": 1001,`
  `"name": "id_bucket",`
  `"transform": "bucket[16]"`
`} ]`| Each partition field in `fields` is stored as a JSON object with the following properties. @@ -1196,7 +1196,7 @@ Table metadata is serialized as a JSON object according to the following table. |**`partition-spec`**|`JSON partition fields (list)`|`See above, read partition-specs instead`| |**`partition-specs`**|`JSON partition specs (list of objects)`|`See above`| |**`default-spec-id`**|`JSON int`|`0`| -|**`last-partition-id`**|`JSON int`|`1000`| +|**`last-partition-id`**|`JSON int`|`10000`| |**`properties`**|`JSON object: {`
  `"": "",`
  `...`
`}`|`{`
  `"write.format.default": "avro",`
  `"commit.retry.num-retries": "4"`
`}`| |**`current-snapshot-id`**|`JSON long`|`3051729675574597004`| |**`snapshots`**|`JSON list of objects: [ {`
  `"snapshot-id": ,`
  `"timestamp-ms": ,`
  `"summary": {`
    `"operation": ,`
    `... },`
  `"manifest-list": "",`
  `"schema-id": ""`
  `},`
  `...`
`]`|`[ {`
  `"snapshot-id": 3051729675574597004,`
  `"timestamp-ms": 1515100955770,`
  `"summary": {`
    `"operation": "append"`
  `},`
  `"manifest-list": "s3://b/wh/.../s1.avro"`
  `"schema-id": 0`
`} ]`| diff --git a/spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java b/spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java index 0baaef1374d4..5022732611b6 100644 --- a/spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java +++ b/spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java @@ -479,7 +479,7 @@ public void testPartitionsTableSwitchFields() throws Exception { row(null, "c3", "d3"), row("d1", "c1", null), row("d2", "c2", null)), - "STRUCT", + "STRUCT", PARTITIONS); } else { // In V2 re-adding a former partition field that was part of an older spec will not change its @@ -584,13 +584,13 @@ public void testPartitionTableFilterSwitchFields() throws Exception { assertPartitions( ImmutableList.of(row(null, "c2", null), row(null, "c2", "d2"), row("d2", "c2", null)), - "STRUCT", + "STRUCT", PARTITIONS, "partition.category = 'c2'"); assertPartitions( ImmutableList.of(row(null, "c1", "d1")), - "STRUCT", + "STRUCT", PARTITIONS, "partition.data = 'd1'"); } diff --git a/spark/v3.4/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java b/spark/v3.4/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java index ea65fead10fc..6c90e40b0e54 100644 --- a/spark/v3.4/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java +++ b/spark/v3.4/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java @@ -479,7 +479,7 @@ public void testPartitionsTableSwitchFields() throws Exception { row(null, "c3", "d3"), row("d1", "c1", null), row("d2", "c2", null)), - "STRUCT", + "STRUCT", PARTITIONS); } else { // In V2 re-adding a former partition field that was part of an older spec will not change its @@ -584,13 +584,13 @@ public void testPartitionTableFilterSwitchFields() throws Exception { assertPartitions( ImmutableList.of(row(null, "c2", null), row(null, "c2", "d2"), row("d2", "c2", null)), - "STRUCT", + "STRUCT", PARTITIONS, "partition.category = 'c2'"); assertPartitions( ImmutableList.of(row(null, "c1", "d1")), - "STRUCT", + "STRUCT", PARTITIONS, "partition.data = 'd1'"); } diff --git a/spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAlterTablePartitionFields.java b/spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAlterTablePartitionFields.java index 38e5c942c9ff..c2196eb6712a 100644 --- a/spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAlterTablePartitionFields.java +++ b/spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAlterTablePartitionFields.java @@ -394,7 +394,7 @@ public void testReplacePartition() { TestHelpers.newExpectedSpecBuilder() .withSchema(table.schema()) .withSpecId(2) - .addField("hour", 3, 1001, "ts_hour") + .addField("hour", 3, 10001, "ts_hour") .build(); } assertThat(table.spec()) @@ -428,7 +428,7 @@ public void testReplacePartitionAndRename() { TestHelpers.newExpectedSpecBuilder() .withSchema(table.schema()) .withSpecId(2) - .addField("hour", 3, 1001, "hour_col") + .addField("hour", 3, 10001, "hour_col") .build(); } assertThat(table.spec()) @@ -462,7 +462,7 @@ public void testReplaceNamedPartition() { TestHelpers.newExpectedSpecBuilder() .withSchema(table.schema()) .withSpecId(2) - .addField("hour", 3, 1001, "ts_hour") + .addField("hour", 3, 10001, "ts_hour") .build(); } assertThat(table.spec()) @@ -496,7 +496,7 @@ public void testReplaceNamedPartitionAndRenameDifferently() { TestHelpers.newExpectedSpecBuilder() .withSchema(table.schema()) .withSpecId(2) - .addField("hour", 3, 1001, "hour_col") + .addField("hour", 3, 10001, "hour_col") .build(); } assertThat(table.spec()) diff --git a/spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java b/spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java index a417454b45dc..78e7efbd8eeb 100644 --- a/spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java +++ b/spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/source/TestMetadataTablesWithPartitionEvolution.java @@ -474,7 +474,7 @@ public void testPartitionsTableSwitchFields() throws Exception { row(null, "c3", "d3"), row("d1", "c1", null), row("d2", "c2", null)), - "STRUCT", + "STRUCT", PARTITIONS); } else { // In V2 re-adding a former partition field that was part of an older spec will not change its @@ -579,13 +579,13 @@ public void testPartitionTableFilterSwitchFields() throws Exception { assertPartitions( ImmutableList.of(row(null, "c2", null), row(null, "c2", "d2"), row("d2", "c2", null)), - "STRUCT", + "STRUCT", PARTITIONS, "partition.category = 'c2'"); assertPartitions( ImmutableList.of(row(null, "c1", "d1")), - "STRUCT", + "STRUCT", PARTITIONS, "partition.data = 'd1'"); }