New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARROW-11193: [Java][Documentation] Add Java ListVector Documentation #9142
Conversation
Thanks for opening a pull request! Could you open an issue for this pull request on JIRA? Then could you also rename pull request title in the following format?
See also: |
docs/source/java/vector.rst
Outdated
|
||
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 10 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]]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 0 to 10
-> 0 to 9
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for the catch, I will update the PR.
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]]. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The values of each index can be in arbitrary orders. This example may confuse the readers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 it looks like they all use ascending order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I see you point. It makes sense.
Maybe here we should not stress that the values are in increasing order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good I will update the docs to reflect this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Merging. Thanks for your effort @jjbskir |
Hey @liyafan82 wanted to check how often do you guys rebuild the docs for this page? https://arrow.apache.org/docs/java/ |
@jjbskir The website should be updated after the next release. |
Added documentation for the Java [ListVector](https://arrow.apache.org/docs/java/reference/org/apache/arrow/vector/complex/ListVector.html) class. I found using it to be difficult with out any concrete examples. Closes apache#9142 from jjbskir/patch-1 Authored-by: Jeremy <jjbskir@gmail.com> Signed-off-by: liyafan82 <fan_li_ya@foxmail.com>
Added documentation for the Java ListVector class. I found using it to be difficult with out any concrete examples.