agnes-xinyi-lu opened a new issue, #13290: URL: https://github.com/apache/gravitino/issues/13290
### Version main branch ### Describe what's wrong When loading table with `snapshots=refs` it will try to rebuild a new TableMetadata object with suppressed snapshot history. https://github.com/apache/gravitino/blob/74667849e4f8564e379d729efc7d086e5c89f231/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableOperations.java#L574 When rebuilding the TableMetadata object we need to explicitly set `metadata_location` property since Builder does not automatically inherit this value from base. This could be verified through UT. In OSS Iceberg CatalogHandlers implementation it does ``` TableMetadata.buildFrom(loadedMetadata) .withMetadataLocation(loadedMetadata.metadataFileLocation()) .suppressHistoricalSnapshots() .build(); ``` https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java#L519 So the fix should be just adding one line to set metadata location. ### Error message and/or stacktrace No Error message ### How to reproduce main branch. send a load_table request with snapshots=refs, for example ``` curl -H "{Auth Header}" http://{endpoint}:9001/iceberg/v1/{catalog}/namespaces/{namespace}/tables/{table}?snapshots=refs ``` ### 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]
