Skip to content

Commit 2053d94

Browse files
committed
Add test case
Change-Id: Ica73595ccddbfbecfbdafb2558157778a08e7240
1 parent 9c22949 commit 2053d94

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

python/pyarrow/tests/test_convert_builtin.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,3 +529,23 @@ def test_struct_from_dicts():
529529
{'a': None, 'b': None, 'c': None},
530530
{'a': None, 'b': 'bar', 'c': None}]
531531
assert arr.to_pylist() == expected
532+
533+
534+
def test_structarray_from_arrays_coerce():
535+
# ARROW-1706
536+
ints = [None, 2, 3]
537+
strs = [u'a', None, u'c']
538+
bools = [True, False, None]
539+
ints_nonnull = [1, 2, 3]
540+
541+
result = pa.StructArray.from_arrays([ints, strs, bools, ints_nonnull],
542+
['ints', 'strs', 'bools',
543+
'int_nonnull'])
544+
expected = pa.StructArray.from_arrays(
545+
[pa.array(ints, type='int64'),
546+
pa.array(strs, type='utf8'),
547+
pa.array(bools),
548+
pa.array(ints_nonnull, type='int64')],
549+
['ints', 'strs', 'bools', 'int_nonnull'])
550+
551+
assert result.equals(expected)

0 commit comments

Comments
 (0)