From 7cf56d715d7703254c6f5b056c2cac82c00f4079 Mon Sep 17 00:00:00 2001 From: Vibhatha Abeykoon Date: Tue, 14 May 2024 14:09:09 +0530 Subject: [PATCH] fix: addressing reviews 12: adding comments regarding merging functionality --- .../apache/arrow/vector/complex/ListViewVector.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); }