apache / apache/arrow

[Python][C++] Creating a MapArray with a null struct entry segfaults

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

Description

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

While this is invalid according to our spec, we should raise a proper exception about it instead of crashing:

```
data = [
[{'key': 'key1', 'value': 10}],
[{'key': 'key2', 'value': 8}, None, {'key': 'key3', 'value': 5}]
]
pa.array(data, type=pa.map_(pa.string(), pa.int32()))
```

gives:

```
/home/joris/scipy/repos/arrow/cpp/src/arrow/array/array_nested.cc:848: Check failed: _s.ok() Operation failed: ValidateChildData(data->child_data)
Bad status: Invalid: Map array child array should have no nulls
Aborted (core dumped)
```

(so we already have the correct status message, but this comes from the MapArray constructor that just does `ARROW_CHECK_OK(ValidateChildData(data->child_data));`, i.e. not bubbling it up as a status / python error.

### Component(s)

Python

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.