AlenkaF commented on code in PR #40313:
URL: https://github.com/apache/arrow/pull/40313#discussion_r1520981332


##########
docs/source/python/data.rst:
##########
@@ -230,6 +230,26 @@ like lists:
    nested_arr = pa.array([[], None, [1, 2], [None, 1]])
    print(nested_arr.type)
 
+ListView arrays
+~~~~~~~~~~~
+
+``pyarrow.array`` can create an alternate list type called ListView:
+
+.. ipython:: python
+
+   nested_arr = pa.array([[], None, [1, 2], [None, 1]], 
type=pa.list_view(pa.int64()))
+   print(nested_arr.type)
+
+ListView arrays can specify out-of-order offsets when constructed from arrays:
+
+.. ipython:: python
+
+   values = [1, 2, 3, 4, 5, 6]
+   offsets = [4, 2, 0]
+   sizes = [2, 2, 2]
+   arr = pa.ListViewArray.from_arrays(offsets, sizes, values)
+   print(arr)

Review Comment:
   `print()` statement is used in the rest of this file also - but - could we 
use only `arr` without print so that the whole output is printed out, together 
with `<pyarrow.lib.ListViewArray object at ...>`? Or maybe just use 
`pa.ListViewArray.from_arrays(offsets, sizes, values)` without assigning it to 
`arr`.



##########
docs/source/python/data.rst:
##########
@@ -230,6 +230,26 @@ like lists:
    nested_arr = pa.array([[], None, [1, 2], [None, 1]])
    print(nested_arr.type)
 
+ListView arrays
+~~~~~~~~~~~
+
+``pyarrow.array`` can create an alternate list type called ListView:
+
+.. ipython:: python
+
+   nested_arr = pa.array([[], None, [1, 2], [None, 1]], 
type=pa.list_view(pa.int64()))
+   print(nested_arr.type)
+
+ListView arrays can specify out-of-order offsets when constructed from arrays:

Review Comment:
   ```suggestion
   ListView arrays differ from List arrays in an additional buffer containing 
the sizes of each list value. ListView arrays can specify out-of-order offsets 
when constructed from arrays:
   ```
   
   Not sure how to put the info about the difference between a regular list and 
a list view. I think this info is needed, but the best way to do it might not 
be this one =)
   



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