Repository navigation
GH-45880: [C++][Python] Return TypeError for map parent indices - #52358
Open
skyon0522-ai wants to merge 1 commit into
Open
skyon0522-ai wants to merge 1 commit into
skyon0522-ai 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
MapArray.value_parent_indices() can terminate the Python process, as reported in #45880. MapType inherits ListType, so the list_parent_indices visitor falls through to Visit(const ListType&) and constructs a ListArray from MAP data. The internal type check then fails.
What changes are included in this PR?
Add an explicit MapType overload that delegates to the existing unsupported-input TypeError path. This preserves the kernel's current supported-input contract; it does not add parent-index computation for maps.
Add C++ regression coverage for a MapArray and a nonempty chunked map, plus Python coverage for the exposed method and the compute function.
Are these changes tested?
On Ubuntu 24.04 with Python 3.12.3, built C++ and editable PyArrow from c7944b3 with this patch:
The pre-fix termination was not re-executed locally. The diagnosis uses the original issue and maintainer reproduction, the current source path, and fixed-build regression results. The full Arrow suite and cross-platform CI were not run locally.
Are there any user-facing changes?
Calling the unsupported operation on a MapArray now raises ArrowTypeError, so Python callers can handle the error instead of losing the process. Existing supported list behavior and the zero-chunk path are preserved.
Was AI used for this PR?
AI tools assisted with source investigation, the code and tests, local validation, independent review, and this description. The submitting author reviewed the patch, confirmed that they understand and can investigate the changes, and accepts responsibility for the submission.
PR code and description written by:
Reviewed before submission by:
Closes #45880.
MapArray.value_parent_indices()crashes (probably segfaults) #45880