GH-50623: [C++][Python] Fix IPC serialization for extension storage layouts - #50884
Draft
fallenmi wants to merge 1 commit into
Draft
GH-50623: [C++][Python] Fix IPC serialization for extension storage layouts#50884fallenmi wants to merge 1 commit into
fallenmi wants to merge 1 commit into
Conversation
|
|
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 for this change
The IPC writer selected the top-level validity-buffer layout from the logical extension type. Extension arrays backed by null or union storage therefore received an extra validity-buffer entry, while the reader reconstructed the physical storage layout without that entry. The resulting buffer shift produced invalid data and could lead to a crash when values were accessed.
Fixes #50623.
Fixes #15068.
What changes are included in this PR?
DataType::storage_id(), which is unchanged for ordinary Arrow types and resolves to the physical type for extensions.int64column so a shifted buffer is detected directly.Are these changes tested?
main, both new regressions failed withBuffer #1 too smallvalidation errors.arrow-ipc-read-write-test: 412/412 passed with the officialarrow-testingdata.clang-format20.1.8 dry run andgit diff --check: passed.Are there any user-facing changes?
Yes. IPC file and stream roundtrips for extension types with null or union storage now preserve valid buffer layouts. There is no public API or ABI change.
This PR contains a Critical Fix. It prevents the IPC writer from producing invalid data for valid extension arrays and addresses the crash path described in #50623.
AI-assisted contribution disclosure
OpenAI Codex generated the patch and regression tests under the account owner authorization. Codex reproduced the issue on current
main, reviewed the complete diff, audited visible ownership and overlap, and ran the validation listed above. This PR remains a Draft pending the account owner personal review before it is marked ready.