arrow-ipc: Ensure writer conforms to spec on length-0 variable-size arrays#9717
Open
atwam wants to merge 1 commit intoapache:mainfrom
Open
arrow-ipc: Ensure writer conforms to spec on length-0 variable-size arrays#9717atwam wants to merge 1 commit intoapache:mainfrom
atwam wants to merge 1 commit intoapache:mainfrom
Conversation
Contributor
I don't understand this statement. The spec you reference in #9716 is for the in memory structure (not the ipc format) It almost sounds like a bug in polars -- shouldn't it accept zero length IPC buffers ? |
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?
Rationale for this change
Current version serializes a length-0 offsets buffer, and relies on the array constructor to set offsets to
[0]for empty arrays. This does not conform with spec, which specifies that the offsets buffer should havelength + 1elements.This correctly serializes a length-1 offsets buffer containing
[0]. I have left the current behavior of filling-in offsets with[0]for empty arrays, so that future versions can still read IPC files serialized by previous versions.What changes are included in this PR?
Added tests for serialization of empty arrays, ensuring length-1 offsets buffer. Fixed serialization of empty arrays.
This fixes serialization of empty Binary/Utf8/List/LargeList (and Map) arrays.
Are these changes tested?
Yes
Are there any user-facing changes?
There should not be any breaking change for users. Serialized files for empty record batches will be slightly different. Older serialized files should still be read fine.