Skip to content

Commit

Permalink
fix: addressing reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Aug 14, 2024
1 parent d8ad4e7 commit 69d3afa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public ArrowBuf[] getBuffers(boolean clear) {
final List<ArrowBuf> buffers = new ArrayList<>();

for (final ValueVector vector : vectors.values()) {
for (final ArrowBuf buf : vector.getBuffers(clear)) {
for (final ArrowBuf buf : vector.getBuffers(false)) {
buffers.add(buf);
if (clear) {
buf.getReferenceManager().retain(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,17 @@ public void reset() {
valueCount = 0;
}

/**
* Return the underlying buffers associated with this vector. Note that this doesn't impact the
* reference counts for this buffer, so it only should be used for in-context access. Also note
* that this buffer changes regularly, thus external classes shouldn't hold a reference to it
* (unless they change it).
*
* @param clear Whether to clear vector before returning, the buffers will still be refcounted but
* the returned array will be the only reference to them. Also, this won't clear the child
* buffers.
* @return The underlying {@link ArrowBuf buffers} that is used by this vector instance.
*/
@Override
public ArrowBuf[] getBuffers(boolean clear) {
setReaderAndWriterIndex();
Expand All @@ -369,7 +380,7 @@ public ArrowBuf[] getBuffers(boolean clear) {
} else {
List<ArrowBuf> list = new ArrayList<>();
list.add(validityBuffer);
list.addAll(Arrays.asList(vector.getBuffers(clear)));
list.addAll(Arrays.asList(vector.getBuffers(false)));
buffers = list.toArray(new ArrowBuf[list.size()]);
}
if (clear) {
Expand Down

0 comments on commit 69d3afa

Please sign in to comment.