Repository: arrow
Updated Branches:
  refs/heads/master 3487c2f0c -> 17e90e1d8


ARROW-290: Specialize alloc() in ArrowBuf

Author: Julien Le Dem <jul...@dremio.com>

Closes #136 from julienledem/alloc and squashes the following commits:

a19d16f [Julien Le Dem] ARROW-290: Specialize alloc() in ArrowBuf


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/17e90e1d
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/17e90e1d
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/17e90e1d

Branch: refs/heads/master
Commit: 17e90e1d88266ea224244647831f49d5bd1dac72
Parents: 3487c2f
Author: Julien Le Dem <jul...@dremio.com>
Authored: Fri Sep 16 16:01:17 2016 -0700
Committer: Julien Le Dem <jul...@dremio.com>
Committed: Fri Sep 16 16:01:17 2016 -0700

----------------------------------------------------------------------
 java/memory/src/main/java/io/netty/buffer/ArrowBuf.java  |  9 +++++----
 .../java/io/netty/buffer/UnsafeDirectLittleEndian.java   |  2 ++
 .../org/apache/arrow/memory/ArrowByteBufAllocator.java   |  4 ++++
 .../main/java/org/apache/arrow/memory/BaseAllocator.java | 11 +++++------
 4 files changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/17e90e1d/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 b7a268a..a5989c1 100644
--- a/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
+++ b/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.arrow.memory.AllocationManager.BufferLedger;
+import org.apache.arrow.memory.ArrowByteBufAllocator;
 import org.apache.arrow.memory.BaseAllocator;
 import org.apache.arrow.memory.BaseAllocator.Verbosity;
 import org.apache.arrow.memory.BoundsChecking;
@@ -52,7 +53,7 @@ public final class ArrowBuf extends AbstractByteBuf 
implements AutoCloseable {
   private final int offset;
   private final BufferLedger ledger;
   private final BufferManager bufManager;
-  private final ByteBufAllocator alloc;
+  private final ArrowByteBufAllocator alloc;
   private final boolean isEmpty;
   private volatile int length;
   private final HistoricalLog historicalLog = BaseAllocator.DEBUG ?
@@ -63,7 +64,7 @@ public final class ArrowBuf extends AbstractByteBuf 
implements AutoCloseable {
       final BufferLedger ledger,
       final UnsafeDirectLittleEndian byteBuf,
       final BufferManager manager,
-      final ByteBufAllocator alloc,
+      final ArrowByteBufAllocator alloc,
       final int offset,
       final int length,
       boolean isEmpty) {
@@ -297,8 +298,8 @@ public final class ArrowBuf extends AbstractByteBuf 
implements AutoCloseable {
   }
 
   @Override
-  public ByteBufAllocator alloc() {
-    return udle.alloc();
+  public ArrowByteBufAllocator alloc() {
+    return alloc;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/arrow/blob/17e90e1d/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java
----------------------------------------------------------------------
diff --git 
a/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java 
b/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java
index dc93602..023a6a2 100644
--- a/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java
+++ b/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java
@@ -26,6 +26,8 @@ import java.io.OutputStream;
 import java.nio.ByteOrder;
 import java.util.concurrent.atomic.AtomicLong;
 
+import io.netty.util.internal.PlatformDependent;
+
 /**
  * The underlying class we use for little-endian access to memory. Is used 
underneath ArrowBufs to abstract away the
  * Netty classes and underlying Netty memory management.

http://git-wip-us.apache.org/repos/asf/arrow/blob/17e90e1d/java/memory/src/main/java/org/apache/arrow/memory/ArrowByteBufAllocator.java
----------------------------------------------------------------------
diff --git 
a/java/memory/src/main/java/org/apache/arrow/memory/ArrowByteBufAllocator.java 
b/java/memory/src/main/java/org/apache/arrow/memory/ArrowByteBufAllocator.java
index f3f72fa..5dc5ac3 100644
--- 
a/java/memory/src/main/java/org/apache/arrow/memory/ArrowByteBufAllocator.java
+++ 
b/java/memory/src/main/java/org/apache/arrow/memory/ArrowByteBufAllocator.java
@@ -39,6 +39,10 @@ public class ArrowByteBufAllocator implements 
ByteBufAllocator {
     this.allocator = allocator;
   }
 
+  public BufferAllocator unwrap() {
+    return allocator;
+  }
+
   @Override
   public ByteBuf buffer() {
     return buffer(DEFAULT_BUFFER_SIZE);

http://git-wip-us.apache.org/repos/asf/arrow/blob/17e90e1d/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java
----------------------------------------------------------------------
diff --git 
a/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java 
b/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java
index f1503c9..dbb0705 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java
@@ -17,10 +17,6 @@
  */
 package org.apache.arrow.memory;
 
-import io.netty.buffer.ArrowBuf;
-import io.netty.buffer.ByteBufAllocator;
-import io.netty.buffer.UnsafeDirectLittleEndian;
-
 import java.util.Arrays;
 import java.util.IdentityHashMap;
 import java.util.Set;
@@ -33,6 +29,9 @@ import org.apache.arrow.memory.util.HistoricalLog;
 
 import com.google.common.base.Preconditions;
 
+import io.netty.buffer.ArrowBuf;
+import io.netty.buffer.UnsafeDirectLittleEndian;
+
 public abstract class BaseAllocator extends Accountant implements 
BufferAllocator {
   private static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(BaseAllocator.class);
 
@@ -47,7 +46,7 @@ public abstract class BaseAllocator extends Accountant 
implements BufferAllocato
   private final Object DEBUG_LOCK = DEBUG ? new Object() : null;
 
   private final BaseAllocator parentAllocator;
-  private final ByteBufAllocator thisAsByteBufAllocator;
+  private final ArrowByteBufAllocator thisAsByteBufAllocator;
   private final IdentityHashMap<BaseAllocator, Object> childAllocators;
   private final ArrowBuf empty;
 
@@ -247,7 +246,7 @@ public abstract class BaseAllocator extends Accountant 
implements BufferAllocato
   }
 
   @Override
-  public ByteBufAllocator getAsByteBufAllocator() {
+  public ArrowByteBufAllocator getAsByteBufAllocator() {
     return thisAsByteBufAllocator;
   }
 

Reply via email to