[
https://issues.apache.org/jira/browse/ARROW-485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15822969#comment-15822969
]
Jacques Nadeau commented on ARROW-485:
--------------------------------------
There should be better documentation on this. In order to use vectors, the
correct order of operations are:
1. allocateNew() (allocate memory for the vector)
2. Set one or more values using getMutator().setSafe(i, val). Note, this has to
be monotonically increasing position but allows index skips.
3. call set valueCount(n) where n is the number of valid indices in the vector
4. read or serialize data
I believe that if you follow these operations, you will not have a problem
here. I'm guessing you're trying to use a vector before allocating (1).
> [Java] Users are required to initialize VariableLengthVectors.offsetVector
> before calling VariableLengthVectors.mutator.getSafe
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: ARROW-485
> URL: https://issues.apache.org/jira/browse/ARROW-485
> Project: Apache Arrow
> Issue Type: Improvement
> Reporter: Li Jin
> Priority: Minor
>
> https://github.com/apache/arrow/blob/master/java/vector/src/main/codegen/templates/VariableLengthVectors.java#L492
> Here VariableLengthVectors.getMutator().setSafe() calls:
> {code}
> offsetVector.getAccessor().get(index)
> {code}
> however, index 0 of offsetVector (which is always 0) is not initialized by
> VariableLengthVectors.
> As a result, user of the VariableLengthVectors needs to manually initialize
> the class by calling:
> {code}
> VariableLengthVectors.getOffsetVector().getMutator().setSafe(0, 0)
> {code}
> I wonder if this is necessary or should VariableLengthVectors initialize this
> for the user
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)