jjbskir commented on a change in pull request #9142:
URL: https://github.com/apache/arrow/pull/9142#discussion_r555825490
##########
File path: docs/source/java/vector.rst
##########
@@ -217,6 +217,55 @@ to be declared is that writer/reader is not as efficient
as direct access
}
}
+Building ListVector
+==================
+
+A :class:`ListVector` is a vector that holds a list of values for each index.
Working with one you need to handle the same steps as mentioned above (create >
allocate > mutate > set value count > access > clear), but the details of how
you accomplish this are slightly different since you need to both create the
vector and set the list of values for each index.
+
+For example, the code below shows how to build a :class:`ListVector` of int's
using the writer :class:`UnionListWriter`. We build a vector from 0 to 9 and
each index contains a list with increasing values [[0, 0, 0, 0, 0], [0, 1, 2,
3, 4], [0, 2, 4, 6, 8], …, [0, 9, 18, 27, 36]].
+
Review comment:
Hey yea that is a possibility. We can always write in the docs that the
values can be added in arbitrary order. Or instead of using a for loop to add
the values we can have some predefined arrays we want to add in that have
arbitrary order like: [[1, 2, 3], [3, 2, 1], [10, 30, 20]]. Also looking at the
[tests for
ListVector](https://github.com/apache/arrow/blob/25c736d48dc289f457e74d15d05db65f6d539447/java/vector/src/test/java/org/apache/arrow/vector/TestListVector.java)
it looks like they all use ascending order.
----------------------------------------------------------------
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]