feat: Honor write.metadata.path for metadata file locations#2776
Open
zakariya-s wants to merge 1 commit into
Open
feat: Honor write.metadata.path for metadata file locations#2776zakariya-s wants to merge 1 commit into
zakariya-s wants to merge 1 commit into
Conversation
Metadata files (manifest lists, manifests, and the table metadata JSON) were always written under `<table-location>/metadata`, ignoring the `write.metadata.path` table property. iceberg-java honors it via `metadataFileLocation`; this brings iceberg-rust in line, mirroring how `write.data.path` is already honored for data files. Add `TableMetadata::metadata_location_root()`, returning `write.metadata.path` (trailing slash trimmed) when set, otherwise `<location>/metadata`. Use it in `SnapshotProducer` for the manifest and manifest-list paths, and in `MetadataLocation` for the metadata JSON. `MetadataLocation` now stores the resolved metadata directory rather than the table location. On commit the directory is re-derived from the metadata being committed (the version is still parsed from the previous file name), matching iceberg-java. As a result `MetadataLocation::from_str` no longer requires the file to live under a `/metadata` directory; file-name validation is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
write.metadata.pathtable property for metadata file locations #2775.What changes are included in this PR?
Metadata files were always written under
<table-location>/metadata, ignoring thewrite.metadata.pathtable property. Iceberg Java honors it (viaBaseMetastoreTableOperations.metadataFileLocation); this brings iceberg-rust in line and mirrors the existingwrite.data.pathhandling for data files.TableMetadata::metadata_location_root(), returningwrite.metadata.path(trailing slash trimmed) when set, otherwise<location>/metadata.SnapshotProducerfor the manifest and manifest-list paths, and inMetadataLocationfor the table metadata JSON.MetadataLocationnow stores the resolved metadata directory rather than the table location. On commit, the directory is re-derived from the metadata being committed (the version is still parsed from the previous file name), matching Iceberg Java. As a resultMetadataLocation::from_strno longer requires the file to live under a/metadatadirectory (a customwrite.metadata.pathdoes not have to); file-name validation is unchanged.Are these changes tested?
Unit tests:
TableMetadata::metadata_location_root(): default, configuredwrite.metadata.path, and trailing-slash trimming.MetadataLocation: create (new_with_metadata) and commit (with_new_metadata) honorwrite.metadata.path;from_strround-trip cases updated for arbitrary metadata dirs.fast_appendtransaction test asserting the manifest list and manifests are written under a configuredwrite.metadata.path.catalog::tests::test_table_committo reflect the new metadata file following the updated table location.