milesgranger commented on code in PR #13894:
URL: https://github.com/apache/arrow/pull/13894#discussion_r955899236


##########
python/pyarrow/tests/test_array.py:
##########
@@ -919,6 +919,53 @@ def test_list_from_arrays(list_array_type, 
list_type_factory):
         list_array_type.from_arrays(offsets, values, type=typ)
 
 
[email protected](('list_array_type', 'list_type_factory'), (
+    (pa.ListArray, pa.list_),
+    (pa.LargeListArray, pa.large_list)
+))
[email protected]("arr", (
+    [None, [0]],
+    [None, [0, None], [0]],
+    [[0], [1]],
+))
+def test_list_array_types_from_arrays(
+    list_array_type, list_type_factory, arr
+):
+    arr = pa.array(arr, list_type_factory(pa.int8()))
+    reconstructed_arr = list_array_type.from_arrays(
+        arr.offsets, arr.values, mask=arr.is_null())
+    assert arr == reconstructed_arr

Review Comment:
   Doesn't appears so:
   ```python
   In [1]: import pyarrow as pa
   In [2]: arr = pa.array([[0], None, [0, None], [0]], pa.list_(pa.int8()))
   In [3]: arr = arr[1:]
   In [4]: reconstructed_arr = pa.ListArray.from_arrays(arr.offsets, 
arr.values, mask=arr.is_null())
   In [5]: arr == reconstructed_arr
   Out[5]: False
   In [6]: arr
   Out[6]:
   <pyarrow.lib.ListArray object at 0x7f85d8375e20>
   [
     null,
     [
       0,
       null
     ],
     [
       0
     ]
   ]
   
   In [7]: reconstructed_arr
   Out[7]:
   <pyarrow.lib.ListArray object at 0x7f85a031c580>
   [
     [],
     [
       0,
       null
     ],
     null
   ]
   
   In [8]:
   ```
   Maybe it's somewhat related to 
[ARROW-16174](https://issues.apache.org/jira/browse/ARROW-16174)?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to