Describe the enhancement requested
FixedSizeListVector#getObject already performs this optimization; however, ListVector, ListViewVector, LargeListVector, and LargeListViewVector do not yet presize the result JsonStringArrayList requiring dynamic reallocations as elements are converted & added. This can become a scalability bottleneck when using these types.
Example of FixedSizeListVector presizing:
| publicList<?> getObject(intindex) { |
| if (isSet(index) == 0) { |
| returnnull; |
| } |
| finalList<Object> vals = newJsonStringArrayList<>(listSize); |
| for (inti = 0; i < listSize; i++) { |
| vals.add(vector.getObject(index * listSize + i)); |
Example ListVector not presizing:
| publicList<?> getObject(intindex) { |
| if (isSet(index) == 0) { |
| returnnull; |
| } |
| finalList<Object> vals = newJsonStringArrayList<>(); |
| finalintstart = offsetBuffer.getInt(index * OFFSET_WIDTH); |
| finalintend = offsetBuffer.getInt((index + 1) * OFFSET_WIDTH); |
| finalValueVectorvv = getDataVector(); |
| for (inti = start; i < end; i++) { |
| vals.add(vv.getObject(i)); |
Describe the enhancement requested
FixedSizeListVector#getObjectalready performs this optimization; however,ListVector,ListViewVector,LargeListVector, andLargeListViewVectordo not yet presize the resultJsonStringArrayListrequiring dynamic reallocations as elements are converted & added. This can become a scalability bottleneck when using these types.Example of
FixedSizeListVectorpresizing:arrow-java/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java
Lines 476 to 482 in a6245ab
Example
ListVectornot presizing:arrow-java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java
Lines 718 to 727 in a6245ab