nastra opened a new issue, #15008: URL: https://github.com/apache/iceberg/issues/15008
### Apache Iceberg version None ### Query engine None ### Please describe the bug 🐞 The test in https://github.com/apache/iceberg/pull/14334 uncovered an edge case where the same view change is applied twice and fails with ``` org.apache.iceberg.exceptions.ValidationException: Cannot set last added schema: no schema has been added at org.apache.iceberg.exceptions.ValidationException.check(ValidationException.java:49) at org.apache.iceberg.view.ViewMetadata$Builder.addVersionInternal(ViewMetadata.java:297) at org.apache.iceberg.view.ViewMetadata$Builder.addVersion(ViewMetadata.java:277) at org.apache.iceberg.MetadataUpdate$AddViewVersion.applyTo(MetadataUpdate.java:508) at org.apache.iceberg.rest.CatalogHandlers.lambda$commit$11(CatalogHandlers.java:624) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.apache.iceberg.rest.CatalogHandlers.lambda$commit$12(CatalogHandlers.java:624) ``` This is due to our internal state tracking of `lastAddedSchemaId`, which is then assumed to be set when adding the view version and checking ``` if (version.schemaId() == LAST_ADDED) { ValidationException.check(lastAddedSchemaId != null, "Cannot set last added schema: no schema has been added"); version = ImmutableViewVersion.builder().from(version).schemaId(lastAddedSchemaId).build(); } ``` ### Willingness to contribute - [ ] I can contribute a fix for this bug independently - [ ] 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]
