You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by sm...@apache.org on 2017/06/08 22:00:02 UTC
[2/6] arrow git commit: ARROW-1108: [JAVA] Check if ArrowBuf is empty
buffer in getActualConsumedMemory() and getPossibleConsumedMemory()
ARROW-1108: [JAVA] Check if ArrowBuf is empty buffer in getActualConsumedMemory() and getPossibleConsumedMemory()
Closes #744
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/6d71b8c4
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/6d71b8c4
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/6d71b8c4
Branch: refs/heads/master
Commit: 6d71b8c44d5af72a0c8dab79fc16718e21d5ee8d
Parents: 6c3024b
Author: Steven Phillips <st...@dremio.com>
Authored: Mon Mar 27 14:24:01 2017 -0700
Committer: Steven Phillips <st...@dremio.com>
Committed: Thu Jun 8 14:57:45 2017 -0700
----------------------------------------------------------------------
java/memory/src/main/java/io/netty/buffer/ArrowBuf.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/6d71b8c4/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
----------------------------------------------------------------------
diff --git a/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java b/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
index e777b5a..06272a7 100644
--- a/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
+++ b/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
@@ -796,6 +796,9 @@ public final class ArrowBuf extends AbstractByteBuf implements AutoCloseable {
* @return Size in bytes.
*/
public int getPossibleMemoryConsumed() {
+ if (isEmpty) {
+ return 0;
+ }
return ledger.getSize();
}
@@ -807,6 +810,9 @@ public final class ArrowBuf extends AbstractByteBuf implements AutoCloseable {
* @return Size in bytes.
*/
public int getActualMemoryConsumed() {
+ if (isEmpty) {
+ return 0;
+ }
return ledger.getAccountedSize();
}