diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java index 99a24052b2794..b19691e7aaab7 100644 --- a/java/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java +++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java @@ -64,6 +64,10 @@ * * The latter three are managed by its superclass. */ + +/* +* TODO: consider merging the functionality in `BaseRepeatedValueVector` into this class. +*/ public class ListViewVector extends BaseRepeatedValueViewVector implements PromotableVector { protected ArrowBuf validityBuffer; @@ -259,7 +263,11 @@ public void allocateNew() throws OutOfMemoryException { public boolean allocateNewSafe() { boolean success = false; try { - /* release the current buffers, hence this is a new allocation */ + /* release the current buffers, hence this is a new allocation + * Note that, the `clear` method call below is releasing validityBuffer + * calling the superclass clear method which is releasing the associated buffers + * (sizeBuffer and offsetBuffer). + */ clear(); /* allocate validity buffer */ allocateValidityBuffer(validityAllocationSizeInBytes); @@ -519,6 +527,7 @@ public MinorType getMinorType() { */ @Override public void clear() { + // calling superclass clear method which is releasing the sizeBufer and offsetBuffer super.clear(); validityBuffer = releaseBuffer(validityBuffer); }