danepitkin commented on code in PR #39813:
URL: https://github.com/apache/arrow/pull/39813#discussion_r1474823872
##########
python/pyarrow/array.pxi:
##########
@@ -2460,6 +2460,403 @@ cdef class LargeListArray(BaseListArray):
return pyarrow_wrap_array((<CLargeListArray*> self.ap).offsets())
+cdef class ListViewArray(Array):
+ """
+ Concrete class for Arrow arrays of a list view data type.
+ """
+
+ @staticmethod
+ def from_arrays(offsets, sizes, values, DataType type=None, MemoryPool
pool=None, mask=None):
+ """
+ Construct ListViewArray from arrays of int32 offsets, sizes, and
values.
+
+ Parameters
+ ----------
+ offsets : Array (int32 type)
+ sizes : Array (int32 type)
+ values : Array (any type)
+ type : DataType, optional
+ If not specified, a default ListType with the values' type is
+ used.
+ pool : MemoryPool, optional
+ mask : Array (boolean type), optional
+ Indicate which values are null (True) or not null (False).
+
+ Returns
+ -------
+ list_view_array : ListViewArray
+
+ Examples
+ --------
+ >>> import pyarrow as pa
+ >>> values = pa.array([1, 2, 3, 4])
+ >>> offsets = pa.array([0, 1, 2])
+ >>> sizes = pa.array([2, 2, 2])
+ >>> pa.ListViewArray.from_arrays(offsets, sizes, values)
+ <pyarrow.lib.ListViewArray object at ...>
+ [
+ [
+ 1,
+ 2
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 3,
+ 4
+ ]
+ ]
+ >>> # nulls in the offsets array become null lists
+ >>> offsets = pa.array([0, None, 2])
Review Comment:
I will update this to use a null mask instead of `None`
--
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]