krvikash opened a new issue, #14755:
URL: https://github.com/apache/iceberg/issues/14755
### Apache Iceberg version
1.10.0 (latest release)
### Query engine
None
### Please describe the bug 🐞
Iceberg allows adding partition specs that reuse the same field name with
different truncate widths or bucket sizes, which results in an invalid schema.
Repro test case:
```java
@TestTemplate
public void test() {
PartitionSpec spec = PartitionSpec.builderFor(schema).bucket("data",
4).build();
TestTables.TestTable table = TestTables.create(tableDir, "test",
schema, spec, formatVersion);
assertThat(table.spec()).isEqualTo(spec);
TableMetadata base = TestTables.readMetadata("test");
PartitionSpec newSpec =
PartitionSpec.builderFor(table.schema()).bucket("data",
10).withSpecId(1).build();
table.ops().commit(base, base.updatePartitionSpec(newSpec));
assertThat(table.spec()).isEqualTo(newSpec);
createMetadataTableInstance(table, FILES).schema();
}
```
Error:
```
Conflicting partition fields: ['1000: data_bucket: bucket[4](2)', '1000:
data_bucket: bucket[10](2)']
org.apache.iceberg.exceptions.ValidationException: Conflicting partition
fields: ['1000: data_bucket: bucket[4](2)', '1000: data_bucket: bucket[10](2)']
at
org.apache.iceberg.exceptions.ValidationException.check(ValidationException.java:49)
at
org.apache.iceberg.Partitioning.buildPartitionProjectionType(Partitioning.java:295)
at org.apache.iceberg.Partitioning.partitionType(Partitioning.java:242)
at org.apache.iceberg.BaseFilesTable.schema(BaseFilesTable.java:48)
at org.apache.iceberg.FilesTable.schema(FilesTable.java:24)
at
org.apache.iceberg.TestPartitionSpecInfo.test(TestPartitionSpecInfo.java:174)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
```
### Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [x] I would be willing to contribute a fix for this bug with guidance from
the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
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]