Skip to content

Commit

Permalink
ARROW-402: Fix reference counting issue with empty buffers. Close #232
Browse files Browse the repository at this point in the history
Change-Id: I87910c03d7ebca5a8edbf53d01f70c38ef339f04
  • Loading branch information
julienledem authored and wesm committed Dec 9, 2016
1 parent 14ed1be commit 8995c92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public BitVector(String name, BufferAllocator allocator) {
public void load(ArrowFieldNode fieldNode, ArrowBuf data) {
// When the vector is all nulls or all defined, the content of the buffer can be omitted
if (data.readableBytes() == 0 && fieldNode.getLength() != 0) {
data.release();
int count = fieldNode.getLength();
allocateNew(count);
int n = getSizeFromCount(count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public void testLoadEmptyValidityBuffer() throws IOException {
new Field("intNull", true, new ArrowType.Int(32, true), Collections.<Field>emptyList())
));
int count = 10;
ArrowBuf validity = allocator.getEmpty();
ArrowBuf validity = allocator.buffer(10).slice(0, 0);
ArrowBuf[] values = new ArrowBuf[2];
for (int i = 0; i < values.length; i++) {
ArrowBuf arrowBuf = allocator.buffer(count * 4); // integers
Expand Down Expand Up @@ -236,6 +236,7 @@ public void testLoadEmptyValidityBuffer() throws IOException {
for (ArrowBuf arrowBuf : values) {
arrowBuf.release();
}
validity.release();
}
}

Expand Down

0 comments on commit 8995c92

Please sign in to comment.