lidavidm commented on code in PR #41967:
URL: https://github.com/apache/arrow/pull/41967#discussion_r1635891976
##########
java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java:
##########
@@ -227,10 +227,39 @@ public List<ArrowBuf> visit(ArrowType.Utf8 type) {
}
}
+ private List<ArrowBuf> visitVariableWidthView(ArrowType type) {
+ final int viewBufferIndex = 1;
+ final int variadicSizeBufferIndex = this.buffers.length - 1;
+ final long numOfVariadicBuffers = this.buffers.length - 3;
+ final long variadicSizeBufferCapacity = numOfVariadicBuffers * Long.BYTES;
+ List<ArrowBuf> buffers = new ArrayList<>();
+
+ try (ArrowBuf variadicSizeBuffer =
+ importBuffer(type, variadicSizeBufferIndex,
variadicSizeBufferCapacity)) {
+ ArrowBuf maybeValidityBuffer = maybeImportBitmap(type);
+ try (ArrowBuf view =
+ importFixedBytes(type, viewBufferIndex,
BaseVariableWidthViewVector.ELEMENT_SIZE)) {
+ view.getReferenceManager().retain();
+ buffers.add(maybeValidityBuffer);
+ buffers.add(view);
+ }
+ // 0th buffer is validity buffer
+ // 1st buffer is view buffer
+ // 2nd buffer onwards are variadic buffer
+ // N-1 (this.buffers.length - 1) buffer is variadic size buffer
+ final int variadicBufferReadOffset = 2;
+ variadicSizeBuffer.getReferenceManager().retain();
Review Comment:
It's only used during import. We should discard it as soon as we're done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]