tomron opened a new pull request, #4209: URL: https://github.com/apache/iceberg-python/pull/4209
Closes #4202 # Rationale for this change `UpdateSortOrder` only asserts the default sort order id, so a stale handle can commit an `AddSortOrderUpdate` whose id already exists. When the orders are equal, the metadata ends up with two sort orders sharing an id, which Java's `TableMetadataParser` rejects. When they differ, it raises a non-retryable `ValueError`. This mirrors Java's `TableMetadata.Builder.addSortOrder`: - Reuse the id of an existing sort order with the same fields instead of appending a duplicate. - Assign the next free id when the requested id is taken by a different sort order. - Track the last added sort order in the update context so `SetDefaultSortOrderUpdate(-1)` resolves to it, rather than the highest id. # Are these changes tested? Yes. New catalog behavior tests cover the stale-handle scenarios from the issue and multiple sort order changes in one transaction. There are also unit tests for `update_table_metadata`. # Are there any user-facing changes? No API changes. Stale sort order updates no longer produce invalid metadata. -- 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]
