Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions python/pyarrow/array.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,9 @@ cdef class ListArray(Array):
with nogil:
check_status(CListArray.FromArrays(_offsets.ap[0], _values.ap[0],
cpool, &out))
return pyarrow_wrap_array(out)
cdef Array result = pyarrow_wrap_array(out)
result.validate()
return result

@property
def values(self):
Expand Down Expand Up @@ -1102,7 +1104,9 @@ cdef class LargeListArray(Array):
check_status(CLargeListArray.FromArrays(_offsets.ap[0],
_values.ap[0],
cpool, &out))
return pyarrow_wrap_array(out)
cdef Array result = pyarrow_wrap_array(out)
result.validate()
return result

def flatten(self):
"""
Expand Down
6 changes: 6 additions & 0 deletions python/pyarrow/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,12 @@ def test_list_from_arrays(list_array_type, list_type_factory):
type=list_type_factory(pa.binary()))
assert result.equals(expected)

# raise on invalid array
offsets = [1, 3, 10]
values = np.arange(5)
with pytest.raises(ValueError):
list_array_type.from_arrays(offsets, values)


def test_union_from_dense():
binary = pa.array([b'a', b'b', b'c', b'd'], type='binary')
Expand Down