drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [3/3] drill git commit: DRILL-1960: Automatic reallocation
Date Fri, 23 Jan 2015 01:56:35 GMT
DRILL-1960: Automatic reallocation


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

Branch: refs/heads/master
Commit: a22b47243dbfdc5d956a5a7cf7964a6b9ae1418e
Parents: 839ae24
Author: Steven Phillips <sphillips@maprtech.com>
Authored: Fri Jan 16 16:30:21 2015 -0800
Committer: Steven Phillips <sphillips@maprtech.com>
Committed: Thu Jan 22 17:02:12 2015 -0800

----------------------------------------------------------------------
 .../exec/store/hbase/HBaseRecordReader.java     |  10 +-
 .../exec/store/hive/HiveFieldConverter.java     |  66 ++--
 .../drill/exec/store/hive/HiveRecordReader.java |   6 +-
 .../exec/store/hive/HiveTextRecordReader.java   |   8 +-
 .../exec/store/mongo/MongoRecordReader.java     |   9 +-
 .../main/codegen/templates/ComplexReaders.java  |   8 +-
 .../main/codegen/templates/ComplexWriters.java  |  19 +-
 .../codegen/templates/FixedValueVectors.java    | 123 ++++----
 .../src/main/codegen/templates/MapWriters.java  |  10 +-
 .../codegen/templates/NullableValueVectors.java | 131 +++-----
 .../codegen/templates/RepeatedValueVectors.java |  75 ++---
 .../src/main/codegen/templates/TypeHelper.java  |  17 +-
 .../templates/VariableLengthVectors.java        |  86 ++----
 .../drill/exec/expr/EvaluationVisitor.java      |  18 --
 .../drill/exec/expr/fn/DrillAggFuncHolder.java  |  17 +-
 .../expr/fn/DrillComplexWriterFuncHolder.java   |   6 +-
 .../physical/impl/aggregate/HashAggBatch.java   |  25 +-
 .../impl/aggregate/HashAggTemplate.java         | 302 ++++++++-----------
 .../physical/impl/aggregate/HashAggregator.java |   6 +-
 .../impl/aggregate/StreamingAggBatch.java       |   6 -
 .../impl/aggregate/StreamingAggTemplate.java    |  85 ++----
 .../physical/impl/common/ChainedHashTable.java  |  71 ++---
 .../exec/physical/impl/common/HashTable.java    |   2 +-
 .../physical/impl/common/HashTableTemplate.java |  91 ++----
 .../impl/flatten/FlattenRecordBatch.java        |   1 -
 .../exec/physical/impl/join/HashJoinBatch.java  |  88 +++---
 .../exec/physical/impl/join/HashJoinProbe.java  |   4 +-
 .../impl/join/HashJoinProbeTemplate.java        |  82 ++---
 .../exec/physical/impl/join/JoinTemplate.java   |  25 +-
 .../exec/physical/impl/join/MergeJoinBatch.java |  16 +-
 .../MergingReceiverGeneratorBase.java           |   2 +-
 .../mergereceiver/MergingReceiverTemplate.java  |   2 +-
 .../impl/mergereceiver/MergingRecordBatch.java  |  22 +-
 .../OrderedPartitionProjectorTemplate.java      |   4 +-
 .../partitionsender/PartitionerTemplate.java    |  47 +--
 .../impl/project/ProjectRecordBatch.java        |  17 +-
 .../impl/project/ProjectorTemplate.java         |  10 +-
 .../impl/svremover/CopierTemplate2.java         |  16 +-
 .../impl/svremover/CopierTemplate4.java         |  16 +-
 .../window/StreamingWindowFrameRecordBatch.java |   4 -
 .../window/StreamingWindowFrameTemplate.java    |  14 +-
 .../impl/xsort/PriorityQueueCopierTemplate.java |   7 +-
 .../apache/drill/exec/record/TransferPair.java  |   2 +-
 .../columnreaders/FixedWidthRepeatedReader.java |   6 +-
 .../columnreaders/NullableBitReader.java        |   6 +-
 .../columnreaders/VarLengthColumnReaders.java   |  28 +-
 .../columnreaders/VarLengthValuesColumn.java    |   6 +-
 .../drill/exec/store/pojo/PojoRecordReader.java |   8 +-
 .../drill/exec/store/pojo/PojoWriter.java       |   2 +-
 .../apache/drill/exec/store/pojo/Writers.java   |  57 ++--
 .../exec/store/text/DrillTextRecordReader.java  |  20 +-
 .../drill/exec/vector/AllocationHelper.java     |  15 +
 .../org/apache/drill/exec/vector/BitVector.java |  39 ++-
 .../org/apache/drill/exec/vector/CopyUtil.java  |  18 +-
 .../exec/vector/RepeatedFixedWidthVector.java   |   2 +-
 .../drill/exec/vector/RepeatedMutator.java      |   2 +-
 .../drill/exec/vector/VariableWidthVector.java  |   2 +-
 .../drill/exec/vector/complex/MapVector.java    |  15 +-
 .../exec/vector/complex/RepeatedListVector.java |  30 +-
 .../exec/vector/complex/RepeatedMapVector.java  |  48 ++-
 .../complex/impl/RepeatedListReaderImpl.java    |   4 +-
 .../complex/impl/RepeatedMapReaderImpl.java     |   6 +-
 .../complex/impl/SingleMapReaderImpl.java       |   4 +-
 .../physical/impl/window/TestWindowFrame.java   |   4 +
 .../exec/vector/TestAdaptiveAllocation.java     | 108 -------
 65 files changed, 770 insertions(+), 1236 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
index 33bf376..16ccc15 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
@@ -204,10 +204,7 @@ public class HBaseRecordReader extends AbstractRecordReader implements DrillHBas
       KeyValue[] kvs = result.raw();
       byte[] bytes = result.getBytes().get();
       if (rowKeyVector != null) {
-        if (!rowKeyVector.getMutator().setSafe(rowCount, bytes, kvs[0].getRowOffset(), kvs[0].getRowLength())) {
-          leftOver = result;
-          break done;
-        }
+        rowKeyVector.getMutator().setSafe(rowCount, bytes, kvs[0].getRowOffset(), kvs[0].getRowLength());
       }
 
       for (KeyValue kv : kvs) {
@@ -221,10 +218,7 @@ public class HBaseRecordReader extends AbstractRecordReader implements DrillHBas
 
         int valueOffset = kv.getValueOffset();
         int valueLength = kv.getValueLength();
-        if (!v.getMutator().setSafe(rowCount, bytes, valueOffset, valueLength)) {
-          leftOver = result;
-          break done;
-        }
+        v.getMutator().setSafe(rowCount, bytes, valueOffset, valueLength);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java
index 82e038c..658dd79 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java
@@ -67,7 +67,7 @@ import com.google.common.collect.Maps;
 
 public abstract class HiveFieldConverter {
 
-  public abstract boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex);
+  public abstract void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex);
 
   private static Map<PrimitiveCategory, Class< ? extends HiveFieldConverter>> primMap = Maps.newHashMap();
 
@@ -129,25 +129,25 @@ public abstract class HiveFieldConverter {
 
   public static class Binary extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final byte[] value = ((BinaryObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
-      return ((NullableVarBinaryVector) outputVV).getMutator().setSafe(outputIndex, value, 0, value.length);
+      ((NullableVarBinaryVector) outputVV).getMutator().setSafe(outputIndex, value, 0, value.length);
     }
   }
 
   public static class Boolean extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final boolean value = (boolean) ((BooleanObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
-      return ((NullableBitVector) outputVV).getMutator().setSafe(outputIndex, value ? 1 : 0);
+      ((NullableBitVector) outputVV).getMutator().setSafe(outputIndex, value ? 1 : 0);
     }
   }
 
   public static class Byte extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final byte value = (byte) ((ByteObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
-      return ((NullableTinyIntVector) outputVV).getMutator().setSafe(outputIndex, value);
+      ((NullableTinyIntVector) outputVV).getMutator().setSafe(outputIndex, value);
     }
   }
 
@@ -160,11 +160,11 @@ public abstract class HiveFieldConverter {
     }
 
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       holder.value = DecimalUtility.getDecimal9FromBigDecimal(
           ((HiveDecimalObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue).bigDecimalValue(),
           holder.scale, holder.precision);
-      return ((NullableDecimal9Vector) outputVV).getMutator().setSafe(outputIndex, holder);
+      ((NullableDecimal9Vector) outputVV).getMutator().setSafe(outputIndex, holder);
     }
   }
 
