Conversation
ManifestWriterV2 hardcoded content() to ManifestContent.DATA and wrote "content": "data" into the Avro metadata, so PyIceberg could not produce a delete manifest even though it reads them and ManifestListWriterV1 already guards against storing one in a v1 table. Thread an optional content through write_manifest and ManifestWriterV2, defaulting to DATA so existing callers are unaffected, and reject a non-data content for format version 1.
This branch has not been deployed
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.
Rationale
ManifestWriterV2hardcodes its content type:content()returnsManifestContent.DATAunconditionally and_metawrites"content": "data".PyIceberg can therefore only ever write data manifests, even though it reads
delete manifests fine and
ManifestFile.contentis a first-class field.The asymmetry is already visible in the codebase:
ManifestListWriterV1.prepare_manifestraises
Cannot store delete manifests in a v1 table, a guard that only makes senseif a v2 table were expected to be able to produce one.
The practical consequence is that any maintenance operation that needs to rewrite
delete manifests has to subclass
ManifestWriterV2and override two private membersto do it. #3925 describes one such case.
Change
write_manifest(...)takescontent: ManifestContent = ManifestContent.DATAand passes it to
ManifestWriterV2.ManifestWriterV2stores it;content()returns it and_metaemits"data"or"deletes"to match.format_version=1with a non-data content raisesValidationError, mirroringthe existing manifest-list guard — v1 has no delete files.
The default is unchanged, so every existing caller keeps writing data manifests.
Tests
Added to
tests/utils/test_manifest.py:test_write_manifest_content— parametrized overDATA/DELETES; asserts theround-tripped
ManifestFile.contentand the Avrocontentmetadata key agreewith what was requested.
test_write_manifest_defaults_to_data_content— callers that pass nothing stillget a data manifest.
test_write_manifest_v1_rejects_delete_content— v1 refuses loudly.tests/utils/test_manifest.py: 48 passed. Lint and format clean.Note
#3624 (writing V3 manifests) adds a
ManifestWriterV3subclass and touches thesame dispatch function, but does not change the hardcoded content — the two are
adjacent rather than overlapping. Whichever lands second will need a trivial
rebase.