drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [15/45] drill git commit: DRILL-3987: (REFACTOR) Working TPCH unit tests
Date Fri, 13 Nov 2015 02:37:45 GMT
DRILL-3987: (REFACTOR) Working TPCH unit tests

- Rename DecimalUtility.integerSize to INTEGER_SIZE as is constant
- Refactor BufferManager from BufferManagerImpl


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

Branch: refs/heads/master
Commit: a8297dfe975b3437cf6af2996b6527e1dfe9692e
Parents: 4524fdb
Author: Jacques Nadeau <jacques@apache.org>
Authored: Sat Nov 7 18:41:03 2015 -0800
Committer: Jacques Nadeau <jacques@apache.org>
Committed: Thu Nov 12 17:00:46 2015 -0800

----------------------------------------------------------------------
 exec/java-exec/pom.xml                          | 32 +++++++++++++++++---
 .../Decimal/CastDecimalDenseDecimalSparse.java  |  8 ++---
 .../templates/Decimal/CastDecimalSimilar.java   |  2 +-
 .../Decimal/CastDecimalSparseDecimalDense.java  | 12 ++++----
 .../templates/Decimal/CastDownwardDecimal.java  |  2 +-
 .../templates/Decimal/CastFloatDecimal.java     |  2 +-
 .../templates/Decimal/CastIntDecimal.java       |  2 +-
 .../templates/Decimal/CastSrcDecimalSimple.java |  6 ++--
 .../templates/Decimal/CastVarCharDecimal.java   |  2 +-
 .../templates/Decimal/DecimalFunctions.java     | 10 +++---
 .../src/main/codegen/templates/TypeHelper.java  |  2 +-
 .../apache/drill/exec/memory/AccountorImpl.java | 11 +++++--
 .../drill/exec/memory/TopLevelAllocator.java    |  4 ++-
 .../drill/exec/ops/BufferManagerImpl.java       | 17 +++++++++++
 .../drill/exec/memory/TestAllocators.java       |  4 +--
 exec/vector/pom.xml                             | 10 ++++++
 .../main/codegen/templates/BasicTypeHelper.java |  4 +--
 17 files changed, 95 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index da072d0..a0398b7 100644
--- a/exec/java-exec/pom.xml
+++ b/exec/java-exec/pom.xml
@@ -471,11 +471,12 @@
   </profiles>
 
   <build>
+  
     <plugins>
       <plugin>
         <artifactId>maven-resources-plugin</artifactId>
         <executions>
-          <execution> <!-- copy all templates in the same location to compile them
at once -->
+          <execution> <!-- copy all templates/data in the same location to compile
them at once -->
             <id>copy-fmpp-resources</id>
             <phase>initialize</phase>
             <goals><goal>copy-resources</goal></goals>
@@ -492,12 +493,12 @@
         </executions>
       </plugin>
       <plugin>
-        <!-- Extract parser grammar template from calcite-core.jar and put 
-          it under ${project.build.directory}/codegen/templates where all freemarker templates
are. -->
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <version>2.8</version>
         <executions>
+        <!-- Extract parser grammar template from calcite-core.jar and put 
+          it under ${project.build.directory}/codegen/templates where all freemarker templates
are. -->
           <execution>
             <id>unpack-parser-template</id>
             <phase>initialize</phase>
@@ -517,8 +518,31 @@
               </artifactItems>
             </configuration>
           </execution>
+          
+        <!-- Extract ValueVectorTypes.tdd from drill-vector.jar and put 
+          it under ${project.build.directory}/codegen/data where all freemarker data files
are. -->
+          <execution>
+            <id>unpack-vector-types</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.apache.drill.exec</groupId>
+                  <artifactId>vector</artifactId>
+                  <type>jar</type>
+                  <overWrite>true</overWrite>
+                  <outputDirectory>${project.build.directory}/</outputDirectory>
+                  <includes>codegen/data/ValueVectorTypes.tdd</includes>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>          
         </executions>
       </plugin>
+
       <plugin> <!-- generate sources from fmpp -->
         <groupId>org.apache.drill.tools</groupId>
         <artifactId>drill-fmpp-maven-plugin</artifactId>
