[
https://issues.apache.org/jira/browse/DRILL-6234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16396148#comment-16396148
]
Paul Rogers commented on DRILL-6234:
------------------------------------
As it turns out, {{setValueCount()}} is descriptive, not proscriptive. That is,
{{setValueCount()}} says how many items are actually in the vector, not how
many you would like to hold. Use {{allocateNew()}} to specify the number of
entries (and entry width) you'd like to hold.
In general, the pattern that Drill use (for better or worse) is:
* Create the vector instance
* Allocate the vector memory with {{allocateNew()}}
* Write values into the vector.
* Report the number of items written with {{setValueCount()}}.
If you get an error, it is likely because you are trying to set the value count
to greater than the actual number of entries.
There was a known bug that setting the count to 0, when the vector was
unallocated, lead to an error.
> VarCharVector setValueCount can throw out of memory exception
> -------------------------------------------------------------
>
> Key: DRILL-6234
> URL: https://issues.apache.org/jira/browse/DRILL-6234
> Project: Apache Drill
> Issue Type: Improvement
> Reporter: Timothy Farkas
> Assignee: Timothy Farkas
> Priority: Major
>
> Doing the following will throw an Index out of bounds exception.
> {code}
> final VarCharVector vector = new VarCharVector(field, allocator);
> vector.allocateNew();
> vector.getMutator().setValueCount(100);
> {code}
> The expected behavior is to resize the array appropriately. If an index is
> uninitialized it can return an empty byte array.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)