drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [16/45] drill git commit: DRILL-3987: (REFACTOR) Common and Vector modules building.
Date Fri, 13 Nov 2015 02:37:46 GMT
http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java b/exec/vector/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java
index b01534e..a708e92 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java
@@ -19,11 +19,10 @@ package org.apache.drill.exec.memory;
 
 import io.netty.buffer.ByteBufAllocator;
 import io.netty.buffer.DrillBuf;
-import io.netty.buffer.UnsafeDirectLittleEndian;
 
 import java.io.Closeable;
 
-import org.apache.drill.exec.ops.FragmentContext;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.util.Pointer;
 
 /**
@@ -39,7 +38,7 @@ public interface BufferAllocator extends Closeable {
    * @param size
    *          The size in bytes.
    * @return A new ByteBuf.
-   * @throws OutOfMemoryRuntimeException if buffer cannot be allocated
+   * @throws OutOfMemoryException if buffer cannot be allocated
    */
   public abstract DrillBuf buffer(int size);
 
@@ -50,7 +49,7 @@ public interface BufferAllocator extends Closeable {
    * @param minSize The minimum size in bytes.
    * @param maxSize The maximum size in bytes.
    * @return A new ByteBuf.
-   * @throws OutOfMemoryRuntimeException if buffer cannot be allocated
+   * @throws OutOfMemoryException if buffer cannot be allocated
    */
   public abstract DrillBuf buffer(int minSize, int maxSize);
 
@@ -59,14 +58,19 @@ public interface BufferAllocator extends Closeable {
   /**
    * Create a child allocator nested below this one.
    *
-   * @param context - owning fragment for this allocator
-   * @param initialReservation - specified in bytes
-   * @param maximumReservation - specified in bytes
-   * @param applyFragmentLimit - flag to conditionally enable fragment memory limits
+   * @param context
+   *          - BufferManager associated with the new child allocator
+   * @param initialReservation
+   *          - specified in bytes
+   * @param maximumReservation
+   *          - specified in bytes
+   * @param applyFragmentLimit
+   *          - flag to conditionally enable fragment memory limits
    * @return - a new buffer allocator owned by the parent it was spawned from
-   * @throws OutOfMemoryException - when off-heap memory has been exhausted
+   * @throws OutOfMemoryException
+   *           - when off-heap memory has been exhausted
    */
-  public abstract BufferAllocator getChildAllocator(FragmentContext context, long initialReservation,
+  public abstract BufferAllocator getChildAllocator(LimitConsumer limitListener, long initialReservation,
       long maximumReservation, boolean applyFragmentLimit) throws OutOfMemoryException;
 
   /**
@@ -90,15 +94,15 @@ public interface BufferAllocator extends Closeable {
   /**
    * For Top Level Allocators. Reset the fragment limits for all allocators
    */
-  public void resetFragmentLimits();
+  public void resetLimits();
 
   /**
    * For Child allocators to set the Fragment limit for the corresponding fragment allocator.
    * @param l the new fragment limit
    */
-  public void setFragmentLimit(long l);
+  public void setLimit(long l);
 
-  public long getFragmentLimit();
+  public long getLimit();
 
 
   /**

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/memory/LimitConsumer.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/memory/LimitConsumer.java b/exec/vector/src/main/java/org/apache/drill/exec/memory/LimitConsumer.java
new file mode 100644
index 0000000..777d9d2
--- /dev/null
+++ b/exec/vector/src/main/java/org/apache/drill/exec/memory/LimitConsumer.java
@@ -0,0 +1,28 @@
+/**
+ * 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.memory;
+
+public interface LimitConsumer {
+
+  public String getIdentifier();
+  public long getAllocated();
+
+  public long getLimit();
+
+  public void setLimit(long limit);
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/memory/OutOfMemoryRuntimeException.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/memory/OutOfMemoryRuntimeException.java b/exec/vector/src/main/java/org/apache/drill/exec/memory/OutOfMemoryRuntimeException.java
deleted file mode 100644
index 305eabd..0000000
--- a/exec/vector/src/main/java/org/apache/drill/exec/memory/OutOfMemoryRuntimeException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.memory;
-
-import org.apache.drill.common.exceptions.DrillRuntimeException;
-
-public class OutOfMemoryRuntimeException extends DrillRuntimeException{
-
-  public OutOfMemoryRuntimeException() {
-    super();
-
-  }
-
-  public OutOfMemoryRuntimeException(String message, Throwable cause, boolean enableSuppression,
-      boolean writableStackTrace) {
-    super(message, cause, enableSuppression, writableStackTrace);
-
-  }
-
-  public OutOfMemoryRuntimeException(String message, Throwable cause) {
-    super(message, cause);
-
-  }
-
-  public OutOfMemoryRuntimeException(String message) {
-    super(message);
-
-  }
-
-  public OutOfMemoryRuntimeException(Throwable cause) {
-    super(cause);
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/ops/BufferManager.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/ops/BufferManager.java b/exec/vector/src/main/java/org/apache/drill/exec/ops/BufferManager.java
new file mode 100644
index 0000000..4df8f0e
--- /dev/null
+++ b/exec/vector/src/main/java/org/apache/drill/exec/ops/BufferManager.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Manages a list of {@link DrillBuf}s that can be reallocated as needed. Upon
+ * re-allocation the old buffer will be freed. Managing a list of these buffers
+ * prevents some parts of the system from needing to define a correct location
+ * to place the final call to free them.
+ *
+ * The current uses of these types of buffers are within the pluggable components of Drill.
+ * In UDFs, memory management should not be a concern. We provide access to re-allocatable
+ * DrillBufs to give UDF writers general purpose buffers we can account for. To prevent the need
+ * for UDFs to contain boilerplate to close all of the buffers they request, this list
+ * is tracked at a higher level and all of the buffers are freed once we are sure that
+ * the code depending on them is done executing (currently {@link FragmentContext}
+ * and {@link QueryContext}.
+ */
+public interface BufferManager extends AutoCloseable {
+
+  /**
+   * Replace an old buffer with a new version at least of the provided size. Does not copy data.
+   *
+   * @param old
+   *          Old Buffer that the user is no longer going to use.
+   * @param newSize
+   *          Size of new replacement buffer.
+   * @return
+   */
+  public DrillBuf replace(DrillBuf old, int newSize);
+
+  /**
+   * Get a managed buffer of indeterminate size.
+   *
+   * @return A buffer.
+   */
+  public DrillBuf getManagedBuffer();
+
+  /**
+   * Get a managed buffer of at least a certain size.
+   *
+   * @param size
+   *          The desired size
+   * @return A buffer
+   */
+  public DrillBuf getManagedBuffer(int size);
+
+  public void close();
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java b/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java
index 26e1257..f8fb71c 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java
@@ -26,7 +26,7 @@ import org.apache.drill.common.expression.PathSegment;
 import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.types.TypeProtos.DataMode;
 import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.exec.expr.TypeHelper;
+import org.apache.drill.exec.expr.BasicTypeHelper;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 
 
@@ -196,7 +196,7 @@ public class MaterializedField {
   }
 
   public Class<?> getValueClass() {
-    return TypeHelper.getValueVectorClass(getType().getMinorType(), getDataMode());
+    return BasicTypeHelper.getValueVectorClass(getType().getMinorType(), getDataMode());
   }
 
   public boolean matches(SchemaPath path) {

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java b/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java
index 931f981..a322f72 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java
@@ -22,7 +22,7 @@ import java.util.Arrays;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.drill.common.expression.PathSegment;
 import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.exec.expr.TypeHelper;
+import org.apache.drill.exec.expr.BasicTypeHelper;
 import org.apache.drill.exec.vector.ValueVector;
 
 import com.carrotsearch.hppc.IntArrayList;
@@ -105,7 +105,8 @@ public class TypedFieldId {
   }
 
   public Class<? extends ValueVector> getIntermediateClass() {
-    return (Class<? extends ValueVector>) TypeHelper.getValueVectorClass(intermediateType.getMinorType(), intermediateType.getMode());
+    return (Class<? extends ValueVector>) BasicTypeHelper.getValueVectorClass(intermediateType.getMinorType(),
+        intermediateType.getMode());
   }
 
   public MajorType getFinalType() {

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/util/AssertionUtil.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/util/AssertionUtil.java b/exec/vector/src/main/java/org/apache/drill/exec/util/AssertionUtil.java
new file mode 100644
index 0000000..2348e62
--- /dev/null
+++ b/exec/vector/src/main/java/org/apache/drill/exec/util/AssertionUtil.java
@@ -0,0 +1,39 @@
+/**
+ * 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.util;
+
+public class AssertionUtil {
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AssertionUtil.class);
+
+
+  public static final boolean ASSERT_ENABLED;
+  public static final boolean BOUNDS_CHECKING_ENABLED;
+
+  static{
+    boolean isAssertEnabled = false;
+    assert isAssertEnabled = true;
+    ASSERT_ENABLED = isAssertEnabled;
+    BOUNDS_CHECKING_ENABLED = ASSERT_ENABLED || !"true".equals(System.getProperty("drill.enable_unsafe_memory_access"));
+  }
+
+  public static boolean isAssertionsEnabled(){
+    return ASSERT_ENABLED;
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/util/DecimalUtility.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/util/DecimalUtility.java b/exec/vector/src/main/java/org/apache/drill/exec/util/DecimalUtility.java
new file mode 100644
index 0000000..0922b22
--- /dev/null
+++ b/exec/vector/src/main/java/org/apache/drill/exec/util/DecimalUtility.java
@@ -0,0 +1,730 @@
+/**
+ * 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.util;
+
+import io.netty.buffer.DrillBuf;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.apache.drill.common.util.CoreDecimalUtility;
+import org.apache.drill.exec.expr.fn.impl.ByteFunctionHelpers;
+import org.apache.drill.exec.expr.holders.Decimal38SparseHolder;
+
+public class DecimalUtility extends CoreDecimalUtility{
+
+    public final static int MAX_DIGITS = 9;
+    public final static int DIGITS_BASE = 1000000000;
+    public final static int DIGITS_MAX = 999999999;
+    public final static int INTEGER_SIZE = (Integer.SIZE/8);
+
+    public final static String[] decimalToString = {"",
+            "0",
+            "00",
+            "000",
+            "0000",
+            "00000",
+            "000000",
+            "0000000",
+            "00000000",
+            "000000000"};
+
+    public final static long[] scale_long_constants = {
+        1,
+        10,
+        100,
+        1000,
+        10000,
+        100000,
+        1000000,
+        10000000,
+        100000000,
+        1000000000,
+        10000000000l,
+        100000000000l,
+        1000000000000l,
+        10000000000000l,
+        100000000000000l,
+        1000000000000000l,
+        10000000000000000l,
+        100000000000000000l,
+        1000000000000000000l};
+
+    /*
+     * Simple function that returns the static precomputed
+     * power of ten, instead of using Math.pow
+     */
+    public static long getPowerOfTen(int power) {
+      assert power >= 0 && power < scale_long_constants.length;
+      return scale_long_constants[(power)];
+    }
+
+    /*
+     * Math.pow returns a double and while multiplying with large digits
+     * in the decimal data type we encounter noise. So instead of multiplying
+     * with Math.pow we use the static constants to perform the multiplication
+     */
+    public static long adjustScaleMultiply(long input, int factor) {
+      int index = Math.abs(factor);
+      assert index >= 0 && index < scale_long_constants.length;
+      if (factor >= 0) {
+        return input * scale_long_constants[index];
+      } else {
+        return input / scale_long_constants[index];
+      }
+    }
+
+    public static long adjustScaleDivide(long input, int factor) {
+      int index = Math.abs(factor);
+      assert index >= 0 && index < scale_long_constants.length;
+      if (factor >= 0) {
+        return input / scale_long_constants[index];
+      } else {
+        return input * scale_long_constants[index];
+      }
+    }
+
+    /* Given the number of actual digits this function returns the
+     * number of indexes it will occupy in the array of integers
+     * which are stored in base 1 billion
+     */
+    public static int roundUp(int ndigits) {
+        return (ndigits + MAX_DIGITS - 1)/MAX_DIGITS;
+    }
+
+    /* Returns a string representation of the given integer
+     * If the length of the given integer is less than the
+     * passed length, this function will prepend zeroes to the string
+     */
+    public static StringBuilder toStringWithZeroes(int number, int desiredLength) {
+        String value = ((Integer) number).toString();
+        int length = value.length();
+
+        StringBuilder str = new StringBuilder();
+        str.append(decimalToString[desiredLength - length]);
+        str.append(value);
+
+        return str;
+    }
+
+    public static StringBuilder toStringWithZeroes(long number, int desiredLength) {
+        String value = ((Long) number).toString();
+        int length = value.length();
+
+        StringBuilder str = new StringBuilder();
+
+        // Desired length can be > MAX_DIGITS
+        int zeroesLength = desiredLength - length;
+        while (zeroesLength > MAX_DIGITS) {
+            str.append(decimalToString[MAX_DIGITS]);
+            zeroesLength -= MAX_DIGITS;
+        }
+        str.append(decimalToString[zeroesLength]);
+        str.append(value);
+
+        return str;
+    }
+
+    public static BigDecimal getBigDecimalFromIntermediate(DrillBuf data, int startIndex, int nDecimalDigits, int scale) {
+
+        // In the intermediate representation we don't pad the scale with zeroes, so set truncate = false
+        return getBigDecimalFromDrillBuf(data, startIndex, nDecimalDigits, scale, false);
+    }
+
+    public static BigDecimal getBigDecimalFromSparse(DrillBuf data, int startIndex, int nDecimalDigits, int scale) {
+
+        // In the sparse representation we pad the scale with zeroes for ease of arithmetic, need to truncate
+        return getBigDecimalFromDrillBuf(data, startIndex, nDecimalDigits, scale, true);
+    }
+
+    public static BigDecimal getBigDecimalFromDrillBuf(DrillBuf bytebuf, int start, int length, int scale) {
+      byte[] value = new byte[length];
+      bytebuf.getBytes(start, value, 0, length);
+      BigInteger unscaledValue = new BigInteger(value);
+      return new BigDecimal(unscaledValue, scale);
+    }
+
+  public static BigDecimal getBigDecimalFromByteBuffer(ByteBuffer bytebuf, int start, int length, int scale) {
+    byte[] value = new byte[length];
+    bytebuf.get(value);
+    BigInteger unscaledValue = new BigInteger(value);
+    return new BigDecimal(unscaledValue, scale);
+  }
+
+    /* Create a BigDecimal object using the data in the DrillBuf.
+     * This function assumes that data is provided in a non-dense format
+     * It works on both sparse and intermediate representations.
+     */
+    public static BigDecimal getBigDecimalFromDrillBuf(DrillBuf data, int startIndex, int nDecimalDigits, int scale, boolean truncateScale) {
+
+        // For sparse decimal type we have padded zeroes at the end, strip them while converting to BigDecimal.
+        int actualDigits;
+
+        // Initialize the BigDecimal, first digit in the DrillBuf has the sign so mask it out
+        BigInteger decimalDigits = BigInteger.valueOf((data.getInt(startIndex)) & 0x7FFFFFFF);
+
+        BigInteger base = BigInteger.valueOf(DIGITS_BASE);
+
+        for (int i = 1; i < nDecimalDigits; i++) {
+
+            BigInteger temp = BigInteger.valueOf(data.getInt(startIndex + (i * INTEGER_SIZE)));
+            decimalDigits = decimalDigits.multiply(base);
+            decimalDigits = decimalDigits.add(temp);
+        }
+
+        // Truncate any additional padding we might have added
+        if (truncateScale == true && scale > 0 && (actualDigits = scale % MAX_DIGITS) != 0) {
+            BigInteger truncate = BigInteger.valueOf((int)Math.pow(10, (MAX_DIGITS - actualDigits)));
+            decimalDigits = decimalDigits.divide(truncate);
+        }
+
+        // set the sign
+        if ((data.getInt(startIndex) & 0x80000000) != 0) {
+            decimalDigits = decimalDigits.negate();
+        }
+
+        BigDecimal decimal = new BigDecimal(decimalDigits, scale);
+
+        return decimal;
+    }
+
+    /* This function returns a BigDecimal object from the dense decimal representation.
+     * First step is to convert the dense representation into an intermediate representation
+     * and then invoke getBigDecimalFromDrillBuf() to get the BigDecimal object
+     */
+    public static BigDecimal getBigDecimalFromDense(DrillBuf data, int startIndex, int nDecimalDigits, int scale, int maxPrecision, int width) {
+
+        /* This method converts the dense representation to
+         * an intermediate representation. The intermediate
+         * representation has one more integer than the dense
+         * representation.
+         */
+        byte[] intermediateBytes = new byte[((nDecimalDigits + 1) * INTEGER_SIZE)];
+
+        // Start storing from the least significant byte of the first integer
+        int intermediateIndex = 3;
+
+        int[] mask = {0x03, 0x0F, 0x3F, 0xFF};
+        int[] reverseMask = {0xFC, 0xF0, 0xC0, 0x00};
+
+        int maskIndex;
+        int shiftOrder;
+        byte shiftBits;
+
+        // TODO: Some of the logic here is common with casting from Dense to Sparse types, factor out common code
+        if (maxPrecision == 38) {
+            maskIndex = 0;
+            shiftOrder = 6;
+            shiftBits = 0x00;
+            intermediateBytes[intermediateIndex++] = (byte) (data.getByte(startIndex) & 0x7F);
+        } else if (maxPrecision == 28) {
+            maskIndex = 1;
+            shiftOrder = 4;
+            shiftBits = (byte) ((data.getByte(startIndex) & 0x03) << shiftOrder);
+            intermediateBytes[intermediateIndex++] = (byte) (((data.getByte(startIndex) & 0x3C) & 0xFF) >>> 2);
+        } else {
+            throw new UnsupportedOperationException("Dense types with max precision 38 and 28 are only supported");
+        }
+
+        int inputIndex = 1;
+        boolean sign = false;
+
+        if ((data.getByte(startIndex) & 0x80) != 0) {
+            sign = true;
+        }
+
+        while (inputIndex < width) {
+
+            intermediateBytes[intermediateIndex] = (byte) ((shiftBits) | (((data.getByte(startIndex + inputIndex) & reverseMask[maskIndex]) & 0xFF) >>> (8 - shiftOrder)));
+
+            shiftBits = (byte) ((data.getByte(startIndex + inputIndex) & mask[maskIndex]) << shiftOrder);
+
+            inputIndex++;
+            intermediateIndex++;
+
+            if (((inputIndex - 1) % INTEGER_SIZE) == 0) {
+                shiftBits = (byte) ((shiftBits & 0xFF) >>> 2);
+                maskIndex++;
+                shiftOrder -= 2;
+            }
+
+        }
+        /* copy the last byte */
+        intermediateBytes[intermediateIndex] = shiftBits;
+
+        if (sign == true) {
+            intermediateBytes[0] = (byte) (intermediateBytes[0] | 0x80);
+        }
+        DrillBuf intermediate = data.getAllocator().buffer(intermediateBytes.length);
+        intermediate.setBytes(0, intermediateBytes);
+
+        BigDecimal ret = getBigDecimalFromIntermediate(intermediate, 0, nDecimalDigits + 1, scale);
+        intermediate.release();
+        return ret;
+    }
+
+    /*
+     * Function converts the BigDecimal and stores it in out internal sparse representation
+     */
+    public static void getSparseFromBigDecimal(BigDecimal input, DrillBuf data, int startIndex, int scale, int precision, int nDecimalDigits) {
+
+        // Initialize the buffer
+        for (int i = 0; i < nDecimalDigits; i++) {
+          data.setInt(startIndex + (i * INTEGER_SIZE), 0);
+        }
+
+        boolean sign = false;
+
+        if (input.signum() == -1) {
+            // negative input
+            sign = true;
+            input = input.abs();
+        }
+
+        // Truncate the input as per the scale provided
+        input = input.setScale(scale, BigDecimal.ROUND_HALF_UP);
+
+        // Separate out the integer part
+        BigDecimal integerPart = input.setScale(0, BigDecimal.ROUND_DOWN);
+
+        int destIndex = nDecimalDigits - roundUp(scale) - 1;
+
+        // we use base 1 billion integer digits for out integernal representation
+        BigDecimal base = new BigDecimal(DIGITS_BASE);
+
+        while (integerPart.compareTo(BigDecimal.ZERO) == 1) {
+            // store the modulo as the integer value
+            data.setInt(startIndex + (destIndex * INTEGER_SIZE), (integerPart.remainder(base)).intValue());
+            destIndex--;
+            // Divide by base 1 billion
+            integerPart = (integerPart.divide(base)).setScale(0, BigDecimal.ROUND_DOWN);
+        }
+
+        /* Sparse representation contains padding of additional zeroes
+         * so each digit contains MAX_DIGITS for ease of arithmetic
+         */
+        int actualDigits;
+        if ((actualDigits = (scale % MAX_DIGITS)) != 0) {
+            // Pad additional zeroes
+            scale = scale + (MAX_DIGITS - actualDigits);
+            input = input.setScale(scale, BigDecimal.ROUND_DOWN);
+        }
+
+        //separate out the fractional part
+        BigDecimal fractionalPart = input.remainder(BigDecimal.ONE).movePointRight(scale);
+
+        destIndex = nDecimalDigits - 1;
+
+        while (scale > 0) {
+            // Get next set of MAX_DIGITS (9) store it in the DrillBuf
+            fractionalPart = fractionalPart.movePointLeft(MAX_DIGITS);
+            BigDecimal temp = fractionalPart.remainder(BigDecimal.ONE);
+
+            data.setInt(startIndex + (destIndex * INTEGER_SIZE), (temp.unscaledValue().intValue()));
+            destIndex--;
+
+            fractionalPart = fractionalPart.setScale(0, BigDecimal.ROUND_DOWN);
+            scale -= MAX_DIGITS;
+        }
+
+        // Set the negative sign
+        if (sign == true) {
+            data.setInt(startIndex, data.getInt(startIndex) | 0x80000000);
+        }
+
+    }
+
+
+    public static long getDecimal18FromBigDecimal(BigDecimal input, int scale, int precision) {
+        // Truncate or pad to set the input to the correct scale
+        input = input.setScale(scale, BigDecimal.ROUND_HALF_UP);
+
+        return (input.unscaledValue().longValue());
+    }
+
+    public static BigDecimal getBigDecimalFromPrimitiveTypes(int input, int scale, int precision) {
+      return BigDecimal.valueOf(input, scale);
+    }
+
+    public static BigDecimal getBigDecimalFromPrimitiveTypes(long input, int scale, int precision) {
+      return BigDecimal.valueOf(input, scale);
+    }
+
+
+    public static int compareDenseBytes(DrillBuf left, int leftStart, boolean leftSign, DrillBuf right, int rightStart, boolean rightSign, int width) {
+
+      int invert = 1;
+
+      /* If signs are different then simply look at the
+       * sign of the two inputs and determine which is greater
+       */
+      if (leftSign != rightSign) {
+
+        return((leftSign == true) ? -1 : 1);
+      } else if(leftSign == true) {
+        /* Both inputs are negative, at the end we will
+         * have to invert the comparison
+         */
+        invert = -1;
+      }
+
+      int cmp = 0;
+
+      for (int i = 0; i < width; i++) {
+        byte leftByte  = left.getByte(leftStart + i);
+        byte rightByte = right.getByte(rightStart + i);
+        // Unsigned byte comparison
+        if ((leftByte & 0xFF) > (rightByte & 0xFF)) {
+          cmp = 1;
+          break;
+        } else if ((leftByte & 0xFF) < (rightByte & 0xFF)) {
+          cmp = -1;
+          break;
+        }
+      }
+      cmp *= invert; // invert the comparison if both were negative values
+
+      return cmp;
+    }
+
+    public static int getIntegerFromSparseBuffer(DrillBuf buffer, int start, int index) {
+      int value = buffer.getInt(start + (index * 4));
+
+      if (index == 0) {
+        /* the first byte contains sign bit, return value without it */
+        value = (value & 0x7FFFFFFF);
+      }
+      return value;
+    }
+
+    public static void setInteger(DrillBuf buffer, int start, int index, int value) {
+      buffer.setInt(start + (index * 4), value);
+    }
+
+    public static int compareSparseBytes(DrillBuf left, int leftStart, boolean leftSign, int leftScale, int leftPrecision, DrillBuf right, int rightStart, boolean rightSign, int rightPrecision, int rightScale, int width, int nDecimalDigits, boolean absCompare) {
+
+      int invert = 1;
+
+      if (absCompare == false) {
+        if (leftSign != rightSign) {
+          return (leftSign == true) ? -1 : 1;
+        }
+
+        // Both values are negative invert the outcome of the comparison
+        if (leftSign == true) {
+          invert = -1;
+        }
+      }
+
+      int cmp = compareSparseBytesInner(left, leftStart, leftSign, leftScale, leftPrecision, right, rightStart, rightSign, rightPrecision, rightScale, width, nDecimalDigits);
+      return cmp * invert;
+    }
+    public static int compareSparseBytesInner(DrillBuf left, int leftStart, boolean leftSign, int leftScale, int leftPrecision, DrillBuf right, int rightStart, boolean rightSign, int rightPrecision, int rightScale, int width, int nDecimalDigits) {
+      /* compute the number of integer digits in each decimal */
+      int leftInt  = leftPrecision - leftScale;
+      int rightInt = rightPrecision - rightScale;
+
+      /* compute the number of indexes required for storing integer digits */
+      int leftIntRoundedUp = org.apache.drill.exec.util.DecimalUtility.roundUp(leftInt);
+      int rightIntRoundedUp = org.apache.drill.exec.util.DecimalUtility.roundUp(rightInt);
+
+      /* compute number of indexes required for storing scale */
+      int leftScaleRoundedUp = org.apache.drill.exec.util.DecimalUtility.roundUp(leftScale);
+      int rightScaleRoundedUp = org.apache.drill.exec.util.DecimalUtility.roundUp(rightScale);
+
+      /* compute index of the most significant integer digits */
+      int leftIndex1 = nDecimalDigits - leftScaleRoundedUp - leftIntRoundedUp;
+      int rightIndex1 = nDecimalDigits - rightScaleRoundedUp - rightIntRoundedUp;
+
+      int leftStopIndex = nDecimalDigits - leftScaleRoundedUp;
+      int rightStopIndex = nDecimalDigits - rightScaleRoundedUp;
+
+      /* Discard the zeroes in the integer part */
+      while (leftIndex1 < leftStopIndex) {
+        if (getIntegerFromSparseBuffer(left, leftStart, leftIndex1) != 0) {
+          break;
+        }
+
+        /* Digit in this location is zero, decrement the actual number
+         * of integer digits
+         */
+        leftIntRoundedUp--;
+        leftIndex1++;
+      }
+
+      /* If we reached the stop index then the number of integers is zero */
+      if (leftIndex1 == leftStopIndex) {
+        leftIntRoundedUp = 0;
+      }
+
+      while (rightIndex1 < rightStopIndex) {
+        if (getIntegerFromSparseBuffer(right, rightStart, rightIndex1) != 0) {
+          break;
+        }
+
+        /* Digit in this location is zero, decrement the actual number
+         * of integer digits
+         */
+        rightIntRoundedUp--;
+        rightIndex1++;
+      }
+
+      if (rightIndex1 == rightStopIndex) {
+        rightIntRoundedUp = 0;
+      }
+
+      /* We have the accurate number of non-zero integer digits,
+       * if the number of integer digits are different then we can determine
+       * which decimal is larger and needn't go down to comparing individual values
+       */
+      if (leftIntRoundedUp > rightIntRoundedUp) {
+        return 1;
+      }
+      else if (rightIntRoundedUp > leftIntRoundedUp) {
+        return -1;
+      }
+
+      /* The number of integer digits are the same, set the each index
+       * to the first non-zero integer and compare each digit
+       */
+      leftIndex1 = nDecimalDigits - leftScaleRoundedUp - leftIntRoundedUp;
+      rightIndex1 = nDecimalDigits - rightScaleRoundedUp - rightIntRoundedUp;
+
+      while (leftIndex1 < leftStopIndex && rightIndex1 < rightStopIndex) {
+        if (getIntegerFromSparseBuffer(left, leftStart, leftIndex1) > getIntegerFromSparseBuffer(right, rightStart, rightIndex1)) {
+          return 1;
+        }
+        else if (getIntegerFromSparseBuffer(right, rightStart, rightIndex1) > getIntegerFromSparseBuffer(left, leftStart, leftIndex1)) {
+          return -1;
+        }
+
+        leftIndex1++;
+        rightIndex1++;
+      }
+
+      /* The integer part of both the decimal's are equal, now compare
+       * each individual fractional part. Set the index to be at the
+       * beginning of the fractional part
+       */
+      leftIndex1 = leftStopIndex;
+      rightIndex1 = rightStopIndex;
+
+      /* Stop indexes will be the end of the array */
+      leftStopIndex = nDecimalDigits;
+      rightStopIndex = nDecimalDigits;
+
+      /* compare the two fractional parts of the decimal */
+      while (leftIndex1 < leftStopIndex && rightIndex1 < rightStopIndex) {
+        if (getIntegerFromSparseBuffer(left, leftStart, leftIndex1) > getIntegerFromSparseBuffer(right, rightStart, rightIndex1)) {
+          return 1;
+        }
+        else if (getIntegerFromSparseBuffer(right, rightStart, rightIndex1) > getIntegerFromSparseBuffer(left, leftStart, leftIndex1)) {
+          return -1;
+        }
+
+        leftIndex1++;
+        rightIndex1++;
+      }
+
+      /* Till now the fractional part of the decimals are equal, check
+       * if one of the decimal has fractional part that is remaining
+       * and is non-zero
+       */
+      while (leftIndex1 < leftStopIndex) {
+        if (getIntegerFromSparseBuffer(left, leftStart, leftIndex1) != 0) {
+          return 1;
+        }
+        leftIndex1++;
+      }
+
+      while(rightIndex1 < rightStopIndex) {
+        if (getIntegerFromSparseBuffer(right, rightStart, rightIndex1) != 0) {
+          return -1;
+        }
+        rightIndex1++;
+      }
+
+      /* Both decimal values are equal */
+      return 0;
+    }
+
+    public static BigDecimal getBigDecimalFromByteArray(byte[] bytes, int start, int length, int scale) {
+      byte[] value = Arrays.copyOfRange(bytes, start, start + length);
+      BigInteger unscaledValue = new BigInteger(value);
+      return new BigDecimal(unscaledValue, scale);
+    }
+
+  public static void roundDecimal(DrillBuf result, int start, int nDecimalDigits, int desiredScale, int currentScale) {
+    int newScaleRoundedUp  = org.apache.drill.exec.util.DecimalUtility.roundUp(desiredScale);
+    int origScaleRoundedUp = org.apache.drill.exec.util.DecimalUtility.roundUp(currentScale);
+
+    if (desiredScale < currentScale) {
+
+      boolean roundUp = false;
+
+      //Extract the first digit to be truncated to check if we need to round up
+      int truncatedScaleIndex = desiredScale + 1;
+      if (truncatedScaleIndex <= currentScale) {
+        int extractDigitIndex = nDecimalDigits - origScaleRoundedUp -1;
+        extractDigitIndex += org.apache.drill.exec.util.DecimalUtility.roundUp(truncatedScaleIndex);
+        int extractDigit = getIntegerFromSparseBuffer(result, start, extractDigitIndex);
+        int temp = org.apache.drill.exec.util.DecimalUtility.MAX_DIGITS - (truncatedScaleIndex % org.apache.drill.exec.util.DecimalUtility.MAX_DIGITS);
+        if (temp != 0) {
+          extractDigit = extractDigit / (int) (Math.pow(10, temp));
+        }
+        if ((extractDigit % 10)  > 4) {
+          roundUp = true;
+        }
+      }
+
+      // Get the source index beyond which we will truncate
+      int srcIntIndex = nDecimalDigits - origScaleRoundedUp - 1;
+      int srcIndex = srcIntIndex + newScaleRoundedUp;
+
+      // Truncate the remaining fractional part, move the integer part
+      int destIndex = nDecimalDigits - 1;
+      if (srcIndex != destIndex) {
+        while (srcIndex >= 0) {
+          setInteger(result, start, destIndex--, getIntegerFromSparseBuffer(result, start, srcIndex--));
+        }
+
+        // Set the remaining portion of the decimal to be zeroes
+        while (destIndex >= 0) {
+          setInteger(result, start, destIndex--, 0);
+        }
+        srcIndex = nDecimalDigits - 1;
+      }
+
+      // We truncated the decimal digit. Now we need to truncate within the base 1 billion fractional digit
+      int truncateFactor = org.apache.drill.exec.util.DecimalUtility.MAX_DIGITS - (desiredScale % org.apache.drill.exec.util.DecimalUtility.MAX_DIGITS);
+      if (truncateFactor != org.apache.drill.exec.util.DecimalUtility.MAX_DIGITS) {
+        truncateFactor = (int) Math.pow(10, truncateFactor);
+        int fractionalDigits = getIntegerFromSparseBuffer(result, start, nDecimalDigits - 1);
+        fractionalDigits /= truncateFactor;
+        setInteger(result, start, nDecimalDigits - 1, fractionalDigits * truncateFactor);
+      }
+
+      // Finally round up the digit if needed
+      if (roundUp == true) {
+        srcIndex = nDecimalDigits - 1;
+        int carry;
+        if (truncateFactor != org.apache.drill.exec.util.DecimalUtility.MAX_DIGITS) {
+          carry = truncateFactor;
+        } else {
+          carry = 1;
+        }
+
+        while (srcIndex >= 0) {
+          int value = getIntegerFromSparseBuffer(result, start, srcIndex);
+          value += carry;
+
+          if (value >= org.apache.drill.exec.util.DecimalUtility.DIGITS_BASE) {
+            setInteger(result, start, srcIndex--, value % org.apache.drill.exec.util.DecimalUtility.DIGITS_BASE);
+            carry = value / org.apache.drill.exec.util.DecimalUtility.DIGITS_BASE;
+          } else {
+            setInteger(result, start, srcIndex--, value);
+            carry = 0;
+            break;
+          }
+        }
+      }
+    } else if (desiredScale > currentScale) {
+      // Add fractional digits to the decimal
+
+      // Check if we need to shift the decimal digits to the left
+      if (newScaleRoundedUp > origScaleRoundedUp) {
+        int srcIndex  = 0;
+        int destIndex = newScaleRoundedUp - origScaleRoundedUp;
+
+        // Check while extending scale, we are not overwriting integer part
+        while (srcIndex < destIndex) {
+          if (getIntegerFromSparseBuffer(result, start, srcIndex++) != 0) {
+            throw new org.apache.drill.common.exceptions.DrillRuntimeException("Truncate resulting in loss of integer part, reduce scale specified");
+          }
+        }
+
+        srcIndex = 0;
+        while (destIndex < nDecimalDigits) {
+          setInteger(result, start, srcIndex++, getIntegerFromSparseBuffer(result, start, destIndex++));
+        }
+
+        // Clear the remaining part
+        while (srcIndex < nDecimalDigits) {
+          setInteger(result, start, srcIndex++, 0);
+        }
+      }
+    }
+  }
+
+  public static int getFirstFractionalDigit(int decimal, int scale) {
+    if (scale == 0) {
+      return 0;
+    }
+    int temp = (int) adjustScaleDivide(decimal, scale - 1);
+    return Math.abs(temp % 10);
+  }
+
+  public static int getFirstFractionalDigit(long decimal, int scale) {
+    if (scale == 0) {
+      return 0;
+    }
+    long temp = adjustScaleDivide(decimal, scale - 1);
+    return (int) (Math.abs(temp % 10));
+  }
+
+  public static int getFirstFractionalDigit(DrillBuf data, int scale, int start, int nDecimalDigits) {
+    if (scale == 0) {
+      return 0;
+    }
+
+    int index = nDecimalDigits - roundUp(scale);
+    return (int) (adjustScaleDivide(data.getInt(start + (index * INTEGER_SIZE)), MAX_DIGITS - 1));
+  }
+
+  public static int compareSparseSamePrecScale(DrillBuf left, int lStart, byte[] right, int length) {
+    // check the sign first
+    boolean lSign = (left.getInt(lStart) & 0x80000000) != 0;
+    boolean rSign = ByteFunctionHelpers.getSign(right);
+    int cmp = 0;
+
+    if (lSign != rSign) {
+      return (lSign == false) ? 1 : -1;
+    }
+
+    // invert the comparison if we are comparing negative numbers
+    int invert = (lSign == true) ? -1 : 1;
+
+    // compare byte by byte
+    int n = 0;
+    int lPos = lStart;
+    int rPos = 0;
+    while (n < length/4) {
+      int leftInt = Decimal38SparseHolder.getInteger(n, lStart, left);
+      int rightInt = ByteFunctionHelpers.getInteger(right, n);
+      if (leftInt != rightInt) {
+        cmp =  (leftInt - rightInt ) > 0 ? 1 : -1;
+        break;
+      }
+      n++;
+    }
+    return cmp * invert;
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/AllocationHelper.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/AllocationHelper.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/AllocationHelper.java
index 622e2d2..77d457b 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/AllocationHelper.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/AllocationHelper.java
@@ -49,7 +49,7 @@ public class AllocationHelper {
    * Allocates the exact amount if v is fixed width, otherwise falls back to dynamic allocation
    * @param v value vector we are trying to allocate
    * @param valueCount  size we are trying to allocate
-   * @throws org.apache.drill.exec.memory.OutOfMemoryRuntimeException if it can't allocate the memory
+   * @throws org.apache.drill.exec.memory.OutOfMemoryException if it can't allocate the memory
    */
   public static void allocateNew(ValueVector v, int valueCount) {
     if (v instanceof  FixedWidthVector) {

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java
index 67ba5c4..856393d 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java
@@ -25,7 +25,7 @@ import org.apache.drill.exec.exception.OversizedAllocationException;
 import org.apache.drill.exec.expr.holders.BitHolder;
 import org.apache.drill.exec.expr.holders.NullableBitHolder;
 import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
@@ -88,7 +88,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
   @Override
   public void allocateNew() {
     if (!allocateNewSafe()) {
-      throw new OutOfMemoryRuntimeException();
+      throw new OutOfMemoryException();
     }
   }
 
@@ -105,7 +105,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
 
     try {
       allocateBytes(curAllocationSize);
-    } catch (OutOfMemoryRuntimeException ex) {
+    } catch (OutOfMemoryException ex) {
       return false;
     }
     return true;

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
index a7a3609..9ca4410 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
@@ -26,7 +26,7 @@ import java.util.List;
 import org.apache.drill.common.expression.FieldReference;
 import org.apache.drill.exec.expr.holders.ObjectHolder;
 import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.proto.UserBitShared;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
@@ -103,11 +103,11 @@ public class ObjectVector extends BaseValueVector {
   }
 
   @Override
-  public void allocateNew() throws OutOfMemoryRuntimeException {
+  public void allocateNew() throws OutOfMemoryException {
     addNewArray();
   }
 
-  public void allocateNew(int valueCount) throws OutOfMemoryRuntimeException {
+  public void allocateNew(int valueCount) throws OutOfMemoryException {
     while (maxCount < valueCount) {
       addNewArray();
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueHolderHelper.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueHolderHelper.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueHolderHelper.java
index 42384cb..54897d3 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueHolderHelper.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueHolderHelper.java
@@ -177,8 +177,9 @@ public class ValueHolderHelper {
     dch.precision = bigDecimal.precision();
     Decimal28SparseHolder.setSign(bigDecimal.signum() == -1, dch.start, dch.buffer);
     dch.start = 0;
-    dch.buffer = buf.reallocIfNeeded(5 * DecimalUtility.integerSize);
-    DecimalUtility.getSparseFromBigDecimal(bigDecimal, dch.buffer, dch.start, dch.scale, dch.precision, dch.nDecimalDigits);
+    dch.buffer = buf.reallocIfNeeded(5 * DecimalUtility.INTEGER_SIZE);
+    DecimalUtility
+        .getSparseFromBigDecimal(bigDecimal, dch.buffer, dch.start, dch.scale, dch.precision, dch.nDecimalDigits);
 
     return dch;
   }
@@ -193,8 +194,9 @@ public class ValueHolderHelper {
       dch.precision = bigDecimal.precision();
       Decimal38SparseHolder.setSign(bigDecimal.signum() == -1, dch.start, dch.buffer);
       dch.start = 0;
-      dch.buffer = buf.reallocIfNeeded(dch.maxPrecision * DecimalUtility.integerSize);
-      DecimalUtility.getSparseFromBigDecimal(bigDecimal, dch.buffer, dch.start, dch.scale, dch.precision, dch.nDecimalDigits);
+    dch.buffer = buf.reallocIfNeeded(dch.maxPrecision * DecimalUtility.INTEGER_SIZE);
+    DecimalUtility
+        .getSparseFromBigDecimal(bigDecimal, dch.buffer, dch.start, dch.scale, dch.precision, dch.nDecimalDigits);
 
       return dch;
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java
index 8627d1a..b39fcfe 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java
@@ -22,7 +22,7 @@ import java.io.Closeable;
 import io.netty.buffer.DrillBuf;
 
 import org.apache.drill.common.expression.FieldReference;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
@@ -58,9 +58,9 @@ import org.apache.drill.exec.vector.complex.reader.FieldReader;
 public interface ValueVector extends Closeable, Iterable<ValueVector> {
   /**
    * Allocate new buffers. ValueVector implements logic to determine how much to allocate.
-   * @throws OutOfMemoryRuntimeException Thrown if no memory can be allocated.
+   * @throws OutOfMemoryException Thrown if no memory can be allocated.
    */
-  void allocateNew() throws OutOfMemoryRuntimeException;
+  void allocateNew() throws OutOfMemoryException;
 
   /**
    * Allocates new buffers. ValueVector implements logic to determine how much to allocate.

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java
index 9fb151f..c5326f6 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java
@@ -24,7 +24,7 @@ import io.netty.buffer.DrillBuf;
 import org.apache.drill.common.expression.FieldReference;
 import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.proto.UserBitShared;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
@@ -128,7 +128,7 @@ public class ZeroVector implements ValueVector {
   }
 
   @Override
-  public void allocateNew() throws OutOfMemoryRuntimeException {
+  public void allocateNew() throws OutOfMemoryException {
     allocateNewSafe();
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
index 5f6d0d2..290b237 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
@@ -34,7 +34,7 @@ import org.apache.drill.common.types.TypeProtos.DataMode;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TypedFieldId;
 import org.apache.drill.exec.util.CallBack;
@@ -59,9 +59,9 @@ public abstract class AbstractContainerVector implements ValueVector {
   }
 
   @Override
-  public void allocateNew() throws OutOfMemoryRuntimeException {
+  public void allocateNew() throws OutOfMemoryException {
     if (!allocateNewSafe()) {
-      throw new OutOfMemoryRuntimeException();
+      throw new OutOfMemoryException();
     }
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
index 35df691..581a54d 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
@@ -17,20 +17,22 @@
  */
 package org.apache.drill.exec.vector.complex;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import io.netty.buffer.DrillBuf;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.drill.common.collections.MapWithOrdinal;
 import org.apache.drill.common.types.TypeProtos;
-import org.apache.drill.exec.expr.TypeHelper;
+import org.apache.drill.exec.expr.BasicTypeHelper;
 import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.util.CallBack;
 import org.apache.drill.exec.vector.ValueVector;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 
 /*
  * Base class for MapVectors. Currently used by RepeatedMapVector and MapVector
@@ -48,7 +50,7 @@ public abstract class AbstractMapVector extends AbstractContainerVector {
     for (MaterializedField child : clonedField.getChildren()) {
       if (!child.equals(BaseRepeatedValueVector.OFFSETS_FIELD)) {
         final String fieldName = child.getLastName();
-        final ValueVector v = TypeHelper.getNewVector(child, allocator, callBack);
+        final ValueVector v = BasicTypeHelper.getNewVector(child, allocator, callBack);
         putVector(fieldName, v);
       }
     }
@@ -128,7 +130,7 @@ public abstract class AbstractMapVector extends AbstractContainerVector {
       create = true;
     }
     if (create) {
-      final T vector = (T) TypeHelper.getNewVector(field.getPath(), name, allocator, type, callBack);
+      final T vector = (T) BasicTypeHelper.getNewVector(field.getPath(), name, allocator, type, callBack);
       putChild(name, vector);
       if (callBack!=null) {
         callBack.doWork();

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/BaseRepeatedValueVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/BaseRepeatedValueVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/BaseRepeatedValueVector.java
index de4ad95..bc90eda 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/BaseRepeatedValueVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/BaseRepeatedValueVector.java
@@ -17,16 +17,15 @@
  */
 package org.apache.drill.exec.vector.complex;
 
+import io.netty.buffer.DrillBuf;
+
 import java.util.Collections;
 import java.util.Iterator;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ObjectArrays;
-import io.netty.buffer.DrillBuf;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.exception.SchemaChangeRuntimeException;
-import org.apache.drill.exec.expr.TypeHelper;
+import org.apache.drill.exec.expr.BasicTypeHelper;
 import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.proto.UserBitShared;
 import org.apache.drill.exec.record.MaterializedField;
@@ -37,6 +36,9 @@ import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.exec.vector.VectorDescriptor;
 import org.apache.drill.exec.vector.ZeroVector;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ObjectArrays;
+
 public abstract class BaseRepeatedValueVector extends BaseValueVector implements RepeatedValueVector {
 
   public final static ValueVector DEFAULT_DATA_VECTOR = ZeroVector.INSTANCE;
@@ -185,7 +187,7 @@ public abstract class BaseRepeatedValueVector extends BaseValueVector implements
     boolean created = false;
     if (vector == DEFAULT_DATA_VECTOR && descriptor.getType().getMinorType() != TypeProtos.MinorType.LATE) {
       final MaterializedField field = descriptor.withName(DATA_VECTOR_NAME).getField();
-      vector = TypeHelper.getNewVector(field, allocator);
+      vector = BasicTypeHelper.getNewVector(field, allocator);
       // returned vector must have the same field
       assert field.equals(vector.getField());
       getField().addChild(field);

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
index e5d9443..b780d1a 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
@@ -26,7 +26,7 @@ import org.apache.drill.common.types.TypeProtos.DataMode;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.proto.UserBitShared;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
@@ -72,7 +72,7 @@ public class ListVector extends BaseRepeatedValueVector {
   }
 
   @Override
-  public void allocateNew() throws OutOfMemoryRuntimeException {
+  public void allocateNew() throws OutOfMemoryException {
     super.allocateNewSafe();
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
index 048358c..60d74c1 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
@@ -17,9 +17,6 @@
  */
 package org.apache.drill.exec.vector.complex;
 
-import com.google.common.collect.Ordering;
-import com.google.common.primitives.Ints;
-
 import io.netty.buffer.DrillBuf;
 
 import java.util.Collection;
@@ -34,7 +31,7 @@ import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.expr.TypeHelper;
+import org.apache.drill.exec.expr.BasicTypeHelper;
 import org.apache.drill.exec.expr.holders.ComplexHolder;
 import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
@@ -49,6 +46,8 @@ import org.apache.drill.exec.vector.complex.impl.SingleMapReaderImpl;
 import org.apache.drill.exec.vector.complex.reader.FieldReader;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.Ordering;
+import com.google.common.primitives.Ints;
 
 public class MapVector extends AbstractMapVector {
   //private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MapVector.class);
@@ -269,7 +268,7 @@ public class MapVector extends AbstractMapVector {
       ValueVector vector = getChild(fieldDef.getLastName());
       if (vector == null) {
         // if we arrive here, we didn't have a matching vector.
-        vector = TypeHelper.getNewVector(fieldDef, allocator);
+        vector = BasicTypeHelper.getNewVector(fieldDef, allocator);
         putChild(fieldDef.getLastName(), vector);
       }
       if (child.getValueCount() == 0) {

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
index 330eed4..cbc61f8 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
@@ -32,7 +32,7 @@ import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.expr.holders.ComplexHolder;
 import org.apache.drill.exec.expr.holders.RepeatedListHolder;
 import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
+import org.apache.drill.exec.exception.OutOfMemoryException;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
@@ -182,9 +182,9 @@ public class RepeatedListVector extends AbstractContainerVector
     }
 
     @Override
-    public void allocateNew() throws OutOfMemoryRuntimeException {
+    public void allocateNew() throws OutOfMemoryException {
       if (!allocateNewSafe()) {
-        throw new OutOfMemoryRuntimeException();
+        throw new OutOfMemoryException();
       }
     }
 
@@ -300,7 +300,7 @@ public class RepeatedListVector extends AbstractContainerVector
   }
 
   @Override
-  public void allocateNew() throws OutOfMemoryRuntimeException {
+  public void allocateNew() throws OutOfMemoryException {
     delegate.allocateNew();
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
index 618e3a3..cb597be 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
@@ -31,11 +31,11 @@ import org.apache.drill.common.types.TypeProtos.DataMode;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.expr.TypeHelper;
+import org.apache.drill.exec.exception.OutOfMemoryException;
+import org.apache.drill.exec.expr.BasicTypeHelper;
 import org.apache.drill.exec.expr.holders.ComplexHolder;
 import org.apache.drill.exec.expr.holders.RepeatedMapHolder;
 import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
@@ -108,7 +108,7 @@ public class RepeatedMapVector extends AbstractMapVector
       for (ValueVector v : getChildren()) {
         AllocationHelper.allocatePrecomputedChildCount(v, groupCount, 50, innerValueCount);
       }
-    } catch (OutOfMemoryRuntimeException e){
+    } catch (OutOfMemoryException e){
       clear();
       throw e;
     }
@@ -458,7 +458,7 @@ public class RepeatedMapVector extends AbstractMapVector
       ValueVector vector = getChild(fieldDef.getLastName());
       if (vector == null) {
         // if we arrive here, we didn't have a matching vector.
-        vector = TypeHelper.getNewVector(fieldDef, allocator);
+        vector = BasicTypeHelper.getNewVector(fieldDef, allocator);
         putChild(fieldDef.getLastName(), vector);
       }
       final int vectorLength = child.getBufferLength();

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java
index 5575b5e..468c0d5 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java
@@ -17,12 +17,9 @@
  */
 package org.apache.drill.exec.vector.complex.impl;
 
-import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.record.MaterializedField;
-import org.apache.drill.exec.record.VectorContainer;
-import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.exec.vector.complex.MapVector;
 import org.apache.drill.exec.vector.complex.StateTool;
 import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter;
@@ -192,27 +189,5 @@ public class ComplexWriterImpl extends AbstractFieldWriter implements ComplexWri
     return listRoot;
   }
 
-  private static class VectorAccessibleFacade extends MapVector {
 
-    private final VectorContainer vc;
-
-    public VectorAccessibleFacade(VectorContainer vc) {
-      super("", null, null);
-      this.vc = vc;
-    }
-
-    @Override
-    public <T extends ValueVector> T addOrGet(String name, MajorType type, Class<T> clazz) {
-      final ValueVector v = vc.addOrGet(name, type, clazz);
-      putChild(name, v);
-      return this.typeify(v, clazz);
-
-    }
-
-  }
-
-  public static ComplexWriter getWriter(String name, VectorContainer container){
-    VectorAccessibleFacade vc = new VectorAccessibleFacade(container);
-    return new ComplexWriterImpl(name, vc);
-  }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/4524fdbe/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
index 5f57c01..894e60e 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
@@ -17,10 +17,12 @@
  */
 package org.apache.drill.exec.vector.complex.impl;
 
+import java.lang.reflect.Constructor;
+
 import org.apache.drill.common.expression.FieldReference;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.expr.TypeHelper;
+import org.apache.drill.exec.expr.BasicTypeHelper;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
 import org.apache.drill.exec.vector.ValueVector;
@@ -31,8 +33,6 @@ import org.apache.drill.exec.vector.complex.ListVector;
 import org.apache.drill.exec.vector.complex.UnionVector;
 import org.apache.drill.exec.vector.complex.writer.FieldWriter;
 
-import java.lang.reflect.Constructor;
-
 /**
  * This FieldWriter implementation delegates all FieldWriter API calls to an inner FieldWriter. This inner field writer
  * can start as a specific type, and this class will promote the writer to a UnionWriter if a call is made that the specifically
@@ -85,11 +85,13 @@ public class PromotableWriter extends AbstractPromotableFieldWriter {
     state = State.SINGLE;
     vector = v;
     type = v.getField().getType().getMinorType();
-    Class writerClass = TypeHelper.getWriterImpl(v.getField().getType().getMinorType(), v.getField().getDataMode());
+    Class writerClass = BasicTypeHelper
+        .getWriterImpl(v.getField().getType().getMinorType(), v.getField().getDataMode());
     if (writerClass.equals(SingleListWriter.class)) {
       writerClass = UnionListWriter.class;
     }
-    Class vectorClass = TypeHelper.getValueVectorClass(v.getField().getType().getMinorType(), v.getField().getDataMode());
+    Class vectorClass = BasicTypeHelper.getValueVectorClass(v.getField().getType().getMinorType(), v.getField()
+        .getDataMode());
     try {
       Constructor constructor = null;
       for (Constructor c : writerClass.getConstructors()) {


Mime
View raw message