drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [14/45] drill git commit: DRILL-3987: (MOVE) Extract key vector, field reader, complex/field writer classes.
Date Fri, 13 Nov 2015 02:37:44 GMT
DRILL-3987: (MOVE) Extract key vector, field reader, complex/field writer classes.


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

Branch: refs/heads/master
Commit: 9969d8bd12b090409f1a9badb904e81aeabc2aa7
Parents: 9b88d59
Author: Jacques Nadeau <jacques@apache.org>
Authored: Sat Nov 7 15:54:35 2015 -0800
Committer: Jacques Nadeau <jacques@apache.org>
Committed: Thu Nov 12 17:00:45 2015 -0800

----------------------------------------------------------------------
 exec/java-exec/pom.xml                          |   5 +
 .../src/main/codegen/data/ValueVectorTypes.tdd  | 168 ----
 .../codegen/templates/AbstractFieldReader.java  | 124 ---
 .../codegen/templates/AbstractFieldWriter.java  | 147 ----
 .../AbstractPromotableFieldWriter.java          | 142 ----
 .../src/main/codegen/templates/BaseReader.java  |  73 --
 .../src/main/codegen/templates/BaseWriter.java  | 100 ---
 .../main/codegen/templates/ComplexCopier.java   | 131 ---
 .../main/codegen/templates/ComplexReaders.java  | 183 -----
 .../main/codegen/templates/ComplexWriters.java  | 159 ----
 .../codegen/templates/FixedValueVectors.java    | 815 -------------------
 .../codegen/templates/HolderReaderImpl.java     | 292 -------
 .../src/main/codegen/templates/ListWriters.java | 234 ------
 .../src/main/codegen/templates/MapWriters.java  | 241 ------
 .../src/main/codegen/templates/NullReader.java  | 140 ----
 .../codegen/templates/NullableValueVectors.java | 636 ---------------
 .../codegen/templates/RepeatedValueVectors.java | 427 ----------
 .../src/main/codegen/templates/TypeHelper.java  | 600 --------------
 .../main/codegen/templates/UnionListWriter.java | 185 -----
 .../src/main/codegen/templates/UnionReader.java | 196 -----
 .../src/main/codegen/templates/UnionVector.java | 479 -----------
 .../src/main/codegen/templates/UnionWriter.java | 228 ------
 .../main/codegen/templates/ValueHolders.java    | 116 ---
 .../templates/VariableLengthVectors.java        | 645 ---------------
 .../src/main/java/io/netty/buffer/DrillBuf.java | 763 -----------------
 .../java/io/netty/buffer/FakeAllocator.java     | 164 ----
 .../main/java/io/netty/buffer/LargeBuffer.java  | 350 --------
 .../netty/buffer/PooledByteBufAllocatorL.java   | 258 ------
 .../netty/buffer/UnsafeDirectLittleEndian.java  | 247 ------
 .../exception/OversizedAllocationException.java |  51 --
 .../exception/SchemaChangeRuntimeException.java |  42 -
 .../drill/exec/expr/holders/ComplexHolder.java  |  25 -
 .../drill/exec/expr/holders/ObjectHolder.java   |  37 -
 .../exec/expr/holders/RepeatedListHolder.java   |  23 -
 .../exec/expr/holders/RepeatedMapHolder.java    |  23 -
 .../drill/exec/expr/holders/UnionHolder.java    |  37 -
 .../drill/exec/expr/holders/ValueHolder.java    |  31 -
 .../drill/exec/memory/BufferAllocator.java      | 136 ----
 .../memory/OutOfMemoryRuntimeException.java     |  49 --
 .../drill/exec/record/MaterializedField.java    | 324 --------
 .../apache/drill/exec/record/TransferPair.java  |  27 -
 .../apache/drill/exec/record/TypedFieldId.java  | 272 -------
 .../org/apache/drill/exec/util/CallBack.java    |  23 -
 .../drill/exec/util/JsonStringArrayList.java    |  63 --
 .../drill/exec/util/JsonStringHashMap.java      |  82 --
 .../org/apache/drill/exec/util/Pointer.java     |  28 -
 .../apache/drill/exec/util/TextSerializer.java  |  39 -
 .../drill/exec/vector/AddOrGetResult.java       |  38 -
 .../drill/exec/vector/AllocationHelper.java     |  61 --
 .../drill/exec/vector/BaseDataValueVector.java  |  90 --
 .../drill/exec/vector/BaseValueVector.java      | 123 ---
 .../org/apache/drill/exec/vector/BitVector.java | 448 ----------
 .../drill/exec/vector/FixedWidthVector.java     |  35 -
 .../drill/exec/vector/NullableVector.java       |  23 -
 .../vector/NullableVectorDefinitionSetter.java  |  23 -
 .../apache/drill/exec/vector/ObjectVector.java  | 222 -----
 .../drill/exec/vector/SchemaChangeCallBack.java |  52 --
 .../drill/exec/vector/ValueHolderHelper.java    | 201 -----
 .../apache/drill/exec/vector/ValueVector.java   | 221 -----
 .../drill/exec/vector/VariableWidthVector.java  |  51 --
 .../drill/exec/vector/VectorDescriptor.java     |  83 --
 .../apache/drill/exec/vector/VectorTrimmer.java |  33 -
 .../apache/drill/exec/vector/ZeroVector.java    | 175 ----
 .../vector/complex/AbstractContainerVector.java | 148 ----
 .../exec/vector/complex/AbstractMapVector.java  | 276 -------
 .../vector/complex/BaseRepeatedValueVector.java | 258 ------
 .../vector/complex/ContainerVectorLike.java     |  43 -
 .../vector/complex/EmptyValuePopulator.java     |  53 --
 .../drill/exec/vector/complex/FieldIdUtil.java  | 124 ---
 .../drill/exec/vector/complex/ListVector.java   | 327 --------
 .../drill/exec/vector/complex/MapVector.java    | 380 ---------
 .../drill/exec/vector/complex/Positionable.java |  22 -
 .../complex/RepeatedFixedWidthVectorLike.java   |  40 -
 .../exec/vector/complex/RepeatedListVector.java | 429 ----------
 .../exec/vector/complex/RepeatedMapVector.java  | 611 --------------
 .../vector/complex/RepeatedValueVector.java     |  86 --
 .../RepeatedVariableWidthVectorLike.java        |  35 -
 .../drill/exec/vector/complex/StateTool.java    |  34 -
 .../exec/vector/complex/VectorWithOrdinal.java  |  30 -
 .../vector/complex/impl/AbstractBaseReader.java |  98 ---
 .../vector/complex/impl/AbstractBaseWriter.java |  59 --
 .../vector/complex/impl/ComplexWriterImpl.java  | 218 -----
 .../vector/complex/impl/PromotableWriter.java   | 194 -----
 .../complex/impl/RepeatedListReaderImpl.java    | 145 ----
 .../complex/impl/RepeatedMapReaderImpl.java     | 192 -----
 .../impl/SingleLikeRepeatedMapReaderImpl.java   |  89 --
 .../complex/impl/SingleListReaderImpl.java      |  88 --
 .../complex/impl/SingleMapReaderImpl.java       | 108 ---
 .../vector/complex/impl/UnionListReader.java    | 100 ---
 .../exec/vector/complex/reader/FieldReader.java |  29 -
 .../exec/vector/complex/writer/FieldWriter.java |  27 -
 exec/pom.xml                                    |   1 +
 exec/vector/pom.xml                             | 146 ++++
 exec/vector/src/main/codegen/config.fmpp        |  24 +
 .../src/main/codegen/data/ValueVectorTypes.tdd  | 168 ++++
 .../src/main/codegen/includes/license.ftl       |  18 +
 .../src/main/codegen/includes/vv_imports.ftl    |  74 ++
 .../codegen/templates/AbstractFieldReader.java  | 124 +++
 .../codegen/templates/AbstractFieldWriter.java  | 147 ++++
 .../AbstractPromotableFieldWriter.java          | 142 ++++
 .../src/main/codegen/templates/BaseReader.java  |  73 ++
 .../src/main/codegen/templates/BaseWriter.java  | 100 +++
 .../main/codegen/templates/ComplexCopier.java   | 131 +++
 .../main/codegen/templates/ComplexReaders.java  | 183 +++++
 .../main/codegen/templates/ComplexWriters.java  | 159 ++++
 .../codegen/templates/FixedValueVectors.java    | 815 +++++++++++++++++++
 .../codegen/templates/HolderReaderImpl.java     | 292 +++++++
 .../src/main/codegen/templates/ListWriters.java | 234 ++++++
 .../src/main/codegen/templates/MapWriters.java  | 241 ++++++
 .../src/main/codegen/templates/NullReader.java  | 140 ++++
 .../codegen/templates/NullableValueVectors.java | 636 +++++++++++++++
 .../codegen/templates/RepeatedValueVectors.java | 427 ++++++++++
 .../src/main/codegen/templates/TypeHelper.java  | 600 ++++++++++++++
 .../main/codegen/templates/UnionListWriter.java | 185 +++++
 .../src/main/codegen/templates/UnionReader.java | 196 +++++
 .../src/main/codegen/templates/UnionVector.java | 479 +++++++++++
 .../src/main/codegen/templates/UnionWriter.java | 228 ++++++
 .../main/codegen/templates/ValueHolders.java    | 116 +++
 .../templates/VariableLengthVectors.java        | 645 +++++++++++++++
 .../src/main/java/io/netty/buffer/DrillBuf.java | 763 +++++++++++++++++
 .../java/io/netty/buffer/FakeAllocator.java     | 164 ++++
 .../main/java/io/netty/buffer/LargeBuffer.java  | 350 ++++++++
 .../netty/buffer/PooledByteBufAllocatorL.java   | 258 ++++++
 .../netty/buffer/UnsafeDirectLittleEndian.java  | 247 ++++++
 .../exception/OversizedAllocationException.java |  51 ++
 .../exception/SchemaChangeRuntimeException.java |  42 +
 .../drill/exec/expr/holders/ComplexHolder.java  |  25 +
 .../drill/exec/expr/holders/ObjectHolder.java   |  37 +
 .../exec/expr/holders/RepeatedListHolder.java   |  23 +
 .../exec/expr/holders/RepeatedMapHolder.java    |  23 +
 .../drill/exec/expr/holders/UnionHolder.java    |  37 +
 .../drill/exec/expr/holders/ValueHolder.java    |  31 +
 .../drill/exec/memory/BufferAllocator.java      | 136 ++++
 .../memory/OutOfMemoryRuntimeException.java     |  49 ++
 .../drill/exec/record/MaterializedField.java    | 324 ++++++++
 .../apache/drill/exec/record/TransferPair.java  |  27 +
 .../apache/drill/exec/record/TypedFieldId.java  | 272 +++++++
 .../org/apache/drill/exec/util/CallBack.java    |  23 +
 .../drill/exec/util/JsonStringArrayList.java    |  63 ++
 .../drill/exec/util/JsonStringHashMap.java      |  82 ++
 .../org/apache/drill/exec/util/Pointer.java     |  28 +
 .../apache/drill/exec/util/TextSerializer.java  |  39 +
 .../drill/exec/vector/AddOrGetResult.java       |  38 +
 .../drill/exec/vector/AllocationHelper.java     |  61 ++
 .../drill/exec/vector/BaseDataValueVector.java  |  90 ++
 .../drill/exec/vector/BaseValueVector.java      | 123 +++
 .../org/apache/drill/exec/vector/BitVector.java | 448 ++++++++++
 .../drill/exec/vector/FixedWidthVector.java     |  35 +
 .../drill/exec/vector/NullableVector.java       |  23 +
 .../vector/NullableVectorDefinitionSetter.java  |  23 +
 .../apache/drill/exec/vector/ObjectVector.java  | 222 +++++
 .../drill/exec/vector/SchemaChangeCallBack.java |  52 ++
 .../drill/exec/vector/ValueHolderHelper.java    | 201 +++++
 .../apache/drill/exec/vector/ValueVector.java   | 221 +++++
 .../drill/exec/vector/VariableWidthVector.java  |  51 ++
 .../drill/exec/vector/VectorDescriptor.java     |  83 ++
 .../apache/drill/exec/vector/VectorTrimmer.java |  33 +
 .../apache/drill/exec/vector/ZeroVector.java    | 175 ++++
 .../vector/complex/AbstractContainerVector.java | 148 ++++
 .../exec/vector/complex/AbstractMapVector.java  | 276 +++++++
 .../vector/complex/BaseRepeatedValueVector.java | 258 ++++++
 .../vector/complex/ContainerVectorLike.java     |  43 +
 .../vector/complex/EmptyValuePopulator.java     |  53 ++
 .../drill/exec/vector/complex/FieldIdUtil.java  | 124 +++
 .../drill/exec/vector/complex/ListVector.java   | 327 ++++++++
 .../drill/exec/vector/complex/MapVector.java    | 380 +++++++++
 .../drill/exec/vector/complex/Positionable.java |  22 +
 .../complex/RepeatedFixedWidthVectorLike.java   |  40 +
 .../exec/vector/complex/RepeatedListVector.java | 429 ++++++++++
 .../exec/vector/complex/RepeatedMapVector.java  | 611 ++++++++++++++
 .../vector/complex/RepeatedValueVector.java     |  86 ++
 .../RepeatedVariableWidthVectorLike.java        |  35 +
 .../drill/exec/vector/complex/StateTool.java    |  34 +
 .../exec/vector/complex/VectorWithOrdinal.java  |  30 +
 .../vector/complex/impl/AbstractBaseReader.java |  98 +++
 .../vector/complex/impl/AbstractBaseWriter.java |  59 ++
 .../vector/complex/impl/ComplexWriterImpl.java  | 218 +++++
 .../vector/complex/impl/PromotableWriter.java   | 194 +++++
 .../complex/impl/RepeatedListReaderImpl.java    | 145 ++++
 .../complex/impl/RepeatedMapReaderImpl.java     | 192 +++++
 .../impl/SingleLikeRepeatedMapReaderImpl.java   |  89 ++
 .../complex/impl/SingleListReaderImpl.java      |  88 ++
 .../complex/impl/SingleMapReaderImpl.java       | 108 +++
 .../vector/complex/impl/UnionListReader.java    | 100 +++
 .../exec/vector/complex/reader/FieldReader.java |  29 +
 .../exec/vector/complex/writer/FieldWriter.java |  27 +
 186 files changed, 15945 insertions(+), 15677 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index 2011364..da072d0 100644
