agnes-xinyi-lu opened a new issue, #13452: URL: https://github.com/apache/gravitino/issues/13452
### Version main branch ### Describe what's wrong Same issue reported on Iceberg side for CatalogHandler as well https://github.com/apache/iceberg/issues/17538 When load_table with snapshots=refs, [suppressHistoricalSnapshots](https://github.com/apache/iceberg/blob/1504ddd5d5119e934e7cbcaed82b9384caf35b82/core/src/main/java/org/apache/iceberg/TableMetadata.java#L1398) skips changes for removeSnapshot but does not for snapshot statistics, when rebuilding TableMetadata it will throw [validation error ](https://github.com/apache/iceberg/blob/1504ddd5d5119e934e7cbcaed82b9384caf35b82/core/src/main/java/org/apache/iceberg/TableMetadata.java#L1565)because changelist is not empty. The fix is to do discardChanges() on rebuilt TableMetadata like suggested by the original iceberg issue. This error starts appearing since https://github.com/apache/gravitino/issues/13290 was addressed, because setting metadata_location explicitly triggers this additional precondition check. ### Error message and/or stacktrace ``` java.lang.IllegalArgumentException: Cannot set metadata location with changes to table metadata: 2 changes at org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkArgument(Preconditions.java:192 at org.apache.iceberg.TableMetadata$Builder.build(TableMetadata.java:1547) at org.apache.gravitino.iceberg.service.rest.IcebergTableOperations.filterSnapshotsByRefs(IcebergTableOpes.java:594) at org.apache.gravitino.iceberg.service.rest.TestIcebergTableOperations.lambda$testFilterSnapshotsByRefsDsStatisticsRemovalChanges$4(TestIcebergTableOperations.java:1271) at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:72) ... ``` ### How to reproduce Reproduced in unittests ### Additional context _No response_ -- 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]
