kszucs commented on a change in pull request #7952:
URL: https://github.com/apache/arrow/pull/7952#discussion_r471360126
##########
File path: python/pyarrow/tests/test_array.py
##########
@@ -975,6 +975,47 @@ def check_result(result, expected_field_names,
expected_type_codes,
arr = pa.UnionArray.from_sparse(logical_types, [binary, int64[1:]])
+def test_union_array_to_pylist_with_nulls():
+ # ARROW-9556
+ arr = pa.UnionArray.from_sparse(
+ pa.array([0, 1, 0, 0, 1], type=pa.int8()),
+ [
+ pa.array([0.0, 1.1, None, 3.3, 4.4]),
+ pa.array([True, True, False, True, False]),
+ ]
+ )
+ assert arr.to_pylist() == [0.0, True, None, 3.3, False]
+
+ arr = pa.UnionArray.from_sparse(
+ pa.array([0, 1, 0, 0, 1], type=pa.int8()),
+ [
+ pa.array([0.0, 1.1, None, 3.3, 4.4]),
+ pa.array([True, None, False, True, False]),
+ ]
+ )
+ assert arr.to_pylist() == [0.0, None, None, 3.3, False]
Review comment:
The first example has nulls in a single child the second in both
children - I'm going to keep a second ones.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]