skyon0522-ai opened a new pull request, #52358:
URL: https://github.com/apache/arrow/pull/52358

   ### 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 
c7944b35f3cbcd38dbc607b7405833e82697c7b7 with this patch:
   
   - TestVectorNested.*: 7 passed.
   - Related map and value_parent_indices Python tests: 9 passed, including the 
4 focused value_parent_indices tests.
   - Seven additional checks on the identified fixed build passed, covering map 
errors, an equivalent list of structs, empty inputs, chunked inputs, and 
existing struct rejection.
   - Repository-pinned clang-format 18.1.8, configured flake8 6.1.0, and git 
diff --check passed.
   
   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:**
   
   - [ ] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [x] Human
   - [x] AI
   - [ ] Not reviewed
   
   Closes #45880.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to