fix: handle missing format-version in NewManifestReader for v1 manifests#868
Open
rockwotj wants to merge 1 commit intoapache:mainfrom
Open
fix: handle missing format-version in NewManifestReader for v1 manifests#868rockwotj wants to merge 1 commit intoapache:mainfrom
rockwotj wants to merge 1 commit intoapache:mainfrom
Conversation
The Java Iceberg library omits the optional format-version metadata key from v1 manifest file Avro OCF headers. NewManifestReader was calling strconv.Atoi unconditionally on the empty string, causing a parse error. Default to version 1 when the key is absent, matching the spec (format-version is optional for v1, required for v2+) and the same pattern used in ReadManifestList since apache#826. Fixes apache#416
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.
Problem
NewManifestReaderinmanifest.gocallsstrconv.Atoiunconditionally onmetadata["format-version"]. The Java Iceberg library omits this key from v1 manifest file Avro OCF headers —format-versionis optional for v1 per the spec. When iceberg-go reads those files,metadata["format-version"]returnsnil→ empty string →Atoi("")→ error:Fix
Default
formatVersionto1and only parse the metadata key when it is present. This matches the spec (format-versionis optional for v1, required for v2+) and the same pattern already used inReadManifestListsince #826.The existing
formatVersion != file.Version()check below is unaffected and still catches real version mismatches.Testing
Added
TestNewManifestReaderMissingFormatVersion: writes a v1 manifest Avro file without theformat-versionmetadata key (simulating Java Iceberg output) and verifiesNewManifestReadersucceeds and reports version 1.Related
ReadManifestListformat/spec.mdAvro manifest file metadata table —format-versionisoptionalfor v1,requiredfor v2