You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2022/12/15 21:30:07 UTC
[arrow-rs] branch master updated: Add UnionArray test to arrow-pyarrow integration test (#3343)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 3a48242e3 Add UnionArray test to arrow-pyarrow integration test (#3343)
3a48242e3 is described below
commit 3a48242e3880ecfa87b912324a87338661711856
Author: Liang-Chi Hsieh <vi...@gmail.com>
AuthorDate: Thu Dec 15 13:30:02 2022 -0800
Add UnionArray test to arrow-pyarrow integration test (#3343)
---
.../tests/test_sql.py | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/arrow-pyarrow-integration-testing/tests/test_sql.py b/arrow-pyarrow-integration-testing/tests/test_sql.py
index 196dc7990..c97dad77e 100644
--- a/arrow-pyarrow-integration-testing/tests/test_sql.py
+++ b/arrow-pyarrow-integration-testing/tests/test_sql.py
@@ -358,6 +358,35 @@ def test_dictionary_python():
del a
del b
+def test_dense_union_python():
+ """
+ Python -> Rust -> Python
+ """
+ xs = pa.array([5, 6, 7])
+ ys = pa.array([False, True])
+ types = pa.array([0, 1, 1, 0, 0], type=pa.int8())
+ offsets = pa.array([0, 0, 1, 1, 2], type=pa.int32())
+ a = pa.UnionArray.from_dense(types, offsets, [xs, ys])
+
+ b = rust.round_trip_array(a)
+ assert a == b
+ del a
+ del b
+
+def test_sparse_union_python():
+ """
+ Python -> Rust -> Python
+ """
+ xs = pa.array([5, 6, 7])
+ ys = pa.array([False, False, True])
+ types = pa.array([0, 1, 1], type=pa.int8())
+ a = pa.UnionArray.from_sparse(types, [xs, ys])
+
+ b = rust.round_trip_array(a)
+ assert a == b
+ del a
+ del b
+
def test_record_batch_reader():
"""
Python -> Rust -> Python