Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

jjbskir
Copy link
Contributor

@jjbskir jjbskir commented Jan 8, 2021

Added documentation for the Java ListVector class. I found using it to be difficult with out any concrete examples.

@github-actions
Copy link

github-actions bot commented Jan 8, 2021

Thanks for opening a pull request!

Could you open an issue for this pull request on JIRA?
https://issues.apache.org/jira/browse/ARROW

Then could you also rename pull request title in the following format?

ARROW-${JIRA_ID}: [${COMPONENT}] ${SUMMARY}

See also:

@jjbskir jjbskir changed the title Add Java ListVector Documentation ARROW-11193: [Java][Documentation] Add Java ListVector Documentation Jan 8, 2021
@github-actions
Copy link

github-actions bot commented Jan 8, 2021


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]].
Copy link
Member

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 ?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@liyafan82 liyafan82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@liyafan82
Copy link
Contributor

Merging. Thanks for your effort @jjbskir

@liyafan82 liyafan82 closed this in 5f1be95 Jan 18, 2021
@jjbskir
Copy link
Contributor Author

jjbskir commented Jan 19, 2021

Hey @liyafan82 wanted to check how often do you guys rebuild the docs for this page? https://arrow.apache.org/docs/java/

@liyafan82
Copy link
Contributor

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.

GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants