Repository navigation
fix(spec): drop v3-only data file fields from the v2 manifest schema - #3452
Open
DeviousCardi wants to merge 1 commit into
Open
DeviousCardi wants to merge 1 commit into
DeviousCardi wants to merge 1 commit into
Conversation
The v2 manifest Avro schema declared first_row_id (142), content_offset (144) and content_size_in_bytes (145), which the spec defines only for v3, so v2 manifests could carry v3 values. The v2 schema now matches Java's V2Metadata.fileType, and v3 manifests are written with their own schema, which keeps those fields. Reading is unchanged: v2 manifests written before this change still parse with the writer schema. Closes apache#3399 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Which issue does this PR close?
What changes are included in this PR?
The v2 manifest Avro schema declared
first_row_id(142),content_offset(144) andcontent_size_in_bytes(145). The spec defines these only for v3, so aDataFilewith any of them set wrote v3 values into a v2 manifest.The v2
data_fileschema now has the same fields as Java'sV2Metadata.fileType, keepingreferenced_data_file(143). The writer previously used the v2 schema for v3 manifests too, so v3 manifests now get their ownmanifest_schema_v3, which keeps all four fields.Things the diff doesn't show:
DataFileare dropped when it is written to a v2 manifest, not rejected. Java behaves the same way: its v2DataFileWrapperexposes only the v2 positions. The v1 writer already drops them the same way.Manifest::parse_avroreads with the writer schema, so v2 manifests that older iceberg-rust versions wrote with these fields still parse, and the values are returned as before. Gating v3 fields when reading v1/v2 is a separate item on EPIC: v3 Support Tracking #2411.write_data_files_to_avroandread_data_files_from_avrousedata_file_schema_v2forFormatVersion::V2, so they also stop carrying the three fields for v2.Are these changes tested?
Yes, with unit tests:
DataFile, with all four fields set, to a v2 and a v3 manifest. It checks thedata_filefield ids in the written Avro schema and the data file read back from each manifest.test_parse_manifest_without_each_fieldnow writes with the v3 schema and runs for both v2 and v3 metadata. Its v2 case is a manifest as older versions wrote it, with 142/144/145 present.AI Disclosure
The code and tests were written with Claude Code (Claude Opus 5.5), then reviewed by the author. Areas a reviewer should check:
add_file/add_entry. I followed Java, but an error would surface caller bugs earlier.read_data_files_from_avrowithFormatVersion::V2now uses a reader schema without the three fields, so it returnsNonefor them even if the bytes contain them. I found no callers outside tests; if something external depends on this, it is a behaviour change.first_row_id,referenced_data_file,content_offset,content_size_in_bytes) is the one that already existed, and it matches Java'sV3Metadata.fileType.🤖 Generated with Claude Code