--- a/exec/java-exec/pom.xml
+++ b/exec/java-exec/pom.xml
@@ -288,6 +288,11 @@
       <artifactId>drill-common</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.drill.exec</groupId>
+      <artifactId>vector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
     <!-- <dependency> -->
     <!-- <groupId>org.apache.drill.exec</groupId> -->
     <!-- <version>${project.version}</version> -->

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd b/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd
deleted file mode 100644
index 26bf02d..0000000
--- a/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd
+++ /dev/null
@@ -1,168 +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.
-
-{
-  modes: [
-    {name: "Optional", prefix: "Nullable"},
-    {name: "Required", prefix: ""},
-    {name: "Repeated", prefix: "Repeated"}
-    ],
-  types: [
-    {
-      major: "Fixed",
-      width: 1,
-      javaType: "byte",
-      boxedType: "Byte",
-      fields: [{name: "value", type: "byte"}],
-      minor: [
-        { class: "TinyInt", valueHolder: "IntHolder" },
-        { class: "UInt1", valueHolder: "UInt1Holder" }
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 2,
-      javaType: "char",
-      boxedType: "Character",
-      fields: [{name: "value", type: "char"}],
-      minor: [
-        { class: "UInt2", valueHolder: "UInt2Holder"}
-      ]
-    },    {
-      major: "Fixed",
-      width: 2,
-      javaType: "short",
-      boxedType: "Short",
-      fields: [{name: "value", type: "short"}],
-      minor: [
-        { class: "SmallInt", valueHolder: "Int2Holder"},
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 4,
-      javaType: "int",
-      boxedType: "Integer",
-      fields: [{name: "value", type: "int"}],
-      minor: [
-        { class: "Int", valueHolder: "IntHolder"},
-        { class: "UInt4", valueHolder: "UInt4Holder" },
-        { class: "Float4", javaType: "float" , boxedType: "Float", fields: [{name: "value", type: "float"}]},
-        { class: "Time", javaType: "int", friendlyType: "DateTime" },
-        { class: "IntervalYear", javaType: "int", friendlyType: "Period" }
-        { class: "Decimal9", maxPrecisionDigits: 9, friendlyType: "BigDecimal", fields: [{name:"value", type:"int"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] },
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 8,
-      javaType: "long",
-      boxedType: "Long",
-      fields: [{name: "value", type: "long"}],
-      minor: [
-        { class: "BigInt"},
-        { class: "UInt8" },
-        { class: "Float8", javaType: "double" , boxedType: "Double", fields: [{name: "value", type: "double"}], },
-        { class: "Date", javaType: "long", friendlyType: "DateTime" },
-        { class: "TimeStamp", javaType: "long", friendlyType: "DateTime" }
-        { class: "Decimal18", maxPrecisionDigits: 18, friendlyType: "BigDecimal", fields: [{name:"value", type:"long"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] },
-        <#--
-        { class: "Money", maxPrecisionDigits: 2, scale: 1, },
-        -->
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 12,
-      javaType: "DrillBuf",
-      boxedType: "DrillBuf",
-      minor: [
-        { class: "IntervalDay", millisecondsOffset: 4, friendlyType: "Period", fields: [ {name: "days", type:"int"}, {name: "milliseconds", type:"int"}] }
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 16,
-      javaType: "DrillBuf"
-      boxedType: "DrillBuf",      
-      minor: [
-        { class: "Interval", daysOffset: 4, millisecondsOffset: 8, friendlyType: "Period", fields: [ {name: "months", type: "int"}, {name: "days", type:"int"}, {name: "milliseconds", type:"int"}] }
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 12,
-      javaType: "DrillBuf",
-      boxedType: "DrillBuf",
-      minor: [
-        <#--
-        { class: "TimeTZ" },
-        { class: "Interval" }
-        -->
-        { class: "Decimal28Dense", maxPrecisionDigits: 28, nDecimalDigits: 3, friendlyType: "BigDecimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "DrillBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] }
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 16,
-      javaType: "DrillBuf",
-      boxedType: "DrillBuf",
-      
-      minor: [
-        { class: "Decimal38Dense", maxPrecisionDigits: 38, nDecimalDigits: 4, friendlyType: "BigDecimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "DrillBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] }
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 24,
-      javaType: "DrillBuf",
-      boxedType: "DrillBuf",
-      minor: [
-        { class: "Decimal38Sparse", maxPrecisionDigits: 38, nDecimalDigits: 6, friendlyType: "BigDecimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "DrillBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] }
-      ]
-    },
-    {
-      major: "Fixed",
-      width: 20,
-      javaType: "DrillBuf",
-      boxedType: "DrillBuf",
-      minor: [
-        { class: "Decimal28Sparse", maxPrecisionDigits: 28, nDecimalDigits: 5, friendlyType: "BigDecimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "DrillBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] }
-      ]
-    },
-    {
-      major: "VarLen",
-      width: 4,
-      javaType: "int",
-      boxedType: "DrillBuf",
-      fields: [{name: "start", type: "int"}, {name: "end", type: "int"}, {name: "buffer", type: "DrillBuf"}],
-      minor: [
-        { class: "VarBinary" , friendlyType: "byte[]" },
-        { class: "VarChar" , friendlyType: "Text" },
-        { class: "Var16Char" , friendlyType: "String" }
-      ]
-    },
-    {
-      major: "Bit",
-      width: 1,
-      javaType: "int",
-      boxedType: "Integer",
-      minor: [
-        { class: "Bit" , friendlyType: "Boolean", fields: [{name: "value", type: "int"}] }
-      ]
-    }
-  ]
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/codegen/templates/AbstractFieldReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/AbstractFieldReader.java b/exec/java-exec/src/main/codegen/templates/AbstractFieldReader.java
deleted file mode 100644
index 2b7b305..0000000
--- a/exec/java-exec/src/main/codegen/templates/AbstractFieldReader.java
+++ /dev/null
@@ -1,124 +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.
- */
-
-<@pp.dropOutputFile />
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/impl/AbstractFieldReader.java" />
-
-
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.impl;
-
-<#include "/@includes/vv_imports.ftl" />
-
-@SuppressWarnings("unused")
-abstract class AbstractFieldReader extends AbstractBaseReader implements FieldReader{
-  
-  AbstractFieldReader(){
-    super();
-  }
-
-  /**
-   * Returns true if the current value of the reader is not null
-   * @return
-   */
-  public boolean isSet() {
-    return true;
-  }
-
-  <#list ["Object", "BigDecimal", "Integer", "Long", "Boolean", 
-          "Character", "DateTime", "Period", "Double", "Float",
-          "Text", "String", "Byte", "Short", "byte[]"] as friendlyType>
-  <#assign safeType=friendlyType />
-  <#if safeType=="byte[]"><#assign safeType="ByteArray" /></#if>
-  
-  public ${friendlyType} read${safeType}(int arrayIndex){
-    fail("read${safeType}(int arrayIndex)");
-    return null;
-  }
-  
-  public ${friendlyType} read${safeType}(){
-    fail("read${safeType}()");
-    return null;
-  }
-  
-  </#list>
-  
-  public void copyAsValue(MapWriter writer){
-    fail("CopyAsValue MapWriter");
-  }
-  public void copyAsField(String name, MapWriter writer){
-    fail("CopyAsField MapWriter");
-  }
-
-  public void copyAsField(String name, ListWriter writer){
-    fail("CopyAsFieldList");
-  }
-  
-  <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
-  <#assign boxedType = (minor.boxedType!type.boxedType) />
-
-  public void read(${name}Holder holder){
-    fail("${name}");
-  }
-
-  public void read(Nullable${name}Holder holder){
-    fail("${name}");
-  }
-  
-  public void read(int arrayIndex, ${name}Holder holder){
-    fail("Repeated${name}");
-  }
-  
-  public void read(int arrayIndex, Nullable${name}Holder holder){
-    fail("Repeated${name}");
-  }
-  
-  public void copyAsValue(${name}Writer writer){
-    fail("CopyAsValue${name}");
-  }
-  public void copyAsField(String name, ${name}Writer writer){
-    fail("CopyAsField${name}");
-  }
-  </#list></#list>
-  
-  public FieldReader reader(String name){
-    fail("reader(String name)");
-    return null;
-  }
-
-  public FieldReader reader(){
-    fail("reader()");
-    return null;
-    
-  }
-  
-  public int size(){
-    fail("size()");
-    return -1;
-  }
-  
-  private void fail(String name){
-    throw new IllegalArgumentException(String.format("You tried to read a [%s] type when you are using a field reader of type [%s].", name, this.getClass().getSimpleName()));
-  }
-  
-  
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/codegen/templates/AbstractFieldWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/AbstractFieldWriter.java b/exec/java-exec/src/main/codegen/templates/AbstractFieldWriter.java
deleted file mode 100644
index 7ab5dce..0000000
--- a/exec/java-exec/src/main/codegen/templates/AbstractFieldWriter.java
+++ /dev/null
@@ -1,147 +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.
- */
-
-<@pp.dropOutputFile />
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/impl/AbstractFieldWriter.java" />
-
-
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.impl;
-
-<#include "/@includes/vv_imports.ftl" />
-
-/*
- * This class is generated using freemarker and the ${.template_name} template.
- */
-@SuppressWarnings("unused")
-abstract class AbstractFieldWriter extends AbstractBaseWriter implements FieldWriter {
-  AbstractFieldWriter(FieldWriter parent) {
-    super(parent);
-  }
-
-  @Override
-  public void start() {
-    throw new IllegalStateException(String.format("You tried to start when you are using a ValueWriter of type %s.", this.getClass().getSimpleName()));
-  }
-
-  @Override
-  public void end() {
-    throw new IllegalStateException(String.format("You tried to end when you are using a ValueWriter of type %s.", this.getClass().getSimpleName()));
-  }
-
-  @Override
-  public void startList() {
-    throw new IllegalStateException(String.format("You tried to start when you are using a ValueWriter of type %s.", this.getClass().getSimpleName()));
-  }
-
-  @Override
-  public void endList() {
-    throw new IllegalStateException(String.format("You tried to end when you are using a ValueWriter of type %s.", this.getClass().getSimpleName()));
-  }
-
-  <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
-  <#assign fields = minor.fields!type.fields />
-  @Override
-  public void write(${name}Holder holder) {
-    fail("${name}");
-  }
-
-  public void write${minor.class}(<#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>) {
-    fail("${name}");
-  }
-
-  </#list></#list>
-
-  public void writeNull() {
-    fail("${name}");
-  }
-
-  /**
-   * This implementation returns {@code false}.
-   * <p>  
-   *   Must be overridden by map writers.
-   * </p>  
-   */
-  @Override
-  public boolean isEmptyMap() {
-    return false;
-  }
-
-  @Override
-  public MapWriter map() {
-    fail("Map");
-    return null;
-  }
-
-  @Override
-  public ListWriter list() {
-    fail("List");
-    return null;
-  }
-
-  @Override
-  public MapWriter map(String name) {
-    fail("Map");
-    return null;
-  }
-
-  @Override
-  public ListWriter list(String name) {
-    fail("List");
-    return null;
-  }
-
-  <#list vv.types as type><#list type.minor as minor>
-  <#assign lowerName = minor.class?uncap_first />
-  <#if lowerName == "int" ><#assign lowerName = "integer" /></#if>
-  <#assign upperName = minor.class?upper_case />
-  <#assign capName = minor.class?cap_first />
-  <#if minor.class?starts_with("Decimal") >
-  public ${capName}Writer ${lowerName}(String name, int scale, int precision) {
-    fail("${capName}");
-    return null;
-  }
-  </#if>
-
-  @Override
-  public ${capName}Writer ${lowerName}(String name) {
-    fail("${capName}");
-    return null;
-  }
-
-  @Override
-  public ${capName}Writer ${lowerName}() {
-    fail("${capName}");
-    return null;
-  }
-
-  </#list></#list>
-
-  public void copyReader(FieldReader reader) {
-    fail("Copy FieldReader");
-  }
-
-  public void copyReaderToField(String name, FieldReader reader) {
-    fail("Copy FieldReader to STring");
-  }
-
-  private void fail(String name) {
-    throw new IllegalArgumentException(String.format("You tried to write a %s type when you are using a ValueWriter of type %s.", name, this.getClass().getSimpleName()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/codegen/templates/AbstractPromotableFieldWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/AbstractPromotableFieldWriter.java b/exec/java-exec/src/main/codegen/templates/AbstractPromotableFieldWriter.java
deleted file mode 100644
index f2f8193..0000000
--- a/exec/java-exec/src/main/codegen/templates/AbstractPromotableFieldWriter.java
+++ /dev/null
@@ -1,142 +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.
- */
-
-import org.apache.drill.common.types.TypeProtos.MinorType;
-
-<@pp.dropOutputFile />
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/impl/AbstractPromotableFieldWriter.java" />
-
-
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.impl;
-
-<#include "/@includes/vv_imports.ftl" />
-
-/*
- * A FieldWriter which delegates calls to another FieldWriter. The delegate FieldWriter can be promoted to a new type
- * when necessary. Classes that extend this class are responsible for handling promotion.
- *
- * This class is generated using freemarker and the ${.template_name} template.
- *
- */
-@SuppressWarnings("unused")
-abstract class AbstractPromotableFieldWriter extends AbstractFieldWriter {
-  AbstractPromotableFieldWriter(FieldWriter parent) {
-    super(parent);
-  }
-
-  /**
-   * Retrieve the FieldWriter, promoting if it is not a FieldWriter of the specified type
-   * @param type
-   * @return
-   */
-  abstract protected FieldWriter getWriter(MinorType type);
-
-  /**
-   * Return the current FieldWriter
-   * @return
-   */
-  abstract protected FieldWriter getWriter();
-
-  @Override
-  public void start() {
-    getWriter(MinorType.MAP).start();
-  }
-
-  @Override
-  public void end() {
-    getWriter(MinorType.MAP).end();
-  }
-
-  @Override
-  public void startList() {
-    getWriter(MinorType.LIST).startList();
-  }
-
-  @Override
-  public void endList() {
-    getWriter(MinorType.LIST).endList();
-  }
-
-  <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
-  <#assign fields = minor.fields!type.fields />
-  <#if !minor.class?starts_with("Decimal") >
-  @Override
-  public void write(${name}Holder holder) {
-    getWriter(MinorType.${name?upper_case}).write(holder);
-  }
-
-  public void write${minor.class}(<#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>) {
-    getWriter(MinorType.${name?upper_case}).write${minor.class}(<#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
-  }
-
-  </#if>
-  </#list></#list>
-
-  public void writeNull() {
-  }
-
-  @Override
-  public MapWriter map() {
-    return getWriter(MinorType.LIST).map();
-  }
-
-  @Override
-  public ListWriter list() {
-    return getWriter(MinorType.LIST).list();
-  }
-
-  @Override
-  public MapWriter map(String name) {
-    return getWriter(MinorType.MAP).map(name);
-  }
-
-  @Override
-  public ListWriter list(String name) {
-    return getWriter(MinorType.MAP).list(name);
-  }
-
-  <#list vv.types as type><#list type.minor as minor>
-  <#assign lowerName = minor.class?uncap_first />
-  <#if lowerName == "int" ><#assign lowerName = "integer" /></#if>
-  <#assign upperName = minor.class?upper_case />
-  <#assign capName = minor.class?cap_first />
-  <#if !minor.class?starts_with("Decimal") >
-
-  @Override
-  public ${capName}Writer ${lowerName}(String name) {
-    return getWriter(MinorType.MAP).${lowerName}(name);
-  }
-
-  @Override
-  public ${capName}Writer ${lowerName}() {
-    return getWriter(MinorType.LIST).${lowerName}();
-  }
-
-  </#if>
-  </#list></#list>
-
-  public void copyReader(FieldReader reader) {
-    getWriter().copyReader(reader);
-  }
-
-  public void copyReaderToField(String name, FieldReader reader) {
-    getWriter().copyReaderToField(name, reader);
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/codegen/templates/BaseReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/BaseReader.java b/exec/java-exec/src/main/codegen/templates/BaseReader.java
deleted file mode 100644
index 78f32f4..0000000
--- a/exec/java-exec/src/main/codegen/templates/BaseReader.java
+++ /dev/null
@@ -1,73 +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.
- */
-
-<@pp.dropOutputFile />
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/reader/BaseReader.java" />
-
-
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.reader;
-
-<#include "/@includes/vv_imports.ftl" />
-
-
-
-@SuppressWarnings("unused")
-public interface BaseReader extends Positionable{
-  MajorType getType();
-  MaterializedField getField();
-  void reset();
-  void read(UnionHolder holder);
-  void read(int index, UnionHolder holder);
-  void copyAsValue(UnionWriter writer);
-  boolean isSet();
-
-  public interface MapReader extends BaseReader, Iterable<String>{
-    FieldReader reader(String name);
-  }
-  
-  public interface RepeatedMapReader extends MapReader{
-    boolean next();
-    int size();
-    void copyAsValue(MapWriter writer);
-  }
-  
-  public interface ListReader extends BaseReader{
-    FieldReader reader(); 
-  }
-  
-  public interface RepeatedListReader extends ListReader{
-    boolean next();
-    int size();
-    void copyAsValue(ListWriter writer);
-  }
-  
-  public interface ScalarReader extends  
-  <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> ${name}Reader, </#list></#list> 
-  <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> Repeated${name}Reader, </#list></#list>
-  BaseReader {}
-  
-  interface ComplexReader{
-    MapReader rootAsMap();
-    ListReader rootAsList();
-    boolean rootIsMap();
-    boolean ok();
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/codegen/templates/BaseWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/BaseWriter.java b/exec/java-exec/src/main/codegen/templates/BaseWriter.java
deleted file mode 100644
index 8a9ea56..0000000
--- a/exec/java-exec/src/main/codegen/templates/BaseWriter.java
+++ /dev/null
@@ -1,100 +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.
- */
-
-<@pp.dropOutputFile />
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/writer/BaseWriter.java" />
-
-
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.writer;
-
-<#include "/@includes/vv_imports.ftl" />
-
-/*
- * File generated from ${.template_name} using FreeMarker.
- */
-@SuppressWarnings("unused")
-  public interface BaseWriter extends AutoCloseable, Positionable {
-  FieldWriter getParent();
-  int getValueCapacity();
-
-  public interface MapWriter extends BaseWriter {
-
-    MaterializedField getField();
-
-    /**
-     * Whether this writer is a map writer and is empty (has no children).
-     * 
-     * <p>
-     *   Intended only for use in determining whether to add dummy vector to
-     *   avoid empty (zero-column) schema, as in JsonReader.
-     * </p>
-     * 
-     */
-    boolean isEmptyMap();
-
-    <#list vv.types as type><#list type.minor as minor>
-    <#assign lowerName = minor.class?uncap_first />
-    <#if lowerName == "int" ><#assign lowerName = "integer" /></#if>
-    <#assign upperName = minor.class?upper_case />
-    <#assign capName = minor.class?cap_first />
-    <#if minor.class?starts_with("Decimal") >
-    ${capName}Writer ${lowerName}(String name, int scale, int precision);
-    </#if>
-    ${capName}Writer ${lowerName}(String name);
-    </#list></#list>
-
-    void copyReaderToField(String name, FieldReader reader);
-    MapWriter map(String name);
-    ListWriter list(String name);
-    void start();
-    void end();
-  }
-
-  public interface ListWriter extends BaseWriter {
-    void startList();
-    void endList();
-    MapWriter map();
-    ListWriter list();
-    void copyReader(FieldReader reader);
-
-    <#list vv.types as type><#list type.minor as minor>
-    <#assign lowerName = minor.class?uncap_first />
-    <#if lowerName == "int" ><#assign lowerName = "integer" /></#if>
-    <#assign upperName = minor.class?upper_case />
-    <#assign capName = minor.class?cap_first />
-    ${capName}Writer ${lowerName}();
-    </#list></#list>
-  }
-
-  public interface ScalarWriter extends
-  <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> ${name}Writer, </#list></#list> BaseWriter {}
-
-  public interface ComplexWriter {
-    void allocate();
-    void clear();
-    void copyReader(FieldReader reader);
-    MapWriter rootAsMap();
-    ListWriter rootAsList();
-
-    void setPosition(int index);
-    void setValueCount(int count);
-    void reset();
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/codegen/templates/ComplexCopier.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/ComplexCopier.java b/exec/java-exec/src/main/codegen/templates/ComplexCopier.java
deleted file mode 100644
index b8b7616..0000000
--- a/exec/java-exec/src/main/codegen/templates/ComplexCopier.java
+++ /dev/null
@@ -1,131 +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.
- */
-
-<@pp.dropOutputFile />
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/impl/ComplexCopier.java" />
-
-
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.impl;
-
-<#include "/@includes/vv_imports.ftl" />
-
-/*
- * This class is generated using freemarker and the ${.template_name} template.
- */
-@SuppressWarnings("unused")
-public class ComplexCopier {
-
-  /**
-   * Do a deep copy of the value in input into output
-   * @param in
-   * @param out
-   */
-  public static void copy(FieldReader input, FieldWriter output) {
-    writeValue(input, output);
-  }
-
-  private static void writeValue(FieldReader reader, FieldWriter writer) {
-    final DataMode m = reader.getType().getMode();
-    final MinorType mt = reader.getType().getMinorType();
-
-    switch(m){
-    case OPTIONAL:
-    case REQUIRED:
-
-
-      switch (mt) {
-
-      case LIST:
-        writer.startList();
-        while (reader.next()) {
-          writeValue(reader.reader(), getListWriterForReader(reader.reader(), writer));
-        }
-        writer.endList();
-        break;
-      case MAP:
-        writer.start();
-        if (reader.isSet()) {
-          for(String name : reader){
-            FieldReader childReader = reader.reader(name);
-            if(childReader.isSet()){
-              writeValue(childReader, getMapWriterForReader(childReader, writer, name));
-            }
-          }
-        }
-        writer.end();
-        break;
-  <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
-  <#assign fields = minor.fields!type.fields />
-  <#assign uncappedName = name?uncap_first/>
-  <#if !minor.class?starts_with("Decimal")>
-
-      case ${name?upper_case}:
-        if (reader.isSet()) {
-          Nullable${name}Holder ${uncappedName}Holder = new Nullable${name}Holder();
-          reader.read(${uncappedName}Holder);
-          writer.write${name}(<#list fields as field>${uncappedName}Holder.${field.name}<#if field_has_next>, </#if></#list>);
-        }
-        break;
-
-  </#if>
-  </#list></#list>
-      }
-              break;
-    }
- }
-
-  private static FieldWriter getMapWriterForReader(FieldReader reader, MapWriter writer, String name) {
-    switch (reader.getType().getMinorType()) {
-    <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
-    <#assign fields = minor.fields!type.fields />
-    <#assign uncappedName = name?uncap_first/>
-    <#if !minor.class?starts_with("Decimal")>
-    case ${name?upper_case}:
-      return (FieldWriter) writer.<#if name == "Int">integer<#else>${uncappedName}</#if>(name);
-    </#if>
-    </#list></#list>
-    case MAP:
-      return (FieldWriter) writer.map(name);
-    case LIST:
-      return (FieldWriter) writer.list(name);
-    default:
-      throw new UnsupportedOperationException(reader.getType().toString());
-    }
-  }
-
-  private static FieldWriter getListWriterForReader(FieldReader reader, ListWriter writer) {
-    switch (reader.getType().getMinorType()) {
-    <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
-    <#assign fields = minor.fields!type.fields />
-    <#assign uncappedName = name?uncap_first/>
-    <#if !minor.class?starts_with("Decimal")>
-    case ${name?upper_case}:
-    return (FieldWriter) writer.<#if name == "Int">integer<#else>${uncappedName}</#if>();
-    </#if>
-    </#list></#list>
-    case MAP:
-      return (FieldWriter) writer.map();
-    case LIST:
-      return (FieldWriter) writer.list();
-    default:
-      throw new UnsupportedOperationException(reader.getType().toString());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/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
deleted file mode 100644
index 607b71d..0000000
--- a/exec/java-exec/src/main/codegen/templates/ComplexReaders.java
+++ /dev/null
@@ -1,183 +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.
- */
-
-import java.lang.Override;
-import java.util.List;
-
-import org.apache.drill.exec.record.TransferPair;
-import org.apache.drill.exec.vector.complex.IndexHolder;
-import org.apache.drill.exec.vector.complex.writer.IntervalWriter;
-import org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter;
-
-<@pp.dropOutputFile />
-<#list vv.types as type>
-<#list type.minor as minor>
-<#list ["", "Repeated"] as mode>
-<#assign lowerName = minor.class?uncap_first />
-<#if lowerName == "int" ><#assign lowerName = "integer" /></#if>
-<#assign name = mode + minor.class?cap_first />
-<#assign javaType = (minor.javaType!type.javaType) />
-<#assign friendlyType = (minor.friendlyType!minor.boxedType!type.boxedType) />
-<#assign safeType=friendlyType />
-<#if safeType=="byte[]"><#assign safeType="ByteArray" /></#if>
-
-<#assign hasFriendly = minor.friendlyType!"no" == "no" />
-
-<#list ["", "Nullable"] as nullMode>
-<#if (mode == "Repeated" && nullMode  == "") || mode == "" >
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/impl/${nullMode}${name}ReaderImpl.java" />
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.impl;
-
-<#include "/@includes/vv_imports.ftl" />
-
-@SuppressWarnings("unused")
-public class ${nullMode}${name}ReaderImpl extends AbstractFieldReader {
-  
-  private final ${nullMode}${name}Vector vector;
-  
-  public ${nullMode}${name}ReaderImpl(${nullMode}${name}Vector vector){
-    super();
-    this.vector = vector;
-  }
-
-  public MajorType getType(){
-    return vector.getField().getType();
-  }
-
-  public MaterializedField getField(){
-    return vector.getField();
-  }
-  
-  public boolean isSet(){
-    <#if nullMode == "Nullable">
-    return !vector.getAccessor().isNull(idx());
-    <#else>
-    return true;
-    </#if>
-  }
-
-
-  
-  
-  <#if mode == "Repeated">
-
-  public void copyAsValue(${minor.class?cap_first}Writer writer){
-    Repeated${minor.class?cap_first}WriterImpl impl = (Repeated${minor.class?cap_first}WriterImpl) writer;
-    impl.vector.copyFromSafe(idx(), impl.idx(), vector);
-  }
-  
-  public void copyAsField(String name, MapWriter writer){
-    Repeated${minor.class?cap_first}WriterImpl impl = (Repeated${minor.class?cap_first}WriterImpl)  writer.list(name).${lowerName}();
-    impl.vector.copyFromSafe(idx(), impl.idx(), vector);
-  }
-  
-  public int size(){
-    return vector.getAccessor().getInnerValueCountAt(idx());
-  }
-  
-  public void read(int arrayIndex, ${minor.class?cap_first}Holder h){
-    vector.getAccessor().get(idx(), arrayIndex, h);
-  }
-  public void read(int arrayIndex, Nullable${minor.class?cap_first}Holder h){
-    vector.getAccessor().get(idx(), arrayIndex, h);
-  }
-  
-  public ${friendlyType} read${safeType}(int arrayIndex){
-    return vector.getAccessor().getSingleObject(idx(), arrayIndex);
-  }
-
-  
-  public List<Object> readObject(){
-    return (List<Object>) (Object) vector.getAccessor().getObject(idx());
-  }
-  
-  <#else>
-  
-  public void copyAsValue(${minor.class?cap_first}Writer writer){
-    ${nullMode}${minor.class?cap_first}WriterImpl impl = (${nullMode}${minor.class?cap_first}WriterImpl) writer;
-    impl.vector.copyFromSafe(idx(), impl.idx(), vector);
-  }
-  
-  public void copyAsField(String name, MapWriter writer){
-    ${nullMode}${minor.class?cap_first}WriterImpl impl = (${nullMode}${minor.class?cap_first}WriterImpl) writer.${lowerName}(name);
-    impl.vector.copyFromSafe(idx(), impl.idx(), vector);
-  }
-
-  <#if nullMode != "Nullable">
-  public void read(${minor.class?cap_first}Holder h){
-    vector.getAccessor().get(idx(), h);
-  }
-  </#if>
-
-  public void read(Nullable${minor.class?cap_first}Holder h){
-    vector.getAccessor().get(idx(), h);
-  }
-  
-  public ${friendlyType} read${safeType}(){
-    return vector.getAccessor().getObject(idx());
-  }
-  
-  public void copyValue(FieldWriter w){
-    
-  }
-  
-  public Object readObject(){
-    return vector.getAccessor().getObject(idx());
-  }
-
-  
-  </#if>
-}
-</#if>
-</#list>
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/reader/${name}Reader.java" />
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.reader;
-
-<#include "/@includes/vv_imports.ftl" />
-@SuppressWarnings("unused")
-public interface ${name}Reader extends BaseReader{
-  
-  <#if mode == "Repeated">
-  public int size();
-  public void read(int arrayIndex, ${minor.class?cap_first}Holder h);
-  public void read(int arrayIndex, Nullable${minor.class?cap_first}Holder h);
-  public Object readObject(int arrayIndex);
-  public ${friendlyType} read${safeType}(int arrayIndex);
-  <#else>
-  public void read(${minor.class?cap_first}Holder h);
-  public void read(Nullable${minor.class?cap_first}Holder h);
-  public Object readObject();
-  public ${friendlyType} read${safeType}();
-  </#if>  
-  public boolean isSet();
-  public void copyAsValue(${minor.class}Writer writer);
-  public void copyAsField(String name, ${minor.class}Writer writer);
-  
-}
-
-
-
-</#list>
-</#list>
-</#list>
-
-

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/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
deleted file mode 100644
index 71a7f9a..0000000
--- a/exec/java-exec/src/main/codegen/templates/ComplexWriters.java
+++ /dev/null
@@ -1,159 +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.
- */
-
-import java.lang.Override;
-import java.util.Vector;
-
-import org.apache.drill.exec.vector.AllocationHelper;
-import org.apache.drill.exec.vector.ValueVector.Mutator;
-import org.apache.drill.exec.vector.complex.IndexHolder;
-import org.apache.drill.exec.vector.complex.reader.FieldReader;
-
-<@pp.dropOutputFile />
-<#list vv.types as type>
-<#list type.minor as minor>
-<#list ["", "Nullable", "Repeated"] as mode>
-<#assign name = mode + minor.class?cap_first />
-<#assign eName = name />
-<#assign javaType = (minor.javaType!type.javaType) />
-<#assign fields = minor.fields!type.fields />
-
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/impl/${eName}WriterImpl.java" />
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.impl;
-
-<#include "/@includes/vv_imports.ftl" />
-
-/*
- * This class is generated using FreeMarker on the ${.template_name} template.
- */
-@SuppressWarnings("unused")
-public class ${eName}WriterImpl extends AbstractFieldWriter {
-
-  private final ${name}Vector.Mutator mutator;
-  final ${name}Vector vector;
-
-  public ${eName}WriterImpl(${name}Vector vector, AbstractFieldWriter parent) {
-    super(parent);
-    this.mutator = vector.getMutator();
-    this.vector = vector;
-  }
-
-  @Override
-  public MaterializedField getField() {
-    return vector.getField();
-  }
-
-  @Override
-  public int getValueCapacity() {
-    return vector.getValueCapacity();
-  }
-
-  @Override
-  public void allocate() {
-    vector.allocateNew();
-  }
-
-  @Override
-  public void close() {
-    vector.close();
-  }
-
-  @Override
-  public void clear() {
-    vector.clear();
-  }
-
-  @Override
-  protected int idx() {
-    return super.idx();
-  }
-
-  <#if mode == "Repeated">
-
-  public void write(${minor.class?cap_first}Holder h) {
-    mutator.addSafe(idx(), h);
-    vector.getMutator().setValueCount(idx()+1);
-  }
-
-  public void write(Nullable${minor.class?cap_first}Holder h) {
-    mutator.addSafe(idx(), h);
-    vector.getMutator().setValueCount(idx()+1);
-  }
-
-  <#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>) {
-    mutator.addSafe(idx(), <#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
-    vector.getMutator().setValueCount(idx()+1);
-  }
-  </#if>
-
-  public void setPosition(int idx) {
-    super.setPosition(idx);
-    mutator.startNewValue(idx);
-  }
-
-
-  <#else>
-
-  public void write(${minor.class}Holder h) {
-    mutator.setSafe(idx(), h);
-    vector.getMutator().setValueCount(idx()+1);
-  }
-
-  public void write(Nullable${minor.class}Holder h) {
-    mutator.setSafe(idx(), h);
-    vector.getMutator().setValueCount(idx()+1);
-  }
-
-  <#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>) {
-    mutator.setSafe(idx(), <#if mode == "Nullable">1, </#if><#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
-    vector.getMutator().setValueCount(idx()+1);
-  }
-
-  <#if mode == "Nullable">
-
-  public void writeNull() {
-    mutator.setNull(idx());
-    vector.getMutator().setValueCount(idx()+1);
-  }
-  </#if>
-  </#if>
-  </#if>
-}
-
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/writer/${eName}Writer.java" />
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector.complex.writer;
-
-<#include "/@includes/vv_imports.ftl" />
-@SuppressWarnings("unused")
-public interface ${eName}Writer extends BaseWriter {
-  public void write(${minor.class}Holder h);
-
-  <#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>
-}
-
-</#list>
-</#list>
-</#list>

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/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
deleted file mode 100644
index d9d5fae..0000000
--- a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
+++ /dev/null
@@ -1,815 +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.
- */
-
-import java.lang.Override;
-
-<@pp.dropOutputFile />
-<#list vv.types as type>
-<#list type.minor as minor>
-<#assign friendlyType = (minor.friendlyType!minor.boxedType!type.boxedType) />
-
-<#if type.major == "Fixed">
-<@pp.changeOutputFile name="/org/apache/drill/exec/vector/${minor.class}Vector.java" />
-<#include "/@includes/license.ftl" />
-
-package org.apache.drill.exec.vector;
-
-<#include "/@includes/vv_imports.ftl" />
-
-/**
- * ${minor.class} implements a vector of fixed width values.  Elements in the vector are accessed
- * by position, starting from the logical start of the vector.  Values should be pushed onto the
- * vector sequentially, but may be randomly accessed.
- *   The width of each element is ${type.width} byte(s)
- *   The equivalent Java primitive is '${minor.javaType!type.javaType}'
- *
- * NB: this class is automatically generated from ${.template_name} and ValueVectorTypes.tdd using FreeMarker.
- */
-public final class ${minor.class}Vector extends BaseDataValueVector implements FixedWidthVector{
-  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(${minor.class}Vector.class);
-
-  private final FieldReader reader = new ${minor.class}ReaderImpl(${minor.class}Vector.this);
-  private final Accessor accessor = new Accessor();
-  private final Mutator mutator = new Mutator();
-
-  private int allocationSizeInBytes = INITIAL_VALUE_ALLOCATION * ${type.width};
-  private int allocationMonitor = 0;
-
-  public ${minor.class}Vector(MaterializedField field, BufferAllocator allocator) {
-    super(field, allocator);
-  }
-
-  @Override
-  public FieldReader getReader(){
-    return reader;
-  }
-
-  @Override
-  public int getBufferSizeFor(final int valueCount) {
-    if (valueCount == 0) {
-      return 0;
-    }
-    return valueCount * ${type.width};
-  }
-
-  @Override
-  public int getValueCapacity(){
-    return (int) (data.capacity() *1.0 / ${type.width});
-  }
-
-  @Override
-  public Accessor getAccessor(){
-    return accessor;
-  }
-
-  @Override
-  public Mutator getMutator(){
-    return mutator;
-  }
-
-  @Override
-  public void setInitialCapacity(final int valueCount) {
-    final long size = 1L * valueCount * ${type.width};
-    if (size > MAX_ALLOCATION_SIZE) {
-      throw new OversizedAllocationException("Requested amount of memory is more than max allowed allocation size");
-    }
-    allocationSizeInBytes = (int)size;
-  }
-
-  @Override
-  public void allocateNew() {
-    if(!allocateNewSafe()){
-      throw new OutOfMemoryRuntimeException("Failure while allocating buffer.");
-    }
-  }
-
-  @Override
-  public boolean allocateNewSafe() {
-    long curAllocationSize = allocationSizeInBytes;
-    if (allocationMonitor > 10) {
-      curAllocationSize = Math.max(8, curAllocationSize / 2);
-      allocationMonitor = 0;
-    } else if (allocationMonitor < -2) {
-      curAllocationSize = allocationSizeInBytes * 2L;
-      allocationMonitor = 0;
-    }
-
-    try{
-      allocateBytes(curAllocationSize);
-    } catch (DrillRuntimeException ex) {
-      return false;
-    }
-    return true;
-  }
-
-  /**
-   * Allocate a new buffer that supports setting at least the provided number of values. May actually be sized bigger
-   * depending on underlying buffer rounding size. Must be called prior to using the ValueVector.
-   *
-   * Note that the maximum number of values a vector can allocate is Integer.MAX_VALUE / value width.
-   *
-   * @param valueCount
-   * @throws org.apache.drill.exec.memory.OutOfMemoryRuntimeException if it can't allocate the new buffer
-   */
-  @Override
-  public void allocateNew(final int valueCount) {
-    allocateBytes(valueCount * ${type.width});
-  }
-
-  @Override
-  public void reset() {
-    allocationSizeInBytes = INITIAL_VALUE_ALLOCATION;
-    allocationMonitor = 0;
-    zeroVector();
-    super.reset();
-    }
-
-  private void allocateBytes(final long size) {
-    if (size > MAX_ALLOCATION_SIZE) {
-      throw new OversizedAllocationException("Requested amount of memory is more than max allowed allocation size");
-    }
-
-    final int curSize = (int)size;
-    clear();
-    data = allocator.buffer(curSize);
-    data.readerIndex(0);
-    allocationSizeInBytes = curSize;
-  }
-
-/**
- * Allocate new buffer with double capacity, and copy data into the new buffer. Replace vector's buffer with new buffer, and release old one
- *
- * @throws org.apache.drill.exec.memory.OutOfMemoryRuntimeException if it can't allocate the new buffer
- */
-  public void reAlloc() {
-    final long newAllocationSize = allocationSizeInBytes * 2L;
-    if (newAllocationSize > MAX_ALLOCATION_SIZE)  {
-      throw new OversizedAllocationException("Unable to expand the buffer. Max allowed buffer size is reached.");
-    }
-
-    logger.debug("Reallocating vector [{}]. # of bytes: [{}] -> [{}]", field, allocationSizeInBytes, newAllocationSize);
-    final DrillBuf newBuf = allocator.buffer((int)newAllocationSize);
-    newBuf.setBytes(0, data, 0, data.capacity());
-    final int halfNewCapacity = newBuf.capacity() / 2;
-    newBuf.setZero(halfNewCapacity, halfNewCapacity);
-    newBuf.writerIndex(data.writerIndex());
-    data.release(1);
-    data = newBuf;
-    allocationSizeInBytes = (int)newAllocationSize;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void zeroVector() {
-    data.setZero(0, data.capacity());
-  }
-
-  @Override
-  public void load(SerializedField metadata, DrillBuf buffer) {
-    Preconditions.checkArgument(this.field.matches(metadata), "The field %s doesn't match the provided metadata %s.", this.field, metadata);
-    final int actualLength = metadata.getBufferLength();
-    final int valueCount = metadata.getValueCount();
-    final int expectedLength = valueCount * ${type.width};
-    assert actualLength == expectedLength : String.format("Expected to load %d bytes but actually loaded %d bytes", expectedLength, actualLength);
-
-    clear();
-    if (data != null) {
-      data.release(1);
-    }
-    data = buffer.slice(0, actualLength);
-    data.retain(1);
-    data.writerIndex(actualLength);
-    }
-
-  public TransferPair getTransferPair(){
-    return new TransferImpl(getField());
-  }
-
-  @Override
-  public TransferPair getTransferPair(FieldReference ref){
-    return new TransferImpl(getField().withPath(ref));
-  }
-
-  @Override
-  public TransferPair makeTransferPair(ValueVector to) {
-    return new TransferImpl((${minor.class}Vector) to);
-  }
-
-  public void transferTo(${minor.class}Vector target){
-    target.clear();
-    target.data = data;
-    target.data.retain(1);
-    target.data.writerIndex(data.writerIndex());
-    clear();
-  }
-
-  public void splitAndTransferTo(int startIndex, int length, ${minor.class}Vector target) {
-    final int startPoint = startIndex * ${type.width};
-    final int sliceLength = length * ${type.width};
-    target.clear();
-    target.data = data.slice(startPoint, sliceLength);
-    target.data.retain(1);
-    target.data.writerIndex(sliceLength);
-  }
-
-  private class TransferImpl implements TransferPair{
-    private ${minor.class}Vector to;
-
-    public TransferImpl(MaterializedField field){
-      to = new ${minor.class}Vector(field, allocator);
-    }
-
-    public TransferImpl(${minor.class}Vector to) {
-      this.to = to;
-    }
-
-    @Override
-    public ${minor.class}Vector getTo(){
-      return to;
-    }
-
-    @Override
-    public void transfer(){
-      transferTo(to);
-    }
-
-    @Override
-    public void splitAndTransfer(int startIndex, int length) {
-      splitAndTransferTo(startIndex, length, to);
-    }
-
-    @Override
-    public void copyValueSafe(int fromIndex, int toIndex) {
-      to.copyFromSafe(fromIndex, toIndex, ${minor.class}Vector.this);
-    }
-  }
-
-  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 -->
-    data.set${(minor.javaType!type.javaType)?cap_first}(thisIndex * ${type.width},
-        from.data.get${(minor.javaType!type.javaType)?cap_first}(fromIndex * ${type.width})
-    );
-    </#if> <#-- type.width -->
-  }
-
-  public void copyFromSafe(int fromIndex, int thisIndex, ${minor.class}Vector from){
-    while(thisIndex >= getValueCapacity()) {
-        reAlloc();
-    }
-    copyFrom(fromIndex, thisIndex, from);
-  }
-
-  public void decrementAllocationMonitor() {
-    if (allocationMonitor > 0) {
-      allocationMonitor = 0;
-    }
-    --allocationMonitor;
-  }
-
-  private void incrementAllocationMonitor() {
-    ++allocationMonitor;
-  }
-
-  public final class Accessor extends BaseDataValueVector.BaseAccessor {
-    @Override
-    public int getValueCount() {
-      return data.writerIndex() / ${type.width};
-    }
-
-    @Override
-    public boolean isNull(int index){
-      return false;
-    }
-
-    <#if (type.width > 8)>
-
-    public ${minor.javaType!type.javaType} get(int index) {
-      return data.slice(index * ${type.width}, ${type.width});
-    }
-
-    <#if (minor.class == "Interval")>
-    public void get(int index, ${minor.class}Holder holder){
-
-      final int offsetIndex = index * ${type.width};
-      holder.months = data.getInt(offsetIndex);
-      holder.days = data.getInt(offsetIndex + ${minor.daysOffset});
-      holder.milliseconds = data.getInt(offsetIndex + ${minor.millisecondsOffset});
-    }
-
-    public void get(int index, Nullable${minor.class}Holder holder){
-      final int offsetIndex = index * ${type.width};
-      holder.isSet = 1;
-      holder.months = data.getInt(offsetIndex);
-      holder.days = data.getInt(offsetIndex + ${minor.daysOffset});
-      holder.milliseconds = data.getInt(offsetIndex + ${minor.millisecondsOffset});
-    }
-
-    @Override
-    public ${friendlyType} getObject(int index) {
-      final int offsetIndex = index * ${type.width};
-      final int months  = data.getInt(offsetIndex);
-      final int days    = data.getInt(offsetIndex + ${minor.daysOffset});
-      final int millis = data.getInt(offsetIndex + ${minor.millisecondsOffset});
-      final Period p = new Period();
-      return p.plusMonths(months).plusDays(days).plusMillis(millis);
-    }
-
-    public StringBuilder getAsStringBuilder(int index) {
-
-      final int offsetIndex = index * ${type.width};
-
-      int months  = data.getInt(offsetIndex);
-      final int days    = data.getInt(offsetIndex + ${minor.daysOffset});
-      int millis = data.getInt(offsetIndex + ${minor.millisecondsOffset});
-
-      final int years  = (months / org.apache.drill.exec.expr.fn.impl.DateUtility.yearsToMonths);
-      months = (months % org.apache.drill.exec.expr.fn.impl.DateUtility.yearsToMonths);
-
-      final int hours  = millis / (org.apache.drill.exec.expr.fn.impl.DateUtility.hoursToMillis);
-      millis     = millis % (org.apache.drill.exec.expr.fn.impl.DateUtility.hoursToMillis);
-
-      final int minutes = millis / (org.apache.drill.exec.expr.fn.impl.DateUtility.minutesToMillis);
-      millis      = millis % (org.apache.drill.exec.expr.fn.impl.DateUtility.minutesToMillis);
-
-      final long seconds = millis / (org.apache.drill.exec.expr.fn.impl.DateUtility.secondsToMillis);
-      millis      = millis % (org.apache.drill.exec.expr.fn.impl.DateUtility.secondsToMillis);
-
-      final String yearString = (Math.abs(years) == 1) ? " year " : " years ";
-      final String monthString = (Math.abs(months) == 1) ? " month " : " months ";
-      final String dayString = (Math.abs(days) == 1) ? " day " : " days ";
-
-
-      return(new StringBuilder().
-             append(years).append(yearString).
-             append(months).append(monthString).
-             append(days).append(dayString).
-             append(hours).append(":").
-             append(minutes).append(":").
-             append(seconds).append(".").
-             append(millis));
-    }
-
-    <#elseif (minor.class == "IntervalDay")>
-    public void get(int index, ${minor.class}Holder holder){
-
-      final int offsetIndex = index * ${type.width};
-      holder.days = data.getInt(offsetIndex);
-      holder.milliseconds = data.getInt(offsetIndex + ${minor.millisecondsOffset});
-    }
-
-    public void get(int index, Nullable${minor.class}Holder holder){
-      final int offsetIndex = index * ${type.width};
-      holder.isSet = 1;
-      holder.days = data.getInt(offsetIndex);
-      holder.milliseconds = data.getInt(offsetIndex + ${minor.millisecondsOffset});
-    }
-
-    @Override
-    public ${friendlyType} getObject(int index) {
-      final int offsetIndex = index * ${type.width};
-      final int millis = data.getInt(offsetIndex + ${minor.millisecondsOffset});
-      final int  days   = data.getInt(offsetIndex);
-      final Period p = new Period();
-      return p.plusDays(days).plusMillis(millis);
-    }
-
-
-    public StringBuilder getAsStringBuilder(int index) {
-      final int offsetIndex = index * ${type.width};
-
-      int millis = data.getInt(offsetIndex + ${minor.millisecondsOffset});
-      final int  days   = data.getInt(offsetIndex);
-
-      final int hours  = millis / (org.apache.drill.exec.expr.fn.impl.DateUtility.hoursToMillis);
-      millis     = millis % (org.apache.drill.exec.expr.fn.impl.DateUtility.hoursToMillis);
-
-      final int minutes = millis / (org.apache.drill.exec.expr.fn.impl.DateUtility.minutesToMillis);
-      millis      = millis % (org.apache.drill.exec.expr.fn.impl.DateUtility.minutesToMillis);
-
-      final int seconds = millis / (org.apache.drill.exec.expr.fn.impl.DateUtility.secondsToMillis);
-      millis      = millis % (org.apache.drill.exec.expr.fn.impl.DateUtility.secondsToMillis);
-
-      final String dayString = (Math.abs(days) == 1) ? " day " : " days ";
-
-      return(new StringBuilder().
-              append(days).append(dayString).
-              append(hours).append(":").
-              append(minutes).append(":").
-              append(seconds).append(".").
-              append(millis));
-    }
-
-    <#elseif (minor.class == "Decimal28Sparse") || (minor.class == "Decimal38Sparse") || (minor.class == "Decimal28Dense") || (minor.class == "Decimal38Dense")>
-
-    public void get(int index, ${minor.class}Holder holder) {
-        holder.start = index * ${type.width};
-        holder.buffer = data;
-        holder.scale = getField().getScale();
-        holder.precision = getField().getPrecision();
-    }
-
-    public void get(int index, Nullable${minor.class}Holder holder) {
-        holder.isSet = 1;
-        holder.start = index * ${type.width};
-        holder.buffer = data;
-        holder.scale = getField().getScale();
-        holder.precision = getField().getPrecision();
-    }
-
-      @Override
-      public ${friendlyType} getObject(int index) {
-      <#if (minor.class == "Decimal28Sparse") || (minor.class == "Decimal38Sparse")>
-      // Get the BigDecimal object
-      return org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(data, index * ${type.width}, ${minor.nDecimalDigits}, getField().getScale());
-      <#else>
-      return org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromDense(data, index * ${type.width}, ${minor.nDecimalDigits}, getField().getScale(), ${minor.maxPrecisionDigits}, ${type.width});
-      </#if>
-    }
-
-    <#else>
-    public void get(int index, ${minor.class}Holder holder){
-      holder.buffer = data;
-      holder.start = index * ${type.width};
-    }
-
-    public void get(int index, Nullable${minor.class}Holder holder){
-      holder.isSet = 1;
-      holder.buffer = data;
-      holder.start = index * ${type.width};
-    }
-
-    @Override
-    public ${friendlyType} getObject(int index) {
-      return data.slice(index * ${type.width}, ${type.width})
-    }
-
-    </#if>
-    <#else> <#-- type.width <= 8 -->
-
-    public ${minor.javaType!type.javaType} get(int index) {
-      return data.get${(minor.javaType!type.javaType)?cap_first}(index * ${type.width});
-    }
-
-    <#if type.width == 4>
-    public long getTwoAsLong(int index) {
-      return data.getLong(index * ${type.width});
-    }
-
-    </#if>
-
-    <#if minor.class == "Date">
-    @Override
-    public ${friendlyType} getObject(int index) {
-        org.joda.time.DateTime date = new org.joda.time.DateTime(get(index), org.joda.time.DateTimeZone.UTC);
-        date = date.withZoneRetainFields(org.joda.time.DateTimeZone.getDefault());
-        return date;
-    }
-
-    <#elseif minor.class == "TimeStamp">
-    @Override
-    public ${friendlyType} getObject(int index) {
-        org.joda.time.DateTime date = new org.joda.time.DateTime(get(index), org.joda.time.DateTimeZone.UTC);
-        date = date.withZoneRetainFields(org.joda.time.DateTimeZone.getDefault());
-        return date;
-    }
-
-    <#elseif minor.class == "IntervalYear">
-    @Override
-    public ${friendlyType} getObject(int index) {
-
-      final int value = get(index);
-
-      final int years  = (value / org.apache.drill.exec.expr.fn.impl.DateUtility.yearsToMonths);
-      final int months = (value % org.apache.drill.exec.expr.fn.impl.DateUtility.yearsToMonths);
-      final Period p = new Period();
-      return p.plusYears(years).plusMonths(months);
-    }
-
-    public StringBuilder getAsStringBuilder(int index) {
-
-      int months  = data.getInt(index);
-
-      final int years  = (months / org.apache.drill.exec.expr.fn.impl.DateUtility.yearsToMonths);
-      months = (months % org.apache.drill.exec.expr.fn.impl.DateUtility.yearsToMonths);
-
-      final String yearString = (Math.abs(years) == 1) ? " year " : " years ";
-      final String monthString = (Math.abs(months) == 1) ? " month " : " months ";
-
-      return(new StringBuilder().
-             append(years).append(yearString).
-             append(months).append(monthString));
-    }
-
-    <#elseif minor.class == "Time">
-    @Override
-    public DateTime getObject(int index) {
-
-        org.joda.time.DateTime time = new org.joda.time.DateTime(get(index), org.joda.time.DateTimeZone.UTC);
-        time = time.withZoneRetainFields(org.joda.time.DateTimeZone.getDefault());
-        return time;
-    }
-
-    <#elseif minor.class == "Decimal9" || minor.class == "Decimal18">
-    @Override
-    public ${friendlyType} getObject(int index) {
-
-        final BigInteger value = BigInteger.valueOf(((${type.boxedType})get(index)).${type.javaType}Value());
-        return new BigDecimal(value, getField().getScale());
-    }
-
-    <#else>
-    @Override
-    public ${friendlyType} getObject(int index) {
-      return get(index);
-    }
-    public ${minor.javaType!type.javaType} getPrimitiveObject(int index) {
-      return get(index);
-    }
-    </#if>
-
-    public void get(int index, ${minor.class}Holder holder){
-      <#if minor.class.startsWith("Decimal")>
-      holder.scale = getField().getScale();
-      holder.precision = getField().getPrecision();
-      </#if>
-
-      holder.value = data.get${(minor.javaType!type.javaType)?cap_first}(index * ${type.width});
-    }
-
-    public void get(int index, Nullable${minor.class}Holder holder){
-      holder.isSet = 1;
-      holder.value = data.get${(minor.javaType!type.javaType)?cap_first}(index * ${type.width});
-    }
-
-
-   </#if> <#-- type.width -->
- }
-
- /**
-  * ${minor.class}.Mutator implements a mutable vector of fixed width values.  Elements in the
-  * vector are accessed by position from the logical start of the vector.  Values should be pushed
-  * onto the vector sequentially, but may be randomly accessed.
-  *   The width of each element is ${type.width} byte(s)
-  *   The equivalent Java primitive is '${minor.javaType!type.javaType}'
-  *
-  * NB: this class is automatically generated from ValueVectorTypes.tdd using FreeMarker.
-  */
-  public final class Mutator extends BaseDataValueVector.BaseMutator {
-
-    private Mutator(){};
-   /**
-    * Set the element at the given index to the given value.  Note that widths smaller than
-    * 32 bits are handled by the DrillBuf interface.
-    *
-    * @param index   position of the bit to set
-    * @param value   value to set
-    */
-  <#if (type.width > 8)>
-   public void set(int index, <#if (type.width > 4)>${minor.javaType!type.javaType}<#else>int</#if> value) {
-     data.setBytes(index * ${type.width}, value, 0, ${type.width});
-   }
-
-   public void setSafe(int index, <#if (type.width > 4)>${minor.javaType!type.javaType}<#else>int</#if> value) {
-     while(index >= getValueCapacity()) {
-       reAlloc();
-     }
-     data.setBytes(index * ${type.width}, value, 0, ${type.width});
-   }
-
-  <#if (minor.class == "Interval")>
-   public void set(int index, int months, int days, int milliseconds){
-     final int offsetIndex = index * ${type.width};
-     data.setInt(offsetIndex, months);
-     data.setInt((offsetIndex + ${minor.daysOffset}), days);
-     data.setInt((offsetIndex + ${minor.millisecondsOffset}), milliseconds);
-   }
-
-   protected void set(int index, ${minor.class}Holder holder){
-     set(index, holder.months, holder.days, holder.milliseconds);
-   }
-
-   protected void set(int index, Nullable${minor.class}Holder holder){
-     set(index, holder.months, holder.days, holder.milliseconds);
-   }
-
-   public void setSafe(int index, int months, int days, int milliseconds){
-     while(index >= getValueCapacity()) {
-       reAlloc();
-     }
-     set(index, months, days, milliseconds);
-   }
-
-   public void setSafe(int index, Nullable${minor.class}Holder holder){
-     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")>
-   public void set(int index, int days, int milliseconds){
-     final int offsetIndex = index * ${type.width};
-     data.setInt(offsetIndex, days);
-     data.setInt((offsetIndex + ${minor.millisecondsOffset}), milliseconds);
-   }
-
-   protected void set(int index, ${minor.class}Holder holder){
-     set(index, holder.days, holder.milliseconds);
-   }
-   protected void set(int index, Nullable${minor.class}Holder holder){
-     set(index, holder.days, holder.milliseconds);
-   }
-
-   public void setSafe(int index, int days, int milliseconds){
-     while(index >= getValueCapacity()) {
-       reAlloc();
-     }
-     set(index, days, milliseconds);
-   }
-
-   public void setSafe(int index, ${minor.class}Holder holder){
-     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")>
-
-   public void set(int index, ${minor.class}Holder holder){
-     set(index, holder.start, holder.buffer);
-   }
-
-   void set(int index, Nullable${minor.class}Holder holder){
-     set(index, holder.start, holder.buffer);
-   }
-
-   public void setSafe(int index,  Nullable${minor.class}Holder holder){
-     setSafe(index, holder.start, holder.buffer);
-   }
-   public void setSafe(int index,  ${minor.class}Holder holder){
-     setSafe(index, holder.start, holder.buffer);
-   }
-
-   public void setSafe(int index, int start, DrillBuf buffer){
-     while(index >= getValueCapacity()) {
-       reAlloc();
-     }
-     set(index, start, buffer);
-   }
-
-   public void set(int index, int start, DrillBuf buffer){
-     data.setBytes(index * ${type.width}, buffer, start, ${type.width});
-   }
-
-   <#else>
-
-   protected void set(int index, ${minor.class}Holder holder){
-     set(index, holder.start, holder.buffer);
-   }
-
-   public void set(int index, Nullable${minor.class}Holder holder){
-     set(index, holder.start, holder.buffer);
-   }
-
-   public void set(int index, int start, DrillBuf buffer){
-     data.setBytes(index * ${type.width}, buffer, start, ${type.width});
-   }
-
-   public void setSafe(int index, ${minor.class}Holder holder){
-     setSafe(index, holder.start, holder.buffer);
-   }
-   public void setSafe(int index, Nullable${minor.class}Holder holder){
-     setSafe(index, holder.start, holder.buffer);
-   }
-
-   public void setSafe(int index, int start, DrillBuf buffer){
-     while(index >= getValueCapacity()) {
-       reAlloc();
-     }
-     set(index, holder);
-   }
-
-   public void set(int index, Nullable${minor.class}Holder holder){
-     data.setBytes(index * ${type.width}, holder.buffer, holder.start, ${type.width});
-   }
-   </#if>
-
-   @Override
-   public void generateTestData(int count) {
-     setValueCount(count);
-     boolean even = true;
-     final int valueCount = getAccessor().getValueCount();
-     for(int i = 0; i < valueCount; i++, even = !even) {
-       final byte b = even ? Byte.MIN_VALUE : Byte.MAX_VALUE;
-       for(int w = 0; w < ${type.width}; w++){
-         data.setByte(i + w, b);
-       }
-     }
-   }
-
-   <#else> <#-- type.width <= 8 -->
-   public void set(int index, <#if (type.width >= 4)>${minor.javaType!type.javaType}<#else>int</#if> value) {
-     data.set${(minor.javaType!type.javaType)?cap_first}(index * ${type.width}, value);
-   }
-
-   public void setSafe(int index, <#if (type.width >= 4)>${minor.javaType!type.javaType}<#else>int</#if> value) {
-     while(index >= getValueCapacity()) {
-       reAlloc();
-     }
-     set(index, value);
-   }
-
-   protected void set(int index, ${minor.class}Holder holder){
-     data.set${(minor.javaType!type.javaType)?cap_first}(index * ${type.width}, holder.value);
-   }
-
-   public void setSafe(int index, ${minor.class}Holder holder){
-     while(index >= getValueCapacity()) {
-       reAlloc();
-     }
-     set(index, holder);
-   }
-
-   protected void set(int index, Nullable${minor.class}Holder holder){
-     data.set${(minor.javaType!type.javaType)?cap_first}(index * ${type.width}, holder.value);
-   }
-
-   public void setSafe(int index, Nullable${minor.class}Holder holder){
-     while(index >= getValueCapacity()) {
-       reAlloc();
-     }
-     set(index, holder);
-   }
-
-   @Override
-   public void generateTestData(int size) {
-     setValueCount(size);
-     boolean even = true;
-     final int valueCount = getAccessor().getValueCount();
-     for(int i = 0; i < valueCount; i++, even = !even) {
-       if(even){
-         set(i, ${minor.boxedType!type.boxedType}.MIN_VALUE);
-       }else{
-         set(i, ${minor.boxedType!type.boxedType}.MAX_VALUE);
-       }
-     }
-   }
-
-   public void generateTestDataAlt(int size) {
-     setValueCount(size);
-     boolean even = true;
-     final int valueCount = getAccessor().getValueCount();
-     for(int i = 0; i < valueCount; i++, even = !even) {
-       if(even){
-         set(i, (${(minor.javaType!type.javaType)}) 1);
-       }else{
-         set(i, (${(minor.javaType!type.javaType)}) 0);
-       }
-     }
-   }
-
-  </#if> <#-- type.width -->
-
-   @Override
-   public void setValueCount(int valueCount) {
-     final int currentValueCapacity = getValueCapacity();
-     final int idx = (${type.width} * valueCount);
-     while(valueCount > getValueCapacity()) {
-       reAlloc();
-     }
-     if (valueCount > 0 && currentValueCapacity > valueCount * 2) {
-       incrementAllocationMonitor();
-     } else if (allocationMonitor > 0) {
-       allocationMonitor = 0;
-     }
-     VectorTrimmer.trim(data, idx);
-     data.writerIndex(valueCount * ${type.width});
-   }
- }
-}
-
-</#if> <#-- type.major -->
-</#list>
-</#list>


Mime
View raw message