Skip to content

Commit 7375a94

Browse files
committed
Add pyarrow integration test
1 parent ff3dc75 commit 7375a94

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

arrow-data/src/data.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,16 @@ impl ArrayData {
620620
vec![ArrayData::new_null(f.data_type(), *list_len as usize * len)],
621621
true,
622622
),
623+
DataType::ListView(f) => (
624+
vec![zeroed(len * 4), zeroed(len * 4)],
625+
vec![ArrayData::new_empty(f.data_type())],
626+
true,
627+
),
628+
DataType::LargeListView(f) => (
629+
vec![zeroed(len * 8), zeroed(len * 8)],
630+
vec![ArrayData::new_empty(f.data_type())],
631+
true,
632+
),
623633
DataType::Struct(fields) => (
624634
vec![],
625635
fields

arrow-pyarrow-integration-testing/tests/test_sql.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ def assert_pyarrow_leak():
7474
pa.list_(pa.int32()),
7575
pa.list_(pa.int32(), 2),
7676
pa.large_list(pa.uint16()),
77+
pa.list_view(pa.uint64()),
78+
pa.large_list_view(pa.uint64()),
79+
pa.list_view(pa.string()),
80+
pa.large_list_view(pa.string()),
7781
pa.struct(
7882
[
7983
pa.field("a", pa.int32()),
@@ -112,8 +116,6 @@ def assert_pyarrow_leak():
112116
),
113117
]
114118

115-
_unsupported_pyarrow_types = [
116-
]
117119

118120
# As of pyarrow 14, pyarrow implements the Arrow PyCapsule interface
119121
# (https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html).
@@ -158,12 +160,6 @@ def test_type_roundtrip_pycapsule(pyarrow_type):
158160
assert restored == pyarrow_type
159161
assert restored is not pyarrow_type
160162

161-
162-
@pytest.mark.parametrize("pyarrow_type", _unsupported_pyarrow_types, ids=str)
163-
def test_type_roundtrip_raises(pyarrow_type):
164-
with pytest.raises(pa.ArrowException):
165-
rust.round_trip_type(pyarrow_type)
166-
167163
@pytest.mark.parametrize('pyarrow_type', _supported_pyarrow_types, ids=str)
168164
def test_field_roundtrip(pyarrow_type):
169165
pyarrow_field = pa.field("test", pyarrow_type, nullable=True)
@@ -337,6 +333,20 @@ def test_list_array():
337333
del a
338334
del b
339335

336+
337+
def test_list_view_array():
338+
"""
339+
Python -> Rust -> Python
340+
"""
341+
a = pa.array([[], None, [1, 2], [4, 5, 6]], pa.list_view(pa.int64()))
342+
b = rust.round_trip_array(a)
343+
b.validate(full=True)
344+
assert a.to_pylist() == b.to_pylist()
345+
assert a.type == b.type
346+
del a
347+
del b
348+
349+
340350
def test_map_array():
341351
"""
342352
Python -> Rust -> Python

0 commit comments

Comments
 (0)