Skip to content

Commit

Permalink
Fix some test failures and rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthteotia committed Apr 23, 2019
1 parent 9e8beb6 commit 2fbb2c5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void releaseRecordBatch(ArrowRecordBatch recordBatch) {
List<ArrowBuf> buffers = recordBatch.getBuffers();
recordBatch.close();
for (ArrowBuf buf : buffers) {
buf.release();
buf.getReferenceManager().release();
}
}

Expand Down
14 changes: 9 additions & 5 deletions java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,15 @@ private void ensureAccessible() {
* @return netty compliant {@link NettyArrowBuf}
*/
public NettyArrowBuf asNettyBuffer() {
return new NettyArrowBuf((UnsafeDirectLittleEndian)referenceManager.getUnderlying(),
this,
referenceManager.getByteBufAllocator(),
referenceManager.getOffsetForBuffer(this),
length);
final NettyArrowBuf nettyArrowBuf = new NettyArrowBuf(
(UnsafeDirectLittleEndian)referenceManager.getUnderlying(),
this,
referenceManager.getByteBufAllocator(),
referenceManager.getOffsetForBuffer(this),
length);
nettyArrowBuf.readerIndex(readerIndex);
nettyArrowBuf.writerIndex(writerIndex);
return nettyArrowBuf;
}

/**
Expand Down
22 changes: 18 additions & 4 deletions java/memory/src/main/java/io/netty/buffer/NettyArrowBuf.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ public int capacity() {
return arrowBuf.capacity();
}

@Override
public NettyArrowBuf slice() {
return arrowBuf.slice().asNettyBuffer();
}

@Override
public NettyArrowBuf slice(int index, int length) {
return arrowBuf.slice(index, length).asNettyBuffer();
}

@Override
public void close() {
arrowBuf.close();
Expand All @@ -200,13 +210,17 @@ public int writerIndex() {
}

@Override
public int readableBytes() {
return arrowBuf.readableBytes();
public NettyArrowBuf readerIndex(int readerIndex) {
super.readerIndex(readerIndex);
//arrowBuf.readerIndex(readerIndex);
return this;
}

@Override
public int writableBytes() {
return arrowBuf.writableBytes();
public NettyArrowBuf writerIndex(int writerIndex) {
super.writerIndex(writerIndex);
//arrowBuf.writerIndex(writerIndex);
return this;
}

@Override
Expand Down

0 comments on commit 2fbb2c5

Please sign in to comment.