@@ -177,11 +177,11 @@ public abstract class HiveFieldConverter {
     }
 
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       holder.value = DecimalUtility.getDecimal18FromBigDecimal(
           ((HiveDecimalObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue).bigDecimalValue(),
           holder.scale, holder.precision);
-      return ((NullableDecimal18Vector) outputVV).getMutator().setSafe(outputIndex, holder);
+      ((NullableDecimal18Vector) outputVV).getMutator().setSafe(outputIndex, holder);
     }
   }
 
@@ -196,11 +196,11 @@ public abstract class HiveFieldConverter {
     }
 
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       DecimalUtility.getSparseFromBigDecimal(
           ((HiveDecimalObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue).bigDecimalValue(),
           holder.buffer, holder.start, holder.scale, holder.precision, Decimal28SparseHolder.nDecimalDigits);
-      return ((NullableDecimal28SparseVector) outputVV).getMutator().setSafe(outputIndex, holder);
+      ((NullableDecimal28SparseVector) outputVV).getMutator().setSafe(outputIndex, holder);
     }
   }
 
@@ -215,89 +215,89 @@ public abstract class HiveFieldConverter {
     }
 
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       DecimalUtility.getSparseFromBigDecimal(
           ((HiveDecimalObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue).bigDecimalValue(),
           holder.buffer, holder.start, holder.scale, holder.precision, Decimal38SparseHolder.nDecimalDigits);
-      return ((NullableDecimal38SparseVector) outputVV).getMutator().setSafe(outputIndex, holder);
+      ((NullableDecimal38SparseVector) outputVV).getMutator().setSafe(outputIndex, holder);
     }
   }
 
   public static class Double extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final double value = (double) ((DoubleObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
-      return ((NullableFloat8Vector) outputVV).getMutator().setSafe(outputIndex, value);
+      ((NullableFloat8Vector) outputVV).getMutator().setSafe(outputIndex, value);
     }
   }
 
   public static class Float extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final float value = (float) ((FloatObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
-      return ((NullableFloat4Vector) outputVV).getMutator().setSafe(outputIndex, value);
+      ((NullableFloat4Vector) outputVV).getMutator().setSafe(outputIndex, value);
     }
   }
 
   public static class Int extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final int value = (int) ((IntObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
-      return ((NullableIntVector) outputVV).getMutator().setSafe(outputIndex, value);
+      ((NullableIntVector) outputVV).getMutator().setSafe(outputIndex, value);
     }
   }
 
   public static class Long extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final long value = (long) ((LongObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
-      return ((NullableBigIntVector) outputVV).getMutator().setSafe(outputIndex, value);
+      ((NullableBigIntVector) outputVV).getMutator().setSafe(outputIndex, value);
     }
   }
 
   public static class Short extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final short value = (short) ((ShortObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
-      return ((NullableSmallIntVector) outputVV).getMutator().setSafe(outputIndex, value);
+      ((NullableSmallIntVector) outputVV).getMutator().setSafe(outputIndex, value);
     }
   }
 
   public static class String extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final Text value = ((StringObjectInspector)oi).getPrimitiveWritableObject(hiveFieldValue);
       final byte[] valueBytes = value.getBytes();
       final int len = value.getLength();
-      return ((NullableVarCharVector) outputVV).getMutator().setSafe(outputIndex, valueBytes, 0, len);
+      ((NullableVarCharVector) outputVV).getMutator().setSafe(outputIndex, valueBytes, 0, len);
     }
   }
 
   public static class VarChar extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final Text value = ((HiveVarcharObjectInspector)oi).getPrimitiveWritableObject(hiveFieldValue).getTextValue();
       final byte[] valueBytes = value.getBytes();
       final int valueLen = value.getLength();
