fix(parquet): strip repetition_type from root SchemaElement during serialization#723
Open
hcrosse wants to merge 2 commits intoapache:mainfrom
Open
fix(parquet): strip repetition_type from root SchemaElement during serialization#723hcrosse wants to merge 2 commits intoapache:mainfrom
hcrosse wants to merge 2 commits intoapache:mainfrom
Conversation
…rialization The Parquet spec states the root of the schema does not have a repetition_type. arrow-go was writing REPEATED for the root SchemaElement in the Thrift footer, which is non-standard and breaks interoperability with consumers like Snowflake. Strip RepetitionType from the root element in ToThrift(), matching parquet-java and arrow-rs behavior. The in-memory representation and WithRootRepetition API are unaffected. FromParquet already tolerates a nil root repetition type, so this is backwards-compatible for both readers and writers. Closes apache#722
…ping Stripping the root SchemaElement's repetition_type removes 2 bytes from the serialized Thrift footer (field header + enum value).
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
The Parquet spec says the root of the schema doesn't have a
repetition_type. arrow-go writesREPEATEDfor the rootSchemaElementin the Thrift footer, which breaks interop with consumers like Snowflake. #722 has the full writeup and cross-implementation comparison.What changes are included in this PR?
ToThrift()now nils outRepetitionTypeon the root element before returning, stripping it from the serialized output. This matches how parquet-java and arrow-rs handle the root.The in-memory representation and
WithRootRepetitionAPI are unaffected.FromParquetalready tolerates a nil root repetition type, so this is backwards-compatible for both readers and writers.Are these changes tested?
Updated the existing
TestNestedExampleand addedTestToThriftRootRepetitionStrippedwhich checks that the root'srepetition_typeis stripped for all three repetition variants and that non-root elements keep theirs.Closes #722