apache / apache/arrow

[Python] cast doesn't work for structure in pyarrow

Open
#35,408 0 comments 2 reactions 0 assignees View on GitHub
Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 18h
Merged PRs (30d)
91

Description

### Describe the bug, including details regarding any error messages, version, and platform.

these are the links for the C++ issue that was solved and closed.

https://issues.apache.org/jira/browse/ARROW-1888
https://github.com/apache/arrow/issues/17882

please do the same for python:

>> import pyarrow as pa
>> pa.__version__
'12.0.0

>> pa_bytes = pa_result.cast(target_type=pa.uint8())
Traceback (most recent call last):
File "", line 1, in
File "pyarrow/array.pxi", line 935, in pyarrow.lib.Array.cast
File "/usr/local/lib/python3.8/site-packages/pyarrow/compute.py", line 400, in cast
return call_function("cast", [arr], options, memory_pool)
File "pyarrow/_compute.pyx", line 572, in pyarrow._compute.call_function
File "pyarrow/_compute.pyx", line 367, in pyarrow._compute.Function.call
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 121, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: Unsupported cast from struct to uint8 using function cast_uint8

### Component(s)

Python

Contributor guide

Open the contributing guide

Research direction

Start at the Python Array.cast entry point in pyarrow/array.pxi and follow the cast path through pyarrow/compute.py and pyarrow/_compute.pyx. Compare the behavior with ARROW-1888 and GitHub issue 17882, then verify that the reproduced struct to uint8 cast no longer raises ArrowNotImplementedError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.