@@ -536,7 +560,7 @@
             <phase>generate-sources</phase>
             <goals><goal>generate</goal></goals>
             <configuration>
-              <config>src/main/codegen/config.fmpp</config>
+              <config>${project.build.directory}/codegen/config.fmpp</config>
               <output>${project.build.directory}/generated-sources</output>
               <templates>${project.build.directory}/codegen/templates</templates>
             </configuration>

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalDenseDecimalSparse.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalDenseDecimalSparse.java
b/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalDenseDecimalSparse.java
index 4713041..a110ed7 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalDenseDecimalSparse.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalDenseDecimalSparse.java
@@ -53,7 +53,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
     @Output ${type.to}Holder out;
 
     public void setup() {
-        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
         buffer = buffer.reallocIfNeeded(size);
     }
 
@@ -75,7 +75,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
          * representation rearrange the bits so that we use 32 bits represent the digits.
          */
 
-        byte[] intermediateBytes = new byte[(in.nDecimalDigits * org.apache.drill.exec.util.DecimalUtility.integerSize)
+ 1];
+        byte[] intermediateBytes = new byte[(in.nDecimalDigits * org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE)
+ 1];
 
         int[] mask = {0x03, 0x0F, 0x3F, 0xFF};
         int[] reverseMask = {0xFC, 0xF0, 0xC0, 0x00};
@@ -104,7 +104,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
             inputIndex++;
             intermediateIndex++;
 
