apache / apache/arrow

Fields within a null struct are not initialized with null values

Open
#41,833 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.

When creating an array from a python dict, field entries of a null struct are initialized with default values rather than null even if their field is nullable. In the minimal example below, you would expect the 3rd row to have values of `inner_1` and `inner_2` to be null.

```
import pyarrow as pa

print(pa.array([
{"outer": {"inner_1": 1, "inner_2": 2}},
{"outer": {"inner_1": 3, "inner_2": None}},
{"outer": None},
]))
```

Generates the following output:

```
-- is_valid: all not null
-- child 0 type: struct
-- is_valid:
[
true,
true,
false
]
-- child 0 type: int64
[
1,
3,
0
]
-- child 1 type: int64
[
2,
null,
0
]
```

### 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.