Joris Van den Bossche created ARROW-15478:
---------------------------------------------
Summary: [C++] Creating (or casting to) list array with
non-nullable field doesn't check nulls
Key: ARROW-15478
URL: https://issues.apache.org/jira/browse/ARROW-15478
Project: Apache Arrow
Issue Type: Improvement
Components: C++
Reporter: Joris Van den Bossche
When creating a ListArray where you indicate that the values field is not
nullable, you can actually create the array with nulls without this is being
validated:
{code:python}
>>> typ = pa.list_(pa.field("element", pa.int64(), nullable=False))
>>> arr = pa.array([[1, 2], [3, 4, None]], typ)
>>> arr
<pyarrow.lib.ListArray object at 0x7f75bdeba760>
[
[
1,
2
],
[
3,
4,
null
]
]
>>> arr.type
ListType(list<element: int64 not null>)
{code}
Also explicitly validating it doesn't raise:
{code:python}
>>> arr.validate(full=True)
{code}
Is this something we should check?
What guarantees do we attach to the nullability of a field of a nested type?
--
This message was sent by Atlassian Jira
(v8.20.1#820001)