apache / apache/arrow

[C++] Unsupported cast using function cast_struct

Open
#32,607 1 comment 0 reactions 0 assignees View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

Casting of structs that were introduced in ARROW-1888 no longer seems to work on the new 9.0.0 release. However, works on the older 8.0.0 release.
I've included the same example given in ARROW-1888 to reproduce the error.

 

Steps to reproduce:

`arr = pa.array([\\{'a': 1, 'b': None}, \\{'a': 2, 'b': None}])`
`print(arr.type)`
`arr.cast(pa.struct([('a', pa.int64()), ('b', pa.int64())]))`

 

Expected:

` – is_valid: all not null – child 0 type: int64 [ 1, 2 ] – child 1 type: int64 [ null, null ] `

 

Actual Results:

`ArrowNotImplementedError: Unsupported cast from struct to struct using function cast_struct`

 

 

**Reporter**: [Hyun S](https://issues.apache.org/jira/browse/ARROW-17333)

**Note**: *This issue was originally created as [ARROW-17333](https://issues.apache.org/jira/browse/ARROW-17333). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Run the Python reproduction using pa.array and arr.cast with the struct containing a null-only field, then inspect the cast_struct entry point and the ARROW-1888 example. Done means the cast succeeds on the 9.0.0 behavior and produces the expected StructArray with int64 child fields, including null values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.