-      return ((NullableVarCharVector) outputVV).getMutator().setSafe(outputIndex, valueBytes, 0, valueLen);
+      ((NullableVarCharVector) outputVV).getMutator().setSafe(outputIndex, valueBytes, 0, valueLen);
     }
   }
 
   public static class Timestamp extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final java.sql.Timestamp value = ((TimestampObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
       final DateTime ts = new DateTime(value.getTime()).withZoneRetainFields(DateTimeZone.UTC);
-      return ((NullableTimeStampVector) outputVV).getMutator().setSafe(outputIndex, ts.getMillis());
+      ((NullableTimeStampVector) outputVV).getMutator().setSafe(outputIndex, ts.getMillis());
     }
   }
 
   public static class Date extends HiveFieldConverter {
     @Override
-    public boolean setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
+    public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
       final java.sql.Date value = ((DateObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
       final DateTime date = new DateTime(value.getTime()).withZoneRetainFields(DateTimeZone.UTC);
-      return ((NullableDateVector) outputVV).getMutator().setSafe(outputIndex, date.getMillis());
+      ((NullableDateVector) outputVV).getMutator().setSafe(outputIndex, date.getMillis());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
index 625a7b2..bad7a4e 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
@@ -327,12 +327,8 @@ public class HiveRecordReader extends AbstractRecordReader {
       Object hiveValue = sInspector.getStructFieldData(deSerializedValue, sInspector.getStructFieldRef(columnName));
 
       if (hiveValue != null) {
-        success = selectedColumnFieldConverters.get(i).setSafeValue(selectedColumnObjInspectors.get(i), hiveValue,
+        selectedColumnFieldConverters.get(i).setSafeValue(selectedColumnObjInspectors.get(i), hiveValue,
             vectors.get(i), outputRecordIndex);
-
-        if (!success) {
-          return false;
-        }
       }
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java
index 5406048..2deb7c5 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java
@@ -66,7 +66,7 @@ public class HiveTextRecordReader extends HiveRecordReader {
     numCols = tableColumns.size();
   }
 
-  public boolean setValue(PrimitiveObjectInspector.PrimitiveCategory pCat, ValueVector vv, int index, byte[] bytes, int start) {
+  public void setValue(PrimitiveObjectInspector.PrimitiveCategory pCat, ValueVector vv, int index, byte[] bytes, int start) {
     switch(pCat) {
       case BINARY:
         throw new UnsupportedOperationException();
@@ -86,7 +86,7 @@ public class HiveTextRecordReader extends HiveRecordReader {
         for (int i = start; (b = bytes[i]) != delimiter; i++) {
           value = (value * 10) + b - 48;
         }
-        return ((NullableIntVector) vv).getMutator().setSafe(index, value);
+        ((NullableIntVector) vv).getMutator().setSafe(index, value);
       }
       case LONG: {
         long value = 0;
@@ -94,7 +94,7 @@ public class HiveTextRecordReader extends HiveRecordReader {
         for (int i = start; (b = bytes[i]) != delimiter; i++) {
           value = (value * 10) + b - 48;
         }
-        return ((NullableBigIntVector) vv).getMutator().setSafe(index, value);
+        ((NullableBigIntVector) vv).getMutator().setSafe(index, value);
       }
       case SHORT:
         throw new UnsupportedOperationException();
@@ -107,7 +107,7 @@ public class HiveTextRecordReader extends HiveRecordReader {
           }
           end = bytes.length;
         }
-        return ((NullableVarCharVector) vv).getMutator().setSafe(index, bytes, start, end - start);
+        ((NullableVarCharVector) vv).getMutator().setSafe(index, bytes, start, end - start);
       }
       case TIMESTAMP:
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java
----------------------------------------------------------------------
diff --git a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java
index 79abe60..4b73600 100644
--- a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java
+++ b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java
@@ -235,13 +235,8 @@ public class MongoRecordReader extends AbstractRecordReader {
       for (; rowCount < TARGET_RECORD_COUNT && cursor.hasNext(); rowCount++) {
         String doc = cursor.next().toString();
         byte[] record = doc.getBytes(Charsets.UTF_8);
-        if (!valueVector.getMutator().setSafe(rowCount, record, 0,
-            record.length)) {
-          logger.warn(errMsg, doc);
-          if (rowCount == 0) {
-            break;
-          }
-        }
+        valueVector.getMutator().setSafe(rowCount, record, 0,
+            record.length);
       }
       valueVector.getMutator().setValueCount(rowCount);
       logger.debug("Took {} ms to get {} records",

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/codegen/templates/ComplexReaders.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/ComplexReaders.java b/exec/java-exec/src/main/codegen/templates/ComplexReaders.java
index 027f61d..9d05934 100644
--- a/exec/java-exec/src/main/codegen/templates/ComplexReaders.java
+++ b/exec/java-exec/src/main/codegen/templates/ComplexReaders.java
@@ -77,14 +77,14 @@ public class ${nullMode}${name}ReaderImpl extends AbstractFieldReader {
   public void copyAsValue(${minor.class?cap_first}Writer writer){
     if (writer.ok()) {
       Repeated${minor.class?cap_first}WriterImpl impl = (Repeated${minor.class?cap_first}WriterImpl) writer;
-      impl.inform(impl.vector.copyFromSafe(idx(), impl.idx(), vector));
+      impl.vector.copyFromSafe(idx(), impl.idx(), vector);
     }
   }
   
   public void copyAsField(String name, MapWriter writer){
     if (writer.ok()) {
       Repeated${minor.class?cap_first}WriterImpl impl = (Repeated${minor.class?cap_first}WriterImpl)  writer.list(name).${lowerName}();
-      impl.inform(impl.vector.copyFromSafe(idx(), impl.idx(), vector));
+      impl.vector.copyFromSafe(idx(), impl.idx(), vector);
     }
   }
   
@@ -113,14 +113,14 @@ public class ${nullMode}${name}ReaderImpl extends AbstractFieldReader {
   public void copyAsValue(${minor.class?cap_first}Writer writer){
     if (writer.ok()) {
       ${nullMode}${minor.class?cap_first}WriterImpl impl = (${nullMode}${minor.class?cap_first}WriterImpl) writer;
-      impl.inform(impl.vector.copyFromSafe(idx(), impl.idx(), vector));
+      impl.vector.copyFromSafe(idx(), impl.idx(), vector);
     }
   }
   
   public void copyAsField(String name, MapWriter writer){
     if (writer.ok()) {
       ${nullMode}${minor.class?cap_first}WriterImpl impl = (${nullMode}${minor.class?cap_first}WriterImpl) writer.${lowerName}(name);
-      impl.inform(impl.vector.copyFromSafe(idx(), impl.idx(), vector));
+      impl.vector.copyFromSafe(idx(), impl.idx(), vector);
     }
   }
   

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/codegen/templates/ComplexWriters.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/ComplexWriters.java b/exec/java-exec/src/main/codegen/templates/ComplexWriters.java
index 5ba1c64..576fd83 100644
--- a/exec/java-exec/src/main/codegen/templates/ComplexWriters.java
+++ b/exec/java-exec/src/main/codegen/templates/ComplexWriters.java
@@ -86,7 +86,7 @@ public class ${eName}WriterImpl extends AbstractFieldWriter {
   public void write(${minor.class?cap_first}Holder h){
     if(ok()){
       // update to inform(addSafe) once available for all repeated vector types for holders.
-      inform(mutator.addSafe(idx(), h));
+      mutator.addSafe(idx(), h);
       vector.setCurrentValueCount(idx());
     }
   }
@@ -94,7 +94,7 @@ public class ${eName}WriterImpl extends AbstractFieldWriter {
   public void write(Nullable${minor.class?cap_first}Holder h){
     if(ok()){
       // update to inform(addSafe) once available for all repeated vector types for holders.
-      inform(mutator.addSafe(idx(), h));
+      mutator.addSafe(idx(), h);
       vector.setCurrentValueCount(idx());
     }
   }
@@ -103,7 +103,7 @@ public class ${eName}WriterImpl extends AbstractFieldWriter {
   public void write${minor.class}(<#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>){
     if(ok()){
       // update to inform(setSafe) once available for all vector types for holders.
-      inform(mutator.addSafe(idx(), <#list fields as field>${field.name}<#if field_has_next>, </#if></#list>));
+      mutator.addSafe(idx(), <#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
       vector.setCurrentValueCount(idx());
     }
   }
@@ -112,7 +112,7 @@ public class ${eName}WriterImpl extends AbstractFieldWriter {
   public void setPosition(int idx){
     if (ok()){
       super.setPosition(idx);
-      inform(mutator.startNewGroup(idx));
+      mutator.startNewGroup(idx);
     }
   }
   
@@ -121,16 +121,14 @@ public class ${eName}WriterImpl extends AbstractFieldWriter {
   
   public void write(${minor.class}Holder h){
     if(ok()){
-      // update to inform(setSafe) once available for all vector types for holders.
-      inform(mutator.setSafe(idx(), h));
+      mutator.setSafe(idx(), h);
       vector.setCurrentValueCount(idx());
     }
   }
   
   public void write(Nullable${minor.class}Holder h){
     if(ok()){
-      // update to inform(setSafe) once available for all vector types for holders.
-      inform(mutator.setSafe(idx(), h));
+      mutator.setSafe(idx(), h);
       vector.setCurrentValueCount(idx());
     }
   }
@@ -138,8 +136,7 @@ public class ${eName}WriterImpl extends AbstractFieldWriter {
   <#if !(minor.class == "Decimal9" || minor.class == "Decimal18" || minor.class == "Decimal28Sparse" || minor.class == "Decimal38Sparse" || minor.class == "Decimal28Dense" || minor.class == "Decimal38Dense")>
   public void write${minor.class}(<#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>){
     if(ok()){
-      // update to inform(setSafe) once available for all vector types for holders.
-      inform(mutator.setSafe(idx(), <#if mode == "Nullable">1, </#if><#list fields as field>${field.name}<#if field_has_next>, </#if></#list>));
+      mutator.setSafe(idx(), <#if mode == "Nullable">1, </#if><#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
       vector.setCurrentValueCount(idx());
     }
   }
@@ -147,7 +144,7 @@ public class ${eName}WriterImpl extends AbstractFieldWriter {
   <#if mode == "Nullable">
   public void writeNull(){
     if(ok()){
-      inform(mutator.setNull(idx()));
+      mutator.setNull(idx());
       vector.setCurrentValueCount(idx());
     }
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
index 58e6ccc..1663534 100644
--- a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
@@ -96,6 +96,19 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
     this.allocationValueCount = valueCount;
   }
 
+/**
+ * Allocate new buffer with double capacity, and copy data into the new buffer. Replace vector's buffer with new buffer, and release old one
+ */
+  public void reAlloc() {
+    logger.info("Realloc vector {}. [{}] -> [{}]", field, allocationValueCount * ${type.width}, allocationValueCount * 2 * ${type.width});
+    allocationValueCount *= 2;
+    DrillBuf newBuf = allocator.buffer(allocationValueCount * ${type.width});
+    newBuf.setBytes(0, data, 0, data.capacity());
+    newBuf.setZero(newBuf.capacity() / 2, newBuf.capacity() / 2);
+    data.release();
+    data = newBuf;
+  }
+
   /**
    * {@inheritDoc}
    */
@@ -187,12 +200,12 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
     }
     
     @Override
-    public boolean copyValueSafe(int fromIndex, int toIndex) {
-      return to.copyFromSafe(fromIndex, toIndex, ${minor.class}Vector.this);
+    public void copyValueSafe(int fromIndex, int toIndex) {
+      to.copyFromSafe(fromIndex, toIndex, ${minor.class}Vector.this);
     }
   }
   
-  protected void copyFrom(int fromIndex, int thisIndex, ${minor.class}Vector from){
+  public void copyFrom(int fromIndex, int thisIndex, ${minor.class}Vector from){
     <#if (type.width > 8)>
     from.data.getBytes(fromIndex * ${type.width}, data, thisIndex * ${type.width}, ${type.width});
     <#else> <#-- type.width <= 8 -->
@@ -202,13 +215,11 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
     </#if> <#-- type.width -->
   }
   
-  public boolean copyFromSafe(int fromIndex, int thisIndex, ${minor.class}Vector from){
+  public void copyFromSafe(int fromIndex, int thisIndex, ${minor.class}Vector from){
     if(thisIndex >= getValueCapacity()) {
-      decrementAllocationMonitor();
-      return false;
+        reAlloc();
     }
     copyFrom(fromIndex, thisIndex, from);
-    return true;
   }
 
   private void decrementAllocationMonitor() {
@@ -551,13 +562,11 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
      data.setBytes(index * ${type.width}, value, 0, ${type.width});
    }
 
-   public boolean setSafe(int index, <#if (type.width > 4)>${minor.javaType!type.javaType}<#else>int</#if> value) {
+   public void setSafe(int index, <#if (type.width > 4)>${minor.javaType!type.javaType}<#else>int</#if> value) {
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      data.setBytes(index * ${type.width}, value, 0, ${type.width});
-     return true;
    }
 
    <#if (minor.class == "TimeStampTZ")>
@@ -566,29 +575,27 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
      data.setInt(((index * ${type.width}) + ${minor.millisecondsSize}), tzindex);
    }
    
-   protected void set(int index, ${minor.class}Holder holder){
+   public void set(int index, ${minor.class}Holder holder){
      set(index, holder.value, holder.index);
    }
 
-   protected void set(int index, Nullable${minor.class}Holder holder){
+   public void set(int index, Nullable${minor.class}Holder holder){
      set(index, holder.value, holder.index);
    }
 
-   public boolean setSafe(int index, long timestamp, int tzindex){
+   public void setSafe(int index, long timestamp, int tzindex){
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      set(index, timestamp, tzindex);
-     return true;
    }
    
-   public boolean setSafe(int index, ${minor.class}Holder holder){
-     return setSafe(index, holder.value, holder.index);
+   public void setSafe(int index, ${minor.class}Holder holder){
+     setSafe(index, holder.value, holder.index);
    }
 
-   public boolean setSafe(int index, Nullable${minor.class}Holder holder){
-     return setSafe(index, holder.value, holder.index);
+   public void setSafe(int index, Nullable${minor.class}Holder holder){
+     setSafe(index, holder.value, holder.index);
    }
    
    <#elseif (minor.class == "Interval")>
@@ -607,21 +614,19 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
      set(index, holder.months, holder.days, holder.milliseconds);
    }
 
-   public boolean setSafe(int index, int months, int days, int milliseconds){
+   public void setSafe(int index, int months, int days, int milliseconds){
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      set(index, months, days, milliseconds);
-     return true;
    }
 
-   public boolean setSafe(int index, Nullable${minor.class}Holder holder){
-     return setSafe(index, holder.months, holder.days, holder.milliseconds);
+   public void setSafe(int index, Nullable${minor.class}Holder holder){
+     setSafe(index, holder.months, holder.days, holder.milliseconds);
    }
    
-   public boolean setSafe(int index, ${minor.class}Holder holder){
-     return setSafe(index, holder.months, holder.days, holder.milliseconds);
+   public void setSafe(int index, ${minor.class}Holder holder){
+     setSafe(index, holder.months, holder.days, holder.milliseconds);
    }
    
    <#elseif (minor.class == "IntervalDay")>
@@ -638,21 +643,19 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
      set(index, holder.days, holder.milliseconds);
    }
 
-   public boolean setSafe(int index, int days, int milliseconds){
+   public void setSafe(int index, int days, int milliseconds){
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      set(index, days, milliseconds);
-     return true;
    }
    
-   public boolean setSafe(int index, ${minor.class}Holder holder){
-     return setSafe(index, holder.days, holder.milliseconds);
+   public void setSafe(int index, ${minor.class}Holder holder){
+     setSafe(index, holder.days, holder.milliseconds);
    }
 
-   public boolean setSafe(int index, Nullable${minor.class}Holder holder){
-     return setSafe(index, holder.days, holder.milliseconds);
+   public void setSafe(int index, Nullable${minor.class}Holder holder){
+     setSafe(index, holder.days, holder.milliseconds);
    }
 
    <#elseif (minor.class == "Decimal28Sparse" || minor.class == "Decimal38Sparse") || (minor.class == "Decimal28Dense") || (minor.class == "Decimal38Dense")>
@@ -665,20 +668,18 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
      set(index, holder.start, holder.buffer);
    }
    
-   public boolean setSafe(int index,  Nullable${minor.class}Holder holder){
-     return setSafe(index, holder.start, holder.buffer);
+   public void setSafe(int index,  Nullable${minor.class}Holder holder){
+     setSafe(index, holder.start, holder.buffer);
    }
-   public boolean setSafe(int index,  ${minor.class}Holder holder){
-     return setSafe(index, holder.start, holder.buffer);
+   public void setSafe(int index,  ${minor.class}Holder holder){
+     setSafe(index, holder.start, holder.buffer);
    }
    
-   public boolean setSafe(int index, int start, DrillBuf buffer){
+   public void setSafe(int index, int start, DrillBuf buffer){
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      set(index, start, buffer);
-     return true;
    }
    
    public void set(int index, int start, DrillBuf buffer){
@@ -699,20 +700,18 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
      data.setBytes(index * ${type.width}, buffer, start, ${type.width});
    }
    
-   public boolean setSafe(int index, ${minor.class}Holder holder){
-     return setSafe(index, holder.start, holder.buffer);
+   public void setSafe(int index, ${minor.class}Holder holder){
+     setSafe(index, holder.start, holder.buffer);
    }
-   public boolean setSafe(int index, Nullable${minor.class}Holder holder){
-     return setSafe(index, holder.start, holder.buffer);
+   public void setSafe(int index, Nullable${minor.class}Holder holder){
+     setSafe(index, holder.start, holder.buffer);
    }
    
-   public boolean setSafe(int index, int start, DrillBuf buffer){     
+   public void setSafe(int index, int start, DrillBuf buffer){
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      set(index, holder);
-     return true;
    }
 
    public void set(int index, Nullable${minor.class}Holder holder){
@@ -740,39 +739,33 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
      data.set${(minor.javaType!type.javaType)?cap_first}(index * ${type.width}, value);
    }
 
-   public boolean setSafe(int index, <#if (type.width >= 4)>${minor.javaType!type.javaType}<#else>int</#if> value) {
+   public void setSafe(int index, <#if (type.width >= 4)>${minor.javaType!type.javaType}<#else>int</#if> value) {
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      set(index, value);
-     return true;
    }
 
    protected void set(int index, ${minor.class}Holder holder){
      data.set${(minor.javaType!type.javaType)?cap_first}(index * ${type.width}, holder.value);
    }
 
-   public boolean setSafe(int index, ${minor.class}Holder holder){
+   public void setSafe(int index, ${minor.class}Holder holder){
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      set(index, holder);
-     return true;
    }
 
    protected void set(int index, Nullable${minor.class}Holder holder){
      data.set${(minor.javaType!type.javaType)?cap_first}(index * ${type.width}, holder.value);
    }
 
-   public boolean setSafe(int index, Nullable${minor.class}Holder holder){
+   public void setSafe(int index, Nullable${minor.class}Holder holder){
      if(index >= getValueCapacity()) {
-       decrementAllocationMonitor();
-       return false;
+       reAlloc();
      }
      set(index, holder);
-     return true;
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/codegen/templates/MapWriters.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/MapWriters.java b/exec/java-exec/src/main/codegen/templates/MapWriters.java
index b8bd73e..b8d5365 100644
--- a/exec/java-exec/src/main/codegen/templates/MapWriters.java
+++ b/exec/java-exec/src/main/codegen/templates/MapWriters.java
@@ -63,7 +63,11 @@ public class ${mode}MapWriter extends AbstractFieldWriter{
   }
 
   public void checkValueCapacity(){
-    inform(container.getValueCapacity() > idx());
+    <#if mode == "Repeated">
+    if (container.getValueCapacity() <= idx()) {
+      container.reAlloc();
+    }
+    </#if>
   }
 
   public MapWriter map(String name){
@@ -146,10 +150,6 @@ public class ${mode}MapWriter extends AbstractFieldWriter{
     }
   }
   public void start(){
-    // check capacity only after we have a non empty container
-    if(container.size() > 0 && ok()) {
-      checkValueCapacity();
-    }
   }
   
   public void end(){

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
index b222024..ba7c629 100644
--- a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
@@ -54,7 +54,7 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
 
   public ${className}(MaterializedField field, BufferAllocator allocator) {
     super(field, allocator);
-    this.bits = new UInt1Vector(null, allocator);
+    this.bits = new UInt1Vector(MaterializedField.create(field + "_bits", Types.required(MinorType.UINT1)), allocator);
     this.values = new ${minor.class}Vector(field, allocator);
     this.accessor = new Accessor();
     this.mutator = new Mutator();
@@ -288,8 +288,8 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
     }
 
     @Override
-    public boolean copyValueSafe(int fromIndex, int toIndex) {
-      return to.copyFromSafe(fromIndex, toIndex, Nullable${minor.class}Vector.this);
+    public void copyValueSafe(int fromIndex, int toIndex) {
+      to.copyFromSafe(fromIndex, toIndex, Nullable${minor.class}Vector.this);
     }
   }
   
@@ -311,29 +311,27 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
   }
 
   
-  protected void copyFrom(int fromIndex, int thisIndex, Nullable${minor.class}Vector from){
+  public void copyFrom(int fromIndex, int thisIndex, Nullable${minor.class}Vector from){
     if (!from.getAccessor().isNull(fromIndex)) {
       mutator.set(thisIndex, from.getAccessor().get(fromIndex));
     }
   }
 
   
-  public boolean copyFromSafe(int fromIndex, int thisIndex, ${minor.class}Vector from){
+  public void copyFromSafe(int fromIndex, int thisIndex, ${minor.class}Vector from){
     <#if type.major == "VarLen">
-    if(!mutator.fillEmpties(thisIndex)) return false;
+    mutator.fillEmpties(thisIndex);
     </#if>
-    boolean success = values.copyFromSafe(fromIndex, thisIndex, from);
-    success = success && bits.getMutator().setSafe(thisIndex, 1);
-    return success;    
+    values.copyFromSafe(fromIndex, thisIndex, from);
+    bits.getMutator().setSafe(thisIndex, 1);
   }
   
-  public boolean copyFromSafe(int fromIndex, int thisIndex, Nullable${minor.class}Vector from){
+  public void copyFromSafe(int fromIndex, int thisIndex, Nullable${minor.class}Vector from){
     <#if type.major == "VarLen">
-    if(!mutator.fillEmpties(thisIndex)) return false;
+    mutator.fillEmpties(thisIndex);
     </#if>
-    boolean b1 = bits.copyFromSafe(fromIndex, thisIndex, from.bits);
-    boolean b2 = values.copyFromSafe(fromIndex, thisIndex, from.values);
-    return b1 && b2;
+    bits.copyFromSafe(fromIndex, thisIndex, from.bits);
+    values.copyFromSafe(fromIndex, thisIndex, from.values);
   }
 
   public long getDataAddr(){
@@ -471,40 +469,36 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
     }
 
     <#if type.major == "VarLen">
-    private boolean fillEmpties(int index){
+    private void fillEmpties(int index){
       for (int i = lastSet + 1; i < index; i++) {
-        if(!values.getMutator().setSafe(i, new byte[]{})) return false;
+        values.getMutator().setSafe(i, new byte[]{});
+      }
+      if (index > bits.getValueCapacity()) {
+        bits.reAlloc();
       }
       lastSet = index;
-
-      return true;
     }
 
-    public boolean setValueLengthSafe(int index, int length) {
-      return values.getMutator().setValueLengthSafe(index, length);
+    public void setValueLengthSafe(int index, int length) {
+      values.getMutator().setValueLengthSafe(index, length);
     }
     </#if>
     
-    public boolean setSafe(int index, byte[] value, int start, int length) {
+    public void setSafe(int index, byte[] value, int start, int length) {
       <#if type.major != "VarLen">
       throw new UnsupportedOperationException();
       <#else>
-      if(!fillEmpties(index)) return false;
+      fillEmpties(index);
 
-      boolean b1 = bits.getMutator().setSafe(index, 1);
-      boolean b2 = values.getMutator().setSafe(index, value, start, length);
-      if(b1 && b2){
-        setCount++;
-        <#if type.major == "VarLen">lastSet = index;</#if>
-        return true;
-      }else{
-        return false;
-      }
+      bits.getMutator().setSafe(index, 1);
+      values.getMutator().setSafe(index, value, start, length);
+      setCount++;
+      <#if type.major == "VarLen">lastSet = index;</#if>
       </#if>
     }
 
-    public boolean setNull(int index){
-      return bits.getMutator().setSafe(index, 0);
+    public void setNull(int index){
+      bits.getMutator().setSafe(index, 0);
     }
     
     public void setSkipNull(int index, ${minor.class}Holder holder){
@@ -542,8 +536,6 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
       return outIndex < Nullable${minor.class}Vector.this.getValueCapacity();
     }
 
-    //public boolean setSafe(int index, int isSet<#if type.major == "VarLen" || minor.class == "TimeStampTZ" || minor.class == "Interval" || minor.class == "IntervalDay">Nullable${minor.class}Holder <#elseif (type.width < 4)>int<#else>${minor.javaType!type.javaType}</#if> value){
-
     <#assign fields = minor.fields!type.fields />
     public void set(int index, int isSet<#list fields as field><#if field.include!true >, ${field.type} ${field.name}Field</#if></#list> ){
       <#if type.major == "VarLen">
@@ -556,71 +548,48 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
       <#if type.major == "VarLen">lastSet = index;</#if>
     }
     
-    public boolean setSafe(int index, int isSet<#list fields as field><#if field.include!true >, ${field.type} ${field.name}Field</#if></#list> ) {
+    public void setSafe(int index, int isSet<#list fields as field><#if field.include!true >, ${field.type} ${field.name}Field</#if></#list> ) {
       <#if type.major == "VarLen">
-      if(!fillEmpties(index)) return false;
+      fillEmpties(index);
       </#if>
       
-      boolean b1 = bits.getMutator().setSafe(index, isSet);
-      boolean b2 = values.getMutator().setSafe(index<#list fields as field><#if field.include!true >, ${field.name}Field</#if></#list>);
-      if(b1 && b2){
-        setCount++;
-        <#if type.major == "VarLen">lastSet = index;</#if>
-        return true;
-      }else{
-        return false;
-      }
-
+      bits.getMutator().setSafe(index, isSet);
+      values.getMutator().setSafe(index<#list fields as field><#if field.include!true >, ${field.name}Field</#if></#list>);
+      setCount++;
+      <#if type.major == "VarLen">lastSet = index;</#if>
     }
 
 
-    public boolean setSafe(int index, Nullable${minor.class}Holder value) {
+    public void setSafe(int index, Nullable${minor.class}Holder value) {
 
       <#if type.major == "VarLen">
-      if(!fillEmpties(index)) return false;
+      fillEmpties(index);
       </#if>
-      boolean b1 = bits.getMutator().setSafe(index, value.isSet);
-      boolean b2 = values.getMutator().setSafe(index, value);
-      if(b1 && b2){
-        setCount++;
-        <#if type.major == "VarLen">lastSet = index;</#if>
-        return true;
-      }else{
-        return false;
-      }
-
+      bits.getMutator().setSafe(index, value.isSet);
+      values.getMutator().setSafe(index, value);
+      setCount++;
+      <#if type.major == "VarLen">lastSet = index;</#if>
     }
 
-    public boolean setSafe(int index, ${minor.class}Holder value) {
+    public void setSafe(int index, ${minor.class}Holder value) {
 
       <#if type.major == "VarLen">
-      if(!fillEmpties(index)) return false;
+      fillEmpties(index);
       </#if>
-      boolean b1 = bits.getMutator().setSafe(index, 1);
-      boolean b2 = values.getMutator().setSafe(index, value);
-      if(b1 && b2){
-        setCount++;
-        <#if type.major == "VarLen">lastSet = index;</#if>
-        return true;
-      }else{
-        return false;
-      }
-
+      bits.getMutator().setSafe(index, 1);
+      values.getMutator().setSafe(index, value);
+      setCount++;
+      <#if type.major == "VarLen">lastSet = index;</#if>
     }
     
     <#if !(type.major == "VarLen" || minor.class == "Decimal28Sparse" || minor.class == "Decimal38Sparse" || minor.class == "Decimal28Dense" || minor.class == "Decimal38Dense" || minor.class == "TimeStampTZ" || minor.class == "Interval" || minor.class == "IntervalDay")>
-      public boolean setSafe(int index, ${minor.javaType!type.javaType} value) {
+      public void setSafe(int index, ${minor.javaType!type.javaType} value) {
         <#if type.major == "VarLen">
-        if(!fillEmpties(index)) return false;
+        fillEmpties(index);
         </#if>
-        boolean b1 = bits.getMutator().setSafe(index, 1);
-        boolean b2 = values.getMutator().setSafe(index, value);
-        if(b1 && b2){
-          setCount++;
-          return true;
-        }else{
-          return false;
-        }
+        bits.getMutator().setSafe(index, 1);
+        values.getMutator().setSafe(index, value);
+        setCount++;
       }
 
     </#if>

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java b/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
index d261050..572181e 100644
--- a/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
@@ -152,8 +152,8 @@ public final class Repeated${minor.class}Vector extends BaseValueVector implemen
     }
     
     @Override
-    public boolean copyValueSafe(int fromIndex, int toIndex) {
-      return to.copyFromSafe(fromIndex, toIndex, Repeated${minor.class}Vector.this);
+    public void copyValueSafe(int fromIndex, int toIndex) {
+      to.copyFromSafe(fromIndex, toIndex, Repeated${minor.class}Vector.this);
     }
   }
 
@@ -165,15 +165,12 @@ public final class Repeated${minor.class}Vector extends BaseValueVector implemen
       }
     }
 
-    public boolean copyFromSafe(int inIndex, int outIndex, Repeated${minor.class}Vector v){
+    public void copyFromSafe(int inIndex, int outIndex, Repeated${minor.class}Vector v){
       int count = v.getAccessor().getCount(inIndex);
-      if(!getMutator().startNewGroup(outIndex)) return false;
+      getMutator().startNewGroup(outIndex);
       for (int i = 0; i < count; i++) {
-        if (!getMutator().addSafe(outIndex, v.getAccessor().get(inIndex, i))) {
-          return false;
-        }
+        getMutator().addSafe(outIndex, v.getAccessor().get(inIndex, i));
       }
-      return true;
     }
 
   public boolean allocateNewSafe(){
@@ -403,8 +400,8 @@ public final class Repeated${minor.class}Vector extends BaseValueVector implemen
     private Mutator(){
     }
 
-    public boolean setRepetitionAtIndexSafe(int index, int repetitionCount) {
-      return offsets.getMutator().setSafe(index+1, offsets.getAccessor().get(index) + repetitionCount);
+    public void setRepetitionAtIndexSafe(int index, int repetitionCount) {
+      offsets.getMutator().setSafe(index+1, offsets.getAccessor().get(index) + repetitionCount);
     }
 
     public BaseDataValueVector getDataVector() {
@@ -418,11 +415,8 @@ public final class Repeated${minor.class}Vector extends BaseValueVector implemen
       offsets.getMutator().setValueCount(parentValueCount == 0 ? 0 : parentValueCount + 1);
     }
 
-    public boolean startNewGroup(int index) {
-      if(getValueCapacity() <= index){
-        return false;
-      }
-      return offsets.getMutator().setSafe(index+1, offsets.getAccessor().get(index));
+    public void startNewGroup(int index) {
+      offsets.getMutator().setSafe(index+1, offsets.getAccessor().get(index));
     }
 
     /**
@@ -439,66 +433,53 @@ public final class Repeated${minor.class}Vector extends BaseValueVector implemen
     }
 
     <#if type.major == "VarLen">
-    public boolean addSafe(int index, byte[] bytes) {
-      return addSafe(index, bytes, 0, bytes.length);
+    public void addSafe(int index, byte[] bytes) {
+      addSafe(index, bytes, 0, bytes.length);
     }
 
-    public boolean addSafe(int index, byte[] bytes, int start, int length) {
-      if(offsets.getValueCapacity() <= index+1) {
-        return false;
-      }
+    public void addSafe(int index, byte[] bytes, int start, int length) {
       int nextOffset = offsets.getAccessor().get(index+1);
-      boolean b1 = values.getMutator().setSafe(nextOffset, bytes, start, length);
-      boolean b2 = offsets.getMutator().setSafe(index+1, nextOffset+1);
-      return (b1 && b2);
+      values.getMutator().setSafe(nextOffset, bytes, start, length);
+      offsets.getMutator().setSafe(index+1, nextOffset+1);
     }
 
     <#else>
 
-    public boolean addSafe(int index, ${minor.javaType!type.javaType} srcValue) {
-      if(offsets.getValueCapacity() <= index+1) return false;
+    public void addSafe(int index, ${minor.javaType!type.javaType} srcValue) {
       int nextOffset = offsets.getAccessor().get(index+1);
-      boolean b1 = values.getMutator().setSafe(nextOffset, srcValue);
-      boolean b2 = offsets.getMutator().setSafe(index+1, nextOffset+1);
-      return (b1 && b2);
+      values.getMutator().setSafe(nextOffset, srcValue);
+      offsets.getMutator().setSafe(index+1, nextOffset+1);
     }
         
     </#if>
 
     
-    public boolean setSafe(int index, Repeated${minor.class}Holder h){
+    public void setSafe(int index, Repeated${minor.class}Holder h){
       ${minor.class}Holder ih = new ${minor.class}Holder();
       getMutator().startNewGroup(index);
       for(int i = h.start; i < h.end; i++){
         h.vector.getAccessor().get(i, ih);
-        if(!getMutator().addSafe(index, ih) ) return false;
+        getMutator().addSafe(index, ih);
       }
-      return true;
     }
     
-    public boolean addSafe(int index, ${minor.class}Holder holder){
-      if(offsets.getValueCapacity() <= index+1) return false;
+    public void addSafe(int index, ${minor.class}Holder holder){
       int nextOffset = offsets.getAccessor().get(index+1);
-      boolean b1 = values.getMutator().setSafe(nextOffset, holder);
-      boolean b2 = offsets.getMutator().setSafe(index+1, nextOffset+1);
-      return (b1 && b2);
+      values.getMutator().setSafe(nextOffset, holder);
+      offsets.getMutator().setSafe(index+1, nextOffset+1);
     }
     
-    public boolean addSafe(int index, Nullable${minor.class}Holder holder){
-      if(offsets.getValueCapacity() <= index+1) return false;
+    public void addSafe(int index, Nullable${minor.class}Holder holder){
       int nextOffset = offsets.getAccessor().get(index+1);
-      boolean b1 = values.getMutator().setSafe(nextOffset, holder);
-      boolean b2 = offsets.getMutator().setSafe(index+1, nextOffset+1);
-      return (b1 && b2);
+      values.getMutator().setSafe(nextOffset, holder);
+      offsets.getMutator().setSafe(index+1, nextOffset+1);
     }
     
     <#if (fields?size > 1) && !(minor.class == "Decimal9" || minor.class == "Decimal18" || minor.class == "Decimal28Sparse" || minor.class == "Decimal38Sparse" || minor.class == "Decimal28Dense" || minor.class == "Decimal38Dense")>
-    public boolean addSafe(int arrayIndex, <#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>){
-      if(offsets.getValueCapacity() <= arrayIndex+1) return false;
+    public void addSafe(int arrayIndex, <#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>){
       int nextOffset = offsets.getAccessor().get(arrayIndex+1);
-      boolean b1 = values.getMutator().setSafe(nextOffset, <#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
-      boolean b2 = offsets.getMutator().setSafe(arrayIndex+1, nextOffset+1);
-      return (b1 && b2);
+      values.getMutator().setSafe(nextOffset, <#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
+      offsets.getMutator().setSafe(arrayIndex+1, nextOffset+1);
     }
     </#if>
     

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/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 c83c301..ba5372f 100644
--- a/exec/java-exec/src/main/codegen/templates/TypeHelper.java
+++ b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
@@ -378,7 +378,7 @@ public class TypeHelper {
     }
   }
 
-  public static boolean setValueSafe(ValueVector vector, int index, ValueHolder holder) {
+  public static void setValueSafe(ValueVector vector, int index, ValueHolder holder) {
     MajorType type = vector.getField().getType();
 
     switch(type.getMinorType()) {
@@ -387,23 +387,20 @@ public class TypeHelper {
       case ${minor.class?upper_case} :
       switch (type.getMode()) {
         case REQUIRED:
-          return ((${minor.class}Vector) vector).getMutator().setSafe(index, (${minor.class}Holder) holder);
+          ((${minor.class}Vector) vector).getMutator().setSafe(index, (${minor.class}Holder) holder);
+          return;
         case OPTIONAL:
           if (((Nullable${minor.class}Holder) holder).isSet == 1) {
-            if (! ((Nullable${minor.class}Vector) vector).getMutator().setSafe(index, (Nullable${minor.class}Holder) holder) ) {
-              return false;
-            }
+            ((Nullable${minor.class}Vector) vector).getMutator().setSafe(index, (Nullable${minor.class}Holder) holder);
           } else {
-            if (!((Nullable${minor.class}Vector) vector).getMutator().isSafe(index)) {
-              return false;
-            }
+            ((Nullable${minor.class}Vector) vector).getMutator().isSafe(index);
           }
-          return true;
+          return;
       }
       </#list>
       </#list>
       case GENERIC_OBJECT:
-        return ((ObjectVector) vector).getMutator().setSafe(index, (ObjectHolder) holder);
+        ((ObjectVector) vector).getMutator().setSafe(index, (ObjectHolder) holder);
       default:
         throw new UnsupportedOperationException(type.getMinorType() + " type is not supported.");
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java b/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
index b8ffe5d..9c6454e 100644
--- a/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
@@ -200,17 +200,13 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
     int outputStart = offsetVector.data.get${(minor.javaType!type.javaType)?cap_first}(thisIndex * ${type.width});
     
     if(data.capacity() < outputStart + len) {
-        decrementAllocationMonitor();
-        return false;
+        reAlloc();
     }
 
-    if (!offsetVector.getMutator().setSafe(thisIndex + 1, outputStart + len)) {
-       decrementAllocationMonitor();
-       return false;
-    }
+    offsetVector.getMutator().setSafe(thisIndex + 1, outputStart + len);
 
     from.data.getBytes(start, data, outputStart, len);
-    offsetVector.data.set${(minor.javaType!type.javaType)?cap_first}( (thisIndex+1) * ${type.width}, outputStart + len);
+    offsetVector.getMutator().setSafe( (thisIndex+1) * ${type.width}, outputStart + len);
 
     return true;
   }
@@ -240,8 +236,8 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
     }
     
     @Override
-    public boolean copyValueSafe(int fromIndex, int toIndex) {
-      return to.copyFromSafe(fromIndex, toIndex, ${minor.class}Vector.this);
+    public void copyValueSafe(int fromIndex, int toIndex) {
+      to.copyFromSafe(fromIndex, toIndex, ${minor.class}Vector.this);
     }
   }
 
@@ -285,6 +281,14 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
     offsetVector.zeroVector();
   }
 
+    public void reAlloc() {
+      allocationTotalByteCount *= 2;
+      DrillBuf newBuf = allocator.buffer(allocationTotalByteCount);
+      newBuf.setBytes(0, data, 0, data.capacity());
+      data.release();
+      data = newBuf;
+    }
+
     private void decrementAllocationMonitor() {
       if (allocationMonitor > 0) {
         allocationMonitor = 0;
@@ -403,20 +407,16 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
       data.setBytes(currentOffset, bytes, 0, bytes.length);
     }
 
-    public boolean setSafe(int index, byte[] bytes) {
+    public void setSafe(int index, byte[] bytes) {
       assert index >= 0;
 
       int currentOffset = offsetVector.getAccessor().get(index);
       if (data.capacity() < currentOffset + bytes.length) {
-        decrementAllocationMonitor();
-        return false;
-      }
-      if (!offsetVector.getMutator().setSafe(index + 1, currentOffset + bytes.length)) {
-        return false;
+        reAlloc();
       }
+      offsetVector.getMutator().setSafe(index + 1, currentOffset + bytes.length);
       offsetVector.getMutator().set(index + 1, currentOffset + bytes.length);
       data.setBytes(currentOffset, bytes, 0, bytes.length);
-      return true;
     }
 
     /**
@@ -434,52 +434,42 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
       data.setBytes(currentOffset, bytes, start, length);
     }
 
-    public boolean setSafe(int index, byte[] bytes, int start, int length) {
+    public void setSafe(int index, byte[] bytes, int start, int length) {
       assert index >= 0;
 
       int currentOffset = offsetVector.getAccessor().get(index);
 
       if (data.capacity() < currentOffset + length) {
-        decrementAllocationMonitor();
-        return false;
-      }
-      if (!offsetVector.getMutator().setSafe(index + 1, currentOffset + length)) {
-        return false;
+        reAlloc();
       }
+      offsetVector.getMutator().setSafe(index + 1, currentOffset + length);
       data.setBytes(currentOffset, bytes, start, length);
-      return true;
     }
 
-    public boolean setValueLengthSafe(int index, int length) {
+    public void setValueLengthSafe(int index, int length) {
       int offset = offsetVector.getAccessor().get(index);
       if(data.capacity() < offset + length ) {
-        decrementAllocationMonitor();
-        return false;
+        reAlloc();
       }
-      return offsetVector.getMutator().setSafe(index + 1, offsetVector.getAccessor().get(index) + length);
+      offsetVector.getMutator().setSafe(index + 1, offsetVector.getAccessor().get(index) + length);
     }
 
 
-    public boolean setSafe(int index, int start, int end, DrillBuf buffer){
+    public void setSafe(int index, int start, int end, DrillBuf buffer){
       int len = end - start;
       
       int outputStart = offsetVector.data.get${(minor.javaType!type.javaType)?cap_first}(index * ${type.width});
       
       if(data.capacity() < outputStart + len) {
-        decrementAllocationMonitor();
-        return false;
+        reAlloc();
       }
       
-      if (!offsetVector.getMutator().setSafe( index+1,  outputStart + len)) {
-        return false;
-      }
+      offsetVector.getMutator().setSafe( index+1,  outputStart + len);
       buffer.getBytes(start, data, outputStart, len);
-
-      return true;
     }
     
     
-    public boolean setSafe(int index, Nullable${minor.class}Holder holder){
+    public void setSafe(int index, Nullable${minor.class}Holder holder){
       assert holder.isSet == 1;
 
       int start = holder.start;
@@ -489,21 +479,14 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
       int outputStart = offsetVector.data.get${(minor.javaType!type.javaType)?cap_first}(index * ${type.width});
       
       if(data.capacity() < outputStart + len) {
-        decrementAllocationMonitor();
-        return false;
+        reAlloc();
       }
       
       holder.buffer.getBytes(start, data, outputStart, len);
-      if (!offsetVector.getMutator().setSafe( index+1,  outputStart + len)) {
-        return false;
-      }
-
-      // set(index, holder);
-
-      return true;
+      offsetVector.getMutator().setSafe( index+1,  outputStart + len);
     }
     
-    public boolean setSafe(int index, ${minor.class}Holder holder){
+    public void setSafe(int index, ${minor.class}Holder holder){
 
       int start = holder.start;
       int end =   holder.end;
@@ -512,18 +495,11 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
       int outputStart = offsetVector.data.get${(minor.javaType!type.javaType)?cap_first}(index * ${type.width});
       
       if(data.capacity() < outputStart + len) {
-        decrementAllocationMonitor();
-        return false;
+        reAlloc();
       }
       
       holder.buffer.getBytes(start, data, outputStart, len);
-      if (!offsetVector.getMutator().setSafe( index+1,  outputStart + len)) {
-        return false;
-      }
-
-      // set(index, holder);
-
-      return true;
+      offsetVector.getMutator().setSafe( index+1,  outputStart + len);
     }
     
     protected void set(int index, int start, int length, DrillBuf buffer){

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
index 5cf4a35..a5758fb 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
@@ -315,29 +315,11 @@ public class EvaluationVisitor {
       } else {
 
         final JInvocation setMeth = GetSetVectorHelper.write(e.getChild().getMajorType(), vv, inputContainer, outIndex, e.isSafe() ? "setSafe" : "set");
-        final String isSafeMethod = "isSafe";
-
-        if (e.isSafe()) {
-          HoldingContainer outputContainer = generator.declare(Types.REQUIRED_BIT);
-          block.assign(outputContainer.getValue(), JExpr.lit(1));
-          if (inputContainer.isOptional()) {
-            // block._if(vv.invoke("getMutator").invoke(setMethod).arg(outIndex).not())._then().assign(outputContainer.getValue(),
-            // JExpr.lit(0));
-            JConditional jc = block._if(inputContainer.getIsSet().eq(JExpr.lit(0)).not());
-            block = jc._then();
-            jc._else()._if(vv.invoke("getMutator").invoke(isSafeMethod).arg(outIndex).not())._then()
-                .assign(outputContainer.getValue(), JExpr.lit(0));
-          }
-          block._if(setMeth.not())._then().assign(outputContainer.getValue(), JExpr.lit(0));
-          return outputContainer;
-        } else {
           if (inputContainer.isOptional()) {
-            // block.add(vv.invoke("getMutator").invoke(setMethod).arg(outIndex));
             JConditional jc = block._if(inputContainer.getIsSet().eq(JExpr.lit(0)).not());
             block = jc._then();
           }
           block.add(setMeth);
-        }
 
       }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java
index 6e0b282..add3734 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java
@@ -22,6 +22,7 @@ import java.util.Map;
 
 import org.apache.drill.common.exceptions.DrillRuntimeException;
 import org.apache.drill.common.types.TypeProtos.DataMode;
+import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.expr.ClassGenerator;
 import org.apache.drill.exec.expr.ClassGenerator.BlockType;
@@ -229,7 +230,6 @@ class DrillAggFuncHolder extends DrillFuncHolder{
 
     Preconditions.checkNotNull(body);
     sub.directStatement(body);
-    JVar successVar = sub.decl(JType.parse(g.getModel(), "boolean"), "success", JExpr.lit(false));
 
     // reassign workspace variables back.
     for(int i =0; i < workspaceJVars.length; i++){
@@ -241,17 +241,20 @@ class DrillAggFuncHolder extends DrillFuncHolder{
       }
       //Change workspaceVar through workspace vector.
       JInvocation setMeth;
-      if (Types.usesHolderForGet(workspaceVars[i].majorType)) {
-        setMeth = g.getWorkspaceVectors().get(workspaceVars[i]).invoke("getMutator").invoke("setSafe").arg(wsIndexVariable).arg(workspaceJVars[i]);
+      MajorType type = workspaceVars[i].majorType;
+      if (Types.usesHolderForGet(type)) {
+          setMeth = g.getWorkspaceVectors().get(workspaceVars[i]).invoke("getMutator").invoke("setSafe").arg(wsIndexVariable).arg(workspaceJVars[i]);
       }else{
-        setMeth = g.getWorkspaceVectors().get(workspaceVars[i]).invoke("getMutator").invoke("setSafe").arg(wsIndexVariable).arg(workspaceJVars[i].ref("value"));
+        if (!Types.isFixedWidthType(type) || Types.isRepeated(type)) {
+          setMeth = g.getWorkspaceVectors().get(workspaceVars[i]).invoke("getMutator").invoke("setSafe").arg(wsIndexVariable).arg(workspaceJVars[i].ref("value"));
+        } else {
+          setMeth = g.getWorkspaceVectors().get(workspaceVars[i]).invoke("getMutator").invoke("set").arg(wsIndexVariable).arg(workspaceJVars[i].ref("value"));
+        }
       }
 
-      sub.assign(successVar, setMeth);
+      sub.add(setMeth);
 
       JClass drillRunTimeException = g.getModel().ref(DrillRuntimeException.class);
-
-      sub._if(successVar.eq(JExpr.lit(false)))._then()._throw(JExpr._new(drillRunTimeException).arg(JExpr.lit("setsafe() failed; cannot set holder value into the vector")));
     }
 
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
index df56174..9999c36 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
@@ -87,11 +87,11 @@ public class DrillComplexWriterFuncHolder extends DrillSimpleFuncHolder{
     addProtectedBlock(g, sub, body, inputVariables, workspaceJVars, false);
 
 
-    JConditional jc = g.getEvalBlock()._if(complexWriter.invoke("ok").not());
+//    JConditional jc = g.getEvalBlock()._if(complexWriter.invoke("ok").not());
 
-    jc._then().add(complexWriter.invoke("reset"));
+//    jc._then().add(complexWriter.invoke("reset"));
     //jc._then().directStatement("System.out.println(\"debug : write ok fail!, inIndex = \" + inIndex);");
-    jc._then()._return(JExpr.FALSE);
+//    jc._then()._return(JExpr.FALSE);
 
     //jc._else().directStatement("System.out.println(\"debug : write successful, inIndex = \" + inIndex);");
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a22b4724/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
index 35faf22..0e2a017 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
@@ -17,8 +17,8 @@
  */
 package org.apache.drill.exec.physical.impl.aggregate;
 
-import com.sun.codemodel.JExpr;
-import com.sun.codemodel.JVar;
+import java.io.IOException;
+
 import org.apache.drill.common.exceptions.ExecutionSetupException;
 import org.apache.drill.common.expression.ErrorCollector;
 import org.apache.drill.common.expression.ErrorCollectorImpl;
@@ -51,7 +51,8 @@ import org.apache.drill.exec.record.selection.SelectionVector2;
 import org.apache.drill.exec.record.selection.SelectionVector4;
 import org.apache.drill.exec.vector.ValueVector;
 
-import java.io.IOException;
+import com.sun.codemodel.JExpr;
+import com.sun.codemodel.JVar;
 
 public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HashAggBatch.class);
@@ -76,8 +77,7 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
           "aggrValuesContainer" /* workspace container */, UPDATE_AGGR_INSIDE, UPDATE_AGGR_OUTSIDE, UPDATE_AGGR_INSIDE);
 
 
-  public HashAggBatch(HashAggregate popConfig, RecordBatch incoming, FragmentContext context) throws
-      ExecutionSetupException {
+  public HashAggBatch(HashAggregate popConfig, RecordBatch incoming, FragmentContext context) throws ExecutionSetupException {
     super(popConfig, context);
     this.incoming = incoming;
   }
@@ -266,8 +266,12 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
         new HashTableConfig(context.getOptions().getOption(ExecConstants.MIN_HASH_TABLE_SIZE_KEY).num_val.intValue(),
             HashTable.DEFAULT_LOAD_FACTOR, popConfig.getGroupByExprs(), null /* no probe exprs */);
 
-    agg.setup(popConfig, htConfig, context, this.stats, oContext.getAllocator(), incoming, this, aggrExprs,
-        cgInner.getWorkspaceTypes(), groupByOutFieldIds, this.container);
+    agg.setup(popConfig, htConfig, context, this.stats,
+        oContext.getAllocator(), incoming, this,
+        aggrExprs,
+        cgInner.getWorkspaceTypes(),
+        groupByOutFieldIds,
+        this.container);
 
     return agg;
   }
@@ -277,10 +281,7 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
 
     for (LogicalExpression aggr : aggrExprs) {
       HoldingContainer hc = cg.addExpr(aggr);
-      cg.getBlock(BlockType.EVAL)._if(hc.getValue().eq(JExpr.lit(0)))._then()._return(JExpr.FALSE);
     }
-
-    cg.getBlock(BlockType.EVAL)._return(JExpr.TRUE);
   }
 
   private void setupGetIndex(ClassGenerator<HashAggregator> cg) {
@@ -302,9 +303,8 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
       return;
     }
 
-    default:
-      throw new IllegalStateException();
     }
+
   }
 
   @Override
@@ -320,4 +320,5 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
   protected void killIncoming(boolean sendUpstream) {
     incoming.kill(sendUpstream);
   }
+
 }


Mime
View raw message