-            if (((intermediateIndex - 1) % org.apache.drill.exec.util.DecimalUtility.integerSize)
== 0) {
+            if (((intermediateIndex - 1) % org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE)
== 0) {
                 shiftBits = (byte) ((shiftBits & 0xFF) >>> 2);
                 maskIndex++;
                 shiftOrder -= 2;
@@ -119,7 +119,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
          * Now we transfer the bytes into a integer array and separate out the scale and
          * integer part of the decimal. Also pad the scale part with zeroes if needed
          */
-        int[] intermediate = new int[(intermediateBytes.length/org.apache.drill.exec.util.DecimalUtility.integerSize)
+ 1];
+        int[] intermediate = new int[(intermediateBytes.length/org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE)
+ 1];
 
         java.nio.ByteBuffer wrapper = java.nio.ByteBuffer.wrap(intermediateBytes);
         intermediate[0] = wrapper.get(0);

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSimilar.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSimilar.java b/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSimilar.java
index f9b7430..5ab34ad 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSimilar.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSimilar.java
@@ -55,7 +55,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
     @Output ${type.to}Holder out;
 
     public void setup() {
-        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
         buffer = buffer.reallocIfNeeded(size);
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSparseDecimalDense.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSparseDecimalDense.java
b/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSparseDecimalDense.java
index a94eb12..62b3229 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSparseDecimalDense.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalSparseDecimalDense.java
@@ -53,7 +53,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
     @Output ${type.to}Holder out;
 
     public void setup() {
-        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
         buffer = buffer.reallocIfNeeded(size);
     }
 
@@ -124,14 +124,14 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
          */
 
           /* Allocate a byte array */
-          int size = (((intermediate.length - 1) * org.apache.drill.exec.util.DecimalUtility.integerSize)
+ 1);
+          int size = (((intermediate.length - 1) * org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE)
+ 1);
           byte[] intermediateBytes = new byte[size];
           java.nio.ByteBuffer wrapper = java.nio.ByteBuffer.wrap(intermediateBytes);
 
           wrapper.put((byte) intermediate[0]);
 
           for (int i = 1; i < intermediate.length; i++) {
-            wrapper.put(java.nio.ByteBuffer.allocate(org.apache.drill.exec.util.DecimalUtility.integerSize).putInt(intermediate[i]).array());
+            wrapper.put(java.nio.ByteBuffer.allocate(org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE).putInt(intermediate[i]).array());
           }
 
           final int[] mask = {0x03, 0x0F, 0x3F, 0xFF};
@@ -139,21 +139,21 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
           int shiftOrder = 2;
 
           // Start just after the last integer and shift bits to the right
-          index = size - (org.apache.drill.exec.util.DecimalUtility.integerSize+ 1);
+          index = size - (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE+ 1);
 
           while (index >= 0) {
 
               /* get the last bits that need to shifted to the next byte */
               byte shiftBits = (byte) ((intermediateBytes[index] & mask[maskIndex]) <<
(8 - shiftOrder));
 
-              int shiftOrder1 = ((index % org.apache.drill.exec.util.DecimalUtility.integerSize)
== 0) ? shiftOrder - 2 : shiftOrder;
+              int shiftOrder1 = ((index % org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE)
== 0) ? shiftOrder - 2 : shiftOrder;
 
               /* transfer the bits from the left to the right */
               intermediateBytes[index + 1] = (byte) (((intermediateBytes[index + 1] &
0xFF) >>> (shiftOrder1)) | shiftBits);
 
               index--;
 
-              if ((index % org.apache.drill.exec.util.DecimalUtility.integerSize) == 0) {
+              if ((index % org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE) == 0)
{
                   /* We are on a border */
                   shiftOrder += 2;
                   maskIndex++;

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/CastDownwardDecimal.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/CastDownwardDecimal.java b/exec/java-exec/src/main/codegen/templates/Decimal/CastDownwardDecimal.java
index 05c9936..d492392 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/CastDownwardDecimal.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/CastDownwardDecimal.java
@@ -170,7 +170,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc {
     @Output ${type.to}Holder out;
 
     public void setup() {
-      int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+      int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
       buffer = buffer.reallocIfNeeded(size);
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/CastFloatDecimal.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/CastFloatDecimal.java b/exec/java-exec/src/main/codegen/templates/Decimal/CastFloatDecimal.java
index 8a7919c..f0775d8 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/CastFloatDecimal.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/CastFloatDecimal.java
@@ -60,7 +60,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc {
 
     public void setup() {
         <#if type.major == "FloatDecimalComplex" || type.major == "DoubleDecimalComplex">
-        int size = ${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize);
+        int size = ${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE);
         buffer = buffer.reallocIfNeeded(size);
         </#if>
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/CastIntDecimal.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/CastIntDecimal.java b/exec/java-exec/src/main/codegen/templates/Decimal/CastIntDecimal.java
index 6d727b0..368eb8b 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/CastIntDecimal.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/CastIntDecimal.java
@@ -56,7 +56,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc {
 
     public void setup() {
         <#if type.to.startsWith("Decimal28") || type.to.startsWith("Decimal38")>
-        int size = ${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize);
+        int size = ${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE);
         buffer = buffer.reallocIfNeeded(size);
         </#if>
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/CastSrcDecimalSimple.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/CastSrcDecimalSimple.java b/exec/java-exec/src/main/codegen/templates/Decimal/CastSrcDecimalSimple.java
index 40b03a1..fd0aba4 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/CastSrcDecimalSimple.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/CastSrcDecimalSimple.java
@@ -57,7 +57,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc {
     @Output ${type.to}Holder out;
 
     public void setup() {
-        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
         buffer = buffer.reallocIfNeeded(size);
     }
 
@@ -102,7 +102,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc {
         int shiftOrder = 2;
 
         // Start shifting bits just after the first integer
-        int byteIndex = in.WIDTH - (org.apache.drill.exec.util.DecimalUtility.integerSize
+ 1);
+        int byteIndex = in.WIDTH - (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE
+ 1);
 
         while (byteIndex >= 0) {
 
@@ -159,7 +159,7 @@ public class Cast${type.from}${type.to} implements DrillSimpleFunc{
     @Output ${type.to}Holder out;
 
     public void setup() {
-        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+        int size = (${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
         buffer = buffer.reallocIfNeeded(size);
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/CastVarCharDecimal.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/CastVarCharDecimal.java b/exec/java-exec/src/main/codegen/templates/Decimal/CastVarCharDecimal.java
index 53c0cf9..2fe55eb 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/CastVarCharDecimal.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/CastVarCharDecimal.java
@@ -241,7 +241,7 @@ public class CastEmptyString${type.from}ToNullable${type.to} implements
DrillSim
     </#if>
 
     public void setup() {
-        int size = ${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.integerSize);
+        int size = ${type.arraySize} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE);
         buffer = buffer.reallocIfNeeded(size);
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/Decimal/DecimalFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/Decimal/DecimalFunctions.java b/exec/java-exec/src/main/codegen/templates/Decimal/DecimalFunctions.java
index 8d5f1a3..efa6354 100644
--- a/exec/java-exec/src/main/codegen/templates/Decimal/DecimalFunctions.java
+++ b/exec/java-exec/src/main/codegen/templates/Decimal/DecimalFunctions.java
@@ -141,7 +141,7 @@ public class ${type.name}Functions {
         @Output ${type.name}Holder result;
 
         public void setup() {
-            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
             buffer = buffer.reallocIfNeeded(size);
             outputPrecision = Integer.MIN_VALUE;
         }
@@ -179,7 +179,7 @@ public class ${type.name}Functions {
         @Output ${type.name}Holder result;
 
         public void setup() {
-            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
             buffer = buffer.reallocIfNeeded(size);
             outputPrecision = Integer.MIN_VALUE;
         }
@@ -218,7 +218,7 @@ public class ${type.name}Functions {
         @Output ${type.name}Holder result;
 
         public void setup() {
-            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
             buffer = buffer.reallocIfNeeded(size);
             tempResult = new int[${type.storage} * ${type.storage}];
             outputPrecision = Integer.MIN_VALUE;
@@ -387,7 +387,7 @@ public class ${type.name}Functions {
         @Workspace int outputPrecision;
 
         public void setup() {
-            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
             buffer = buffer.reallocIfNeeded(size);
             outputPrecision = Integer.MIN_VALUE;
         }
@@ -424,7 +424,7 @@ public class ${type.name}Functions {
         @Workspace int outputPrecision;
 
         public void setup() {
-            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.integerSize));
+            int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
             buffer = buffer.reallocIfNeeded(size);
             outputPrecision = Integer.MIN_VALUE;
         }

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/codegen/templates/TypeHelper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/TypeHelper.java b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
index 133ed3b..3f7b6e6 100644
--- a/exec/java-exec/src/main/codegen/templates/TypeHelper.java
+++ b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
@@ -35,7 +35,7 @@ import org.apache.drill.exec.vector.accessor.*;
 import org.apache.drill.exec.vector.complex.RepeatedMapVector;
 import org.apache.drill.exec.util.CallBack;
 
-public class TypeHelper extends BasicTypeHelper{
+public class TypeHelper extends BasicTypeHelper {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TypeHelper.class);
 
   public static SqlAccessor getSqlAccessor(ValueVector vector){

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AccountorImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AccountorImpl.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AccountorImpl.java
index 4a72719..fd98f59 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AccountorImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AccountorImpl.java
@@ -207,6 +207,10 @@ public class AccountorImpl implements Accountor {
   }
 
   private void addLimitConsumer(LimitConsumer c) {
+    if (c == null) {
+      return;
+    }
+
     if (parent != null){
       parent.addLimitConsumer(c);
     }else {
@@ -229,6 +233,10 @@ public class AccountorImpl implements Accountor {
   }
 
   private void removeLimitConsumer(LimitConsumer c) {
+    if (c == null) {
+      return;
+    }
+
     if (parent != null){
       if (parent.parent==null){
         // only fragment level allocators will have the fragment context saved
@@ -308,8 +316,7 @@ public class AccountorImpl implements Accountor {
 
   public void close() {
     // remove the fragment context and reset fragment limits whenever an allocator closes
-    if(parent!=null && parent.parent==null) {
-
+    if (parent != null && parent.parent == null && limitConsumer != null)
{
       logger.debug("Fragment " + limitConsumer.getIdentifier() + "  accountor being closed");
       removeLimitConsumer(limitConsumer);
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java
index 40f8e2b..ba04fa3 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java
@@ -30,6 +30,7 @@ import java.util.Map.Entry;
 import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.exec.exception.OutOfMemoryException;
+import org.apache.drill.exec.metrics.DrillMetrics;
 import org.apache.drill.exec.testing.ControlsInjector;
 import org.apache.drill.exec.testing.ControlsInjectorFactory;
 import org.apache.drill.exec.util.AssertionUtil;
@@ -44,7 +45,7 @@ public class TopLevelAllocator implements BufferAllocator {
 
   private static final boolean ENABLE_ACCOUNTING = AssertionUtil.isAssertionsEnabled();
   private final Map<ChildAllocator, StackTraceElement[]> childrenMap;
-  private final PooledByteBufAllocatorL innerAllocator = PooledByteBufAllocatorL.DEFAULT;
+  private final PooledByteBufAllocatorL innerAllocator;
   private final AccountorImpl acct;
   private final boolean errorOnLeak;
   private final DrillBuf empty;
@@ -52,6 +53,7 @@ public class TopLevelAllocator implements BufferAllocator {
 
   private TopLevelAllocator(DrillConfig config, long maximumAllocation, boolean errorOnLeak){
     MAXIMUM_DIRECT_MEMORY = maximumAllocation;
+    innerAllocator = new PooledByteBufAllocatorL(DrillMetrics.getInstance());
     this.config=(config!=null) ? config : DrillConfig.create();
     this.errorOnLeak = errorOnLeak;
     this.acct = new AccountorImpl(config, errorOnLeak, null, null, maximumAllocation, 0,
true);

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/main/java/org/apache/drill/exec/ops/BufferManagerImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/BufferManagerImpl.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/BufferManagerImpl.java
index 38f2736..003fc9b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/BufferManagerImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/BufferManagerImpl.java
@@ -1,3 +1,20 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.drill.exec.ops;
 
 import io.netty.buffer.DrillBuf;

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java
index 65adc02..76bc3bf 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java
@@ -20,6 +20,7 @@ package org.apache.drill.exec.memory;
 
 
 import static org.junit.Assert.fail;
+import io.netty.buffer.DrillBuf;
 
 import java.util.Iterator;
 import java.util.List;
@@ -28,6 +29,7 @@ import java.util.Properties;
 import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.common.util.FileUtils;
 import org.apache.drill.exec.ExecConstants;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
 import org.apache.drill.exec.ops.FragmentContext;
 import org.apache.drill.exec.ops.OpProfileDef;
@@ -48,8 +50,6 @@ import org.junit.Test;
 import com.google.common.base.Charsets;
 import com.google.common.io.Files;
 
-import io.netty.buffer.DrillBuf;
-
 public class TestAllocators {
 
   private static final Properties TEST_CONFIGURATIONS = new Properties() {

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/vector/pom.xml
----------------------------------------------------------------------
diff --git a/exec/vector/pom.xml b/exec/vector/pom.xml
index 6001944..5534ad4 100644
--- a/exec/vector/pom.xml
+++ b/exec/vector/pom.xml
@@ -67,6 +67,16 @@
 
 
   <build>
+  
+    <resources>
+      <resource>
+        <!-- Copy freemarker template and fmpp configuration files of Vector's 
+          to allow clients to leverage definitions. -->
+        <directory>${basedir}/src/main/codegen</directory>
+        <targetPath>codegen</targetPath>
+      </resource>
+    </resources>
+      
     <plugins>
       <plugin>
         <artifactId>maven-resources-plugin</artifactId>

http://git-wip-us.apache.org/repos/asf/drill/blob/a8297dfe/exec/vector/src/main/codegen/templates/BasicTypeHelper.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/codegen/templates/BasicTypeHelper.java b/exec/vector/src/main/codegen/templates/BasicTypeHelper.java
index 723687a..a81265b 100644
--- a/exec/vector/src/main/codegen/templates/BasicTypeHelper.java
+++ b/exec/vector/src/main/codegen/templates/BasicTypeHelper.java
@@ -43,11 +43,11 @@ public class BasicTypeHelper {
   // a high value like this will not inflate the size for small values
   public static final int VARCHAR_DEFAULT_CAST_LEN = 65536;
 
-  private static String buildErrorMessage(final String operation, final MinorType type, final
DataMode mode) {
+  protected static String buildErrorMessage(final String operation, final MinorType type,
final DataMode mode) {
     return String.format("Unable to %s for minor type [%s] and mode [%s]", operation, type,
mode);
   }
 
-  private static String buildErrorMessage(final String operation, final MajorType type) {
+  protected static String buildErrorMessage(final String operation, final MajorType type)
{
     return buildErrorMessage(operation, type.getMinorType(), type.getMode());
   }
 


Mime
View raw message