waterWang opened a new pull request, #17539: URL: https://github.com/apache/iceberg/pull/17539
## Description When `snapshot-loading-mode=refs`, `CatalogHandlers.loadTable` fails with `IllegalArgumentException: Cannot set metadata location with changes to table metadata: 1 changes` for tables that have statistics files attached to historical (unreferenced) snapshots. ## Root Cause `suppressHistoricalSnapshots()` removes statistics from suppressed snapshots via `removeStatistics()` / `removePartitionStatistics()`, which record `MetadataUpdate.RemoveStatistics` / `RemovePartitionStatistics` changes. `build()` then rejects the combination of pending changes and a set metadata location. ## Fix Added `.discardChanges()` after `.suppressHistoricalSnapshots()` in the builder chain, matching the client-side wrapper in `RESTSessionCatalog.loadTable` which already does this. Closes #17538 -- 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]
