arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject [07/14] arrow git commit: ARROW-1049: [java] vector template cleanup
Date Wed, 31 May 2017 17:46:36 GMT
ARROW-1049: [java] vector template cleanup

Author: Julien Le Dem <julien@apache.org>

Closes #703 from julienledem/template_cleanup and squashes the following commits:

d67cb7e [Julien Le Dem] remove duplicated code
f17e8cd [Julien Le Dem] template cleanup


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

Branch: refs/heads/master
Commit: b06602d08f5e5b741559449525edaa404bf1675c
Parents: a6e77f4
Author: Julien Le Dem <julien@apache.org>
Authored: Mon May 22 16:06:33 2017 -0700
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Wed May 31 13:45:48 2017 -0400

----------------------------------------------------------------------
 .../src/main/codegen/data/ValueVectorTypes.tdd  |   2 +-
 .../codegen/templates/AbstractFieldWriter.java  |   6 -
 .../AbstractPromotableFieldWriter.java          |   6 -
 .../main/codegen/templates/ComplexWriters.java  |  11 -
 .../codegen/templates/FixedValueVectors.java    | 224 ++++---------------
 .../codegen/templates/HolderReaderImpl.java     | 134 +++--------
 .../codegen/templates/NullableValueVectors.java |  31 +--
 .../main/codegen/templates/UnionListWriter.java |  35 ++-
 .../src/main/codegen/templates/UnionReader.java |  41 ++--
 .../src/main/codegen/templates/UnionVector.java |  68 +++---
 .../src/main/codegen/templates/UnionWriter.java |  32 +--
 .../main/codegen/templates/ValueHolders.java    |   2 +-
 .../templates/VariableLengthVectors.java        |  11 +-
 13 files changed, 185 insertions(+), 418 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/data/ValueVectorTypes.tdd
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/data/ValueVectorTypes.tdd b/java/vector/src/main/codegen/data/ValueVectorTypes.tdd
index 4d8c99e..970d887 100644
--- a/java/vector/src/main/codegen/data/ValueVectorTypes.tdd
+++ b/java/vector/src/main/codegen/data/ValueVectorTypes.tdd
@@ -118,7 +118,7 @@
           maxPrecisionDigits: 38, nDecimalDigits: 4, friendlyType: "BigDecimal",
           typeParams: [ {name: "scale", type: "int"}, { name: "precision", type: "int"}],
           arrowType: "org.apache.arrow.vector.types.pojo.ArrowType.Decimal",
-          fields: [{name: "start", type: "int"}, {name: "buffer", type: "ArrowBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}]
+          fields: [{name: "start", type: "int"}, {name: "buffer", type: "ArrowBuf"}]
         }
       ]
     },

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/AbstractFieldWriter.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/AbstractFieldWriter.java b/java/vector/src/main/codegen/templates/AbstractFieldWriter.java
index 65bcc05..da8e4f5 100644
--- a/java/vector/src/main/codegen/templates/AbstractFieldWriter.java
+++ b/java/vector/src/main/codegen/templates/AbstractFieldWriter.java
@@ -58,15 +58,9 @@ abstract class AbstractFieldWriter extends AbstractBaseWriter implements FieldWr
     fail("${name}");
   }
 
-  <#if minor.class == "Decimal">
-  public void write${minor.class}(int start, ArrowBuf buffer) {
-    fail("${name}");
-  }
-  <#else>
   public void write${minor.class}(<#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>) {
     fail("${name}");
   }
-  </#if>
 
   </#list></#list>
 

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/AbstractPromotableFieldWriter.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/AbstractPromotableFieldWriter.java b/java/vector/src/main/codegen/templates/AbstractPromotableFieldWriter.java
index 636b305..228c2c5 100644
--- a/java/vector/src/main/codegen/templates/AbstractPromotableFieldWriter.java
+++ b/java/vector/src/main/codegen/templates/AbstractPromotableFieldWriter.java
@@ -78,15 +78,9 @@ abstract class AbstractPromotableFieldWriter extends AbstractFieldWriter {
     getWriter(MinorType.${name?upper_case}).write(holder);
   }
 
-    <#if minor.class == "Decimal">
-  public void write${minor.class}(int start, ArrowBuf buffer) {
-    getWriter(MinorType.${name?upper_case}).write${minor.class}(start, buffer);
-  }
-    <#else>
   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() {

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/ComplexWriters.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/ComplexWriters.java b/java/vector/src/main/codegen/templates/ComplexWriters.java
index c23b89d..8ebecf3 100644
--- a/java/vector/src/main/codegen/templates/ComplexWriters.java
+++ b/java/vector/src/main/codegen/templates/ComplexWriters.java
@@ -111,17 +111,10 @@ public class ${eName}WriterImpl extends AbstractFieldWriter {
     vector.getMutator().setValueCount(idx()+1);
   }
 
-  <#if minor.class == "Decimal">
-  public void writeDecimal(int start, ArrowBuf buffer) {
-    mutator.setSafe(idx(), 1, start, buffer);
-    vector.getMutator().setValueCount(idx()+1);
-  }
-  <#else>
   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><#if field.include!true >, ${field.name}</#if></#list>);
     vector.getMutator().setValueCount(idx()+1);
   }
-  </#if>
 
   <#if mode == "Nullable">
 
@@ -146,11 +139,7 @@ package org.apache.arrow.vector.complex.writer;
 public interface ${eName}Writer extends BaseWriter {
   public void write(${minor.class}Holder h);
 
-  <#if minor.class == "Decimal">
-  public void writeDecimal(int start, ArrowBuf buffer);
-  <#else>
   public void write${minor.class}(<#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>);
-  </#if>
 }
 
 </#list>

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/FixedValueVectors.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/FixedValueVectors.java b/java/vector/src/main/codegen/templates/FixedValueVectors.java
index 5d80b66..395417b 100644
--- a/java/vector/src/main/codegen/templates/FixedValueVectors.java
+++ b/java/vector/src/main/codegen/templates/FixedValueVectors.java
@@ -56,7 +56,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
   private int allocationMonitor = 0;
   <#if minor.typeParams??>
 
-     <#list minor.typeParams as typeParam>
+    <#list minor.typeParams as typeParam>
   private final ${typeParam.type} ${typeParam.name};
     </#list>
 
@@ -67,7 +67,6 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
     </#list>
   }
   <#else>
-
   public ${className}(String name, BufferAllocator allocator) {
     super(name, allocator);
   }
@@ -166,7 +165,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
     allocationMonitor = 0;
     zeroVector();
     super.reset();
-    }
+  }
 
   private void allocateBytes(final long size) {
     if (size > MAX_ALLOCATION_SIZE) {
@@ -180,11 +179,11 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
     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.arrow.memory.OutOfMemoryException if it can't allocate the new buffer
- */
+  /**
+   * 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.arrow.memory.OutOfMemoryException if it can't allocate the new buffer
+   */
   public void reAlloc() {
     final long newAllocationSize = allocationSizeInBytes * 2L;
     if (newAllocationSize > MAX_ALLOCATION_SIZE)  {
@@ -311,76 +310,12 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
     }
 
     <#if (type.width > 8 || minor.class == "IntervalDay")>
-
     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.arrow.vector.util.DateUtility.yearsToMonths);
-      months = (months % org.apache.arrow.vector.util.DateUtility.yearsToMonths);
-
-      final int hours  = millis / (org.apache.arrow.vector.util.DateUtility.hoursToMillis);
-      millis     = millis % (org.apache.arrow.vector.util.DateUtility.hoursToMillis);
-
-      final int minutes = millis / (org.apache.arrow.vector.util.DateUtility.minutesToMillis);
-      millis      = millis % (org.apache.arrow.vector.util.DateUtility.minutesToMillis);
-
-      final long seconds = millis / (org.apache.arrow.vector.util.DateUtility.secondsToMillis);
-      millis      = millis % (org.apache.arrow.vector.util.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")>
+      <#if (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});
@@ -402,7 +337,6 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
       return p.plusDays(days).plusMillis(millis);
     }
 
-
     public StringBuilder getAsStringBuilder(int index) {
       final int offsetIndex = index * ${type.width};
 
@@ -428,8 +362,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
               append(millis));
     }
 
-    <#elseif minor.class == "Decimal">
-
+      <#elseif minor.class == "Decimal">
     public void get(int index, ${minor.class}Holder holder) {
         holder.start = index * ${type.width};
         holder.buffer = data;
@@ -450,7 +383,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
       return org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(data, ${type.width} * index, scale);
     }
 
-    <#else>
+      <#else>
     public void get(int index, ${minor.class}Holder holder){
       holder.buffer = data;
       holder.start = index * ${type.width};
@@ -467,44 +400,35 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
       return data.slice(index * ${type.width}, ${type.width})
     }
 
-    </#if>
+      </#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>
+      <#if type.width == 4>
     public long getTwoAsLong(int index) {
       return data.getLong(index * ${type.width});
     }
 
-    </#if>
-
-    <#if minor.class == "DateDay" ||
-         minor.class == "TimeSec" ||
-         minor.class == "TimeMicro" ||
-         minor.class == "TimeNano">
+      </#if>
+      <#if minor.class == "DateDay" ||
+           minor.class == "TimeSec" ||
+           minor.class == "TimeMicro" ||
+           minor.class == "TimeNano">
     @Override
     public ${friendlyType} getObject(int index) {
       return get(index);
     }
 
-    <#elseif minor.class == "DateMilli">
+      <#elseif minor.class == "DateMilli" || minor.class == "TimeMilli" || minor.class == "TimeStampMilli">
     @Override
     public ${friendlyType} getObject(int index) {
-      org.joda.time.LocalDateTime date = new org.joda.time.LocalDateTime(get(index), org.joda.time.DateTimeZone.UTC);
-      return date;
+      org.joda.time.LocalDateTime ldt = new org.joda.time.LocalDateTime(get(index), org.joda.time.DateTimeZone.UTC);
+      return ldt;
     }
 
-    <#elseif minor.class == "TimeMilli">
-    @Override
-    public ${friendlyType} getObject(int index) {
-      org.joda.time.LocalDateTime time = new org.joda.time.LocalDateTime(get(index), org.joda.time.DateTimeZone.UTC);
-      return time;
-    }
-
-    <#elseif minor.class == "TimeStampSec">
+      <#elseif minor.class == "TimeStampSec">
     @Override
     public ${friendlyType} getObject(int index) {
       long secs = java.util.concurrent.TimeUnit.SECONDS.toMillis(get(index));
@@ -512,14 +436,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
       return date;
     }
 
-    <#elseif minor.class == "TimeStampMilli">
-    @Override
-    public ${friendlyType} getObject(int index) {
-        org.joda.time.LocalDateTime date = new org.joda.time.LocalDateTime(get(index), org.joda.time.DateTimeZone.UTC);
-        return date;
-    }
-
-    <#elseif minor.class == "TimeStampMicro">
+      <#elseif minor.class == "TimeStampMicro">
     @Override
     public ${friendlyType} getObject(int index) {
       // value is truncated when converting microseconds to milliseconds in order to use DateTime type
@@ -528,7 +445,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
       return date;
     }
 
-    <#elseif minor.class == "TimeStampNano">
+      <#elseif minor.class == "TimeStampNano">
     @Override
     public ${friendlyType} getObject(int index) {
       // value is truncated when converting nanoseconds to milliseconds in order to use DateTime type
@@ -537,7 +454,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
       return date;
     }
 
-    <#elseif minor.class == "IntervalYear">
+      <#elseif minor.class == "IntervalYear">
     @Override
     public ${friendlyType} getObject(int index) {
 
@@ -550,7 +467,6 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
     }
 
     public StringBuilder getAsStringBuilder(int index) {
-
       int months  = data.getInt(index);
 
       final int years  = (months / org.apache.arrow.vector.util.DateUtility.yearsToMonths);
@@ -564,15 +480,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
              append(months).append(monthString));
     }
 
-    <#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>
+      <#else>
     @Override
     public ${friendlyType} getObject(int index) {
       return get(index);
@@ -580,14 +488,9 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
     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>
-
+    public void get(int index, ${minor.class}Holder holder){
       holder.value = data.get${(minor.javaType!type.javaType)?cap_first}(index * ${type.width});
     }
 
@@ -596,22 +499,22 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
       holder.value = data.get${(minor.javaType!type.javaType)?cap_first}(index * ${type.width});
     }
 
+    </#if> <#-- 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.
-  */
+  /**
+   * ${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 FixedValueVectorTypes.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 ArrowBuf interface.
@@ -619,7 +522,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
     * @param index   position of the bit to set
     * @param value   value to set
     */
-  <#if (type.width > 8) || minor.class == "IntervalDay">
+    <#if (type.width > 8) || minor.class == "IntervalDay">
    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});
    }
@@ -631,38 +534,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
      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")>
+      <#if (minor.class == "IntervalDay")>
    public void set(int index, int days, int milliseconds){
      final int offsetIndex = index * ${type.width};
      data.setInt(offsetIndex, days);
@@ -672,6 +544,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
    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);
    }
@@ -691,8 +564,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
      setSafe(index, holder.days, holder.milliseconds);
    }
 
-   <#elseif minor.class == "Decimal">
-
+       <#elseif minor.class == "Decimal">
    public void set(int index, ${minor.class}Holder holder){
      set(index, holder.start, holder.buffer);
    }
@@ -719,8 +591,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
      data.setBytes(index * ${type.width}, buffer, start, ${type.width});
    }
 
-   <#else>
-
+       <#else>
    protected void set(int index, ${minor.class}Holder holder){
      set(index, holder.start, holder.buffer);
    }
@@ -736,6 +607,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
    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);
    }
@@ -750,7 +622,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
    public void set(int index, Nullable${minor.class}Holder holder){
      data.setBytes(index * ${type.width}, holder.buffer, holder.start, ${type.width});
    }
-   </#if>
+       </#if>
 
    @Override
    public void generateTestData(int count) {
@@ -765,7 +637,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
      }
    }
 
-   <#else> <#-- type.width <= 8 -->
+     <#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);
    }
@@ -826,7 +698,7 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
      }
    }
 
-  </#if> <#-- type.width -->
+    </#if> <#-- type.width -->
 
    @Override
    public void setValueCount(int valueCount) {
@@ -846,6 +718,6 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
  }
 }
 
-</#if> <#-- type.major -->
+  </#if> <#-- type.major -->
 </#list>
 </#list>

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/HolderReaderImpl.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/HolderReaderImpl.java b/java/vector/src/main/codegen/templates/HolderReaderImpl.java
index e990fcc..471fe41 100644
--- a/java/vector/src/main/codegen/templates/HolderReaderImpl.java
+++ b/java/vector/src/main/codegen/templates/HolderReaderImpl.java
@@ -29,7 +29,7 @@
 <#assign friendlyType = (minor.friendlyType!minor.boxedType!type.boxedType) />
 <#assign safeType=friendlyType />
 <#if safeType=="byte[]"><#assign safeType="ByteArray" /></#if>
-<#assign fields = minor.fields!type.fields />
+<#assign fields = minor.fields!type.fields + minor.typeParams![]/>
 
 <@pp.changeOutputFile name="/org/apache/arrow/vector/complex/impl/${holderMode}${name}HolderReaderImpl.java" />
 <#include "/@includes/license.ftl" />
@@ -81,7 +81,6 @@ public class ${holderMode}${name}HolderReaderImpl extends AbstractFieldReader {
     <#else>
     return true;
     </#if>
-    
   }
 
   @Override
@@ -101,121 +100,50 @@ public class ${holderMode}${name}HolderReaderImpl extends AbstractFieldReader {
 
   // read friendly type
   @Override
-  public ${friendlyType} read${safeType}(){
-<#if nullMode == "Nullable">
+  public ${friendlyType} read${safeType}() {
+  <#if nullMode == "Nullable">
     if (!isSet()) {
       return null;
     }
-</#if>
-
-<#if type.major == "VarLen">
-
-      int length = holder.end - holder.start;
-      byte[] value = new byte [length];
-      holder.buffer.getBytes(holder.start, value, 0, length);
-
-  <#if minor.class == "VarBinary">
-      return value;
-  <#elseif minor.class == "Var16Char">
-      return new String(value);
-  <#elseif minor.class == "VarChar">
-      Text text = new Text();
-      text.set(value);
-      return text;
   </#if>
 
-<#elseif minor.class == "Interval">
-      Period p = new Period();
-      return p.plusMonths(holder.months).plusDays(holder.days).plusMillis(holder.milliseconds);
-
-<#elseif minor.class == "IntervalDay">
-      Period p = new Period();
-      return p.plusDays(holder.days).plusMillis(holder.milliseconds);
-
-<#elseif minor.class == "Bit" >
-      return new Boolean(holder.value != 0);
-<#elseif minor.class == "Decimal" >
-        return (BigDecimal) readSingleObject();
-<#else>
-      ${friendlyType} value = new ${friendlyType}(this.holder.value);
-      return value;
-</#if>
-
+  <#if type.major == "VarLen">
+    int length = holder.end - holder.start;
+    byte[] value = new byte [length];
+    holder.buffer.getBytes(holder.start, value, 0, length);
+    <#if minor.class == "VarBinary">
+    return value;
+    <#elseif minor.class == "VarChar">
+    Text text = new Text();
+    text.set(value);
+    return text;
+    </#if>
+  <#elseif minor.class == "IntervalDay">
+    Period p = new Period();
+    return p.plusDays(holder.days).plusMillis(holder.milliseconds);
+  <#elseif minor.class == "Bit" >
+    return new Boolean(holder.value != 0);
+  <#elseif minor.class == "Decimal">
+    byte[] bytes = new byte[${type.width}];
+    holder.buffer.getBytes(holder.start, bytes, 0, ${type.width});
+    ${friendlyType} value = new BigDecimal(new BigInteger(bytes), holder.scale);
+    return value;
+  <#else>
+    ${friendlyType} value = new ${friendlyType}(this.holder.value);
+    return value;
+  </#if>
   }
 
   @Override
   public Object readObject() {
-    return readSingleObject();
+    return read${safeType}();
   }
 
-  private Object readSingleObject() {
-<#if nullMode == "Nullable">
-    if (!isSet()) {
-      return null;
-    }
-</#if>
-
-<#if type.major == "VarLen">
-      <#if minor.class != "Decimal">
-      int length = holder.end - holder.start;
-      byte[] value = new byte [length];
-      holder.buffer.getBytes(holder.start, value, 0, length);
-      </#if>
-
-<#if minor.class == "VarBinary">
-      return value;
-<#elseif minor.class == "Var16Char">
-      return new String(value);
-<#elseif minor.class == "VarChar">
-      Text text = new Text();
-      text.set(value);
-      return text;
-<#elseif minor.class == "Decimal" >
-      return org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(holder.buffer, holder.start, holder.scale);
-</#if>
-
-<#elseif minor.class == "Interval">
-      Period p = new Period();
-      return p.plusMonths(holder.months).plusDays(holder.days).plusMillis(holder.milliseconds);
-
-<#elseif minor.class == "IntervalDay">
-      Period p = new Period();
-      return p.plusDays(holder.days).plusMillis(holder.milliseconds);
-
-<#elseif minor.class == "Decimal28Dense" ||
-         minor.class == "Decimal38Dense">
-      return org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromDense(holder.buffer,
-                                                                                holder.start,
-                                                                                holder.nDecimalDigits,
-                                                                                holder.scale,
-                                                                                holder.maxPrecision,
-                                                                                holder.WIDTH);
-
-<#elseif minor.class == "Decimal28Sparse" ||
-         minor.class == "Decimal38Sparse">
-      return org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromSparse(holder.buffer,
-                                                                                 holder.start,
-                                                                                 holder.nDecimalDigits,
-                                                                                 holder.scale);
-
-<#elseif minor.class == "Bit" >
-      return new Boolean(holder.value != 0);
-<#elseif minor.class == "Decimal">
-        byte[] bytes = new byte[${type.width}];
-        holder.buffer.getBytes(holder.start, bytes, 0, ${type.width});
-        ${friendlyType} value = new BigDecimal(new BigInteger(bytes), holder.scale);
-        return value;
-<#else>
-      ${friendlyType} value = new ${friendlyType}(this.holder.value);
-      return value;
-</#if>
-  }
-
-<#if nullMode != "Nullable">
+  <#if nullMode != "Nullable">
   public void copyAsValue(${minor.class?cap_first}Writer writer){
     writer.write(holder);
   }
-</#if>
+  </#if>
 }
 
 </#list>

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/NullableValueVectors.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/NullableValueVectors.java b/java/vector/src/main/codegen/templates/NullableValueVectors.java
index 3231c4c..dfd5755 100644
--- a/java/vector/src/main/codegen/templates/NullableValueVectors.java
+++ b/java/vector/src/main/codegen/templates/NullableValueVectors.java
@@ -470,11 +470,6 @@ public final class ${className} extends BaseDataValueVector implements <#if type
     public void get(int index, Nullable${minor.class}Holder holder){
       vAccessor.get(index, holder);
       holder.isSet = bAccessor.get(index);
-
-      <#if minor.class.startsWith("Decimal")>
-      holder.scale = scale;
-      holder.precision = precision;
-      </#if>
     }
 
     @Override
@@ -486,7 +481,7 @@ public final class ${className} extends BaseDataValueVector implements <#if type
       }
     }
 
-    <#if minor.class == "Interval" || minor.class == "IntervalDay" || minor.class == "IntervalYear">
+    <#if minor.class == "Interval" || minor.class == "IntervalDay">
     public StringBuilder getAsStringBuilder(int index) {
       if (isNull(index)) {
           return null;
@@ -628,7 +623,7 @@ public final class ${className} extends BaseDataValueVector implements <#if type
     }
 
     <#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> ){
+    public void set(int index, int isSet<#list fields as field>, ${field.type} ${field.name}Field</#list> ){
       final ${valuesName}.Mutator valuesMutator = values.getMutator();
       <#if type.major == "VarLen">
       for (int i = lastSet + 1; i < index; i++) {
@@ -644,7 +639,6 @@ public final class ${className} extends BaseDataValueVector implements <#if type
       <#if type.major == "VarLen">
       fillEmpties(index);
       </#if>
-
       bits.getMutator().setSafe(index, isSet);
       values.getMutator().setSafe(index<#list fields as field><#if field.include!true >, ${field.name}Field</#if></#list>);
       setCount++;
@@ -653,7 +647,6 @@ public final class ${className} extends BaseDataValueVector implements <#if type
 
 
     public void setSafe(int index, Nullable${minor.class}Holder value) {
-
       <#if type.major == "VarLen">
       fillEmpties(index);
       </#if>
@@ -664,7 +657,6 @@ public final class ${className} extends BaseDataValueVector implements <#if type
     }
 
     public void setSafe(int index, ${minor.class}Holder value) {
-
       <#if type.major == "VarLen">
       fillEmpties(index);
       </#if>
@@ -674,18 +666,17 @@ public final class ${className} extends BaseDataValueVector implements <#if type
       <#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 == "Interval" || minor.class == "IntervalDay")>
-      public void setSafe(int index, ${minor.javaType!type.javaType} value) {
-        <#if type.major == "VarLen">
-        fillEmpties(index);
-        </#if>
-        bits.getMutator().setSafeToOne(index);
-        values.getMutator().setSafe(index, value);
-        setCount++;
-      }
+    <#if !(type.major == "VarLen" || minor.class == "IntervalYear" || minor.class == "IntervalDay")>
+    public void setSafe(int index, ${minor.javaType!type.javaType} value) {
+      <#if type.major == "VarLen">
+      fillEmpties(index);
+      </#if>
+      bits.getMutator().setSafeToOne(index);
+      values.getMutator().setSafe(index, value);
+      setCount++;
+    }
 
     </#if>
-
     @Override
     public void setValueCount(int valueCount) {
       assert valueCount >= 0;

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/UnionListWriter.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/UnionListWriter.java b/java/vector/src/main/codegen/templates/UnionListWriter.java
index d019a1e..d6e2f9f 100644
--- a/java/vector/src/main/codegen/templates/UnionListWriter.java
+++ b/java/vector/src/main/codegen/templates/UnionListWriter.java
@@ -89,27 +89,23 @@ public class UnionListWriter extends AbstractFieldWriter {
   public void setPosition(int index) {
     super.setPosition(index);
   }
-
   <#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 uncappedName == "int" ><#assign uncappedName = "integer" /></#if>
   <#if !minor.typeParams?? >
 
   @Override
-  public ${name}Writer <#if uncappedName == "int">integer<#else>${uncappedName}</#if>() {
+  public ${name}Writer ${uncappedName}() {
     return this;
   }
 
   @Override
-  public ${name}Writer <#if uncappedName == "int">integer<#else>${uncappedName}</#if>(String name) {
-//    assert inMap;
+  public ${name}Writer ${uncappedName}(String name) {
     mapName = name;
-    return writer.<#if uncappedName == "int">integer<#else>${uncappedName}</#if>(name);
+    return writer.${uncappedName}(name);
   }
-
   </#if>
-
   </#list></#list>
 
   @Override
@@ -149,33 +145,28 @@ public class UnionListWriter extends AbstractFieldWriter {
 
   @Override
   public void start() {
-//    assert inMap;
     writer.start();
   }
 
   @Override
   public void end() {
-//    if (inMap) {
     writer.end();
     inMap = false;
-//    }
   }
 
-  <#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")>
-
+  <#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.typeParams?? >
   @Override
   public void write${name}(<#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>) {
-//    assert !inMap;
     writer.write${name}(<#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
     writer.setPosition(writer.idx()+1);
   }
 
-  </#if>
-
-  </#list></#list>
-
+      </#if>
+    </#list>
+  </#list>
 }

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/UnionReader.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/UnionReader.java b/java/vector/src/main/codegen/templates/UnionReader.java
index 0b5a209..2246fb3 100644
--- a/java/vector/src/main/codegen/templates/UnionReader.java
+++ b/java/vector/src/main/codegen/templates/UnionReader.java
@@ -79,13 +79,16 @@ public class UnionReader extends AbstractFieldReader {
       return (FieldReader) getMap();
     case LIST:
       return (FieldReader) getList();
-    <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
-    <#assign uncappedName = name?uncap_first/>
-    <#if !minor.class?starts_with("Decimal")>
+    <#list vv.types as type>
+      <#list type.minor as minor>
+        <#assign name = minor.class?cap_first />
+        <#assign uncappedName = name?uncap_first/>
+        <#if !minor.typeParams?? >
     case ${name?upper_case}:
       return (FieldReader) get${name}();
-    </#if>
-    </#list></#list>
+        </#if>
+      </#list>
+    </#list>
     default:
       throw new UnsupportedOperationException("Unsupported type: " + MinorType.values()[typeValue]);
     }
@@ -140,14 +143,16 @@ public class UnionReader extends AbstractFieldReader {
     return getReaderForIndex(idx()).size();
   }
 
-  <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
-          <#assign uncappedName = name?uncap_first/>
-  <#assign boxedType = (minor.boxedType!type.boxedType) />
-  <#assign javaType = (minor.javaType!type.javaType) />
-  <#assign friendlyType = (minor.friendlyType!minor.boxedType!type.boxedType) />
-  <#assign safeType=friendlyType />
-  <#if safeType=="byte[]"><#assign safeType="ByteArray" /></#if>
-  <#if !minor.class?starts_with("Decimal")>
+  <#list vv.types as type>
+    <#list type.minor as minor>
+      <#assign name = minor.class?cap_first />
+      <#assign uncappedName = name?uncap_first/>
+      <#assign boxedType = (minor.boxedType!type.boxedType) />
+      <#assign javaType = (minor.javaType!type.javaType) />
+      <#assign friendlyType = (minor.friendlyType!minor.boxedType!type.boxedType) />
+      <#assign safeType=friendlyType />
+      <#if safeType=="byte[]"><#assign safeType="ByteArray" /></#if>
+      <#if !minor.typeParams?? >
 
   private ${name}ReaderImpl ${uncappedName}Reader;
 
@@ -167,8 +172,9 @@ public class UnionReader extends AbstractFieldReader {
   public void copyAsValue(${name}Writer writer){
     getReaderForIndex(idx()).copyAsValue(writer);
   }
-  </#if>
-  </#list></#list>
+      </#if>
+    </#list>
+  </#list>
 
   @Override
   public void copyAsValue(ListWriter writer) {
@@ -184,7 +190,7 @@ public class UnionReader extends AbstractFieldReader {
       }
     }
   }
-  
+
   public FieldReader reader(String name){
     return getMap().reader(name);
   }
@@ -197,6 +203,3 @@ public class UnionReader extends AbstractFieldReader {
     return getReaderForIndex(idx()).next();
   }
 }
-
-
-

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/UnionVector.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/UnionVector.java b/java/vector/src/main/codegen/templates/UnionVector.java
index ec42b12..aa9d34d 100644
--- a/java/vector/src/main/codegen/templates/UnionVector.java
+++ b/java/vector/src/main/codegen/templates/UnionVector.java
@@ -145,12 +145,13 @@ public class UnionVector implements FieldVector {
     }
     return mapVector;
   }
-
-  <#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/>
-  <#assign lowerCaseName = name?lower_case/>
-  <#if !minor.class?starts_with("Decimal")>
+  <#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/>
+      <#assign lowerCaseName = name?lower_case/>
+      <#if !minor.typeParams?? >
 
   private Nullable${name}Vector ${uncappedName}Vector;
 
@@ -167,10 +168,9 @@ public class UnionVector implements FieldVector {
     }
     return ${uncappedName}Vector;
   }
-
-  </#if>
-
-  </#list></#list>
+      </#if>
+    </#list>
+  </#list>
 
   public ListVector getList() {
     if (listVector == null) {
@@ -401,22 +401,23 @@ public class UnionVector implements FieldVector {
 
   public class Accessor extends BaseValueVector.BaseAccessor {
 
-
     @Override
     public Object getObject(int index) {
       int type = typeVector.getAccessor().get(index);
       switch (MinorType.values()[type]) {
       case NULL:
         return null;
-      <#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")>
+      <#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.typeParams?? >
       case ${name?upper_case}:
         return get${name}Vector().getAccessor().getObject(index);
-      </#if>
-
-      </#list></#list>
+          </#if>
+        </#list>
+      </#list>
       case MAP:
         return getMap().getAccessor().getObject(index);
       case LIST:
@@ -473,17 +474,20 @@ public class UnionVector implements FieldVector {
       writer.setPosition(index);
       MinorType type = reader.getMinorType();
       switch (type) {
-      <#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")>
+      <#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.typeParams?? >
       case ${name?upper_case}:
         Nullable${name}Holder ${uncappedName}Holder = new Nullable${name}Holder();
         reader.read(${uncappedName}Holder);
         setSafe(index, ${uncappedName}Holder);
         break;
-      </#if>
-      </#list></#list>
+          </#if>
+        </#list>
+      </#list>
       case MAP: {
         ComplexCopier.copy(reader, writer);
         break;
@@ -496,18 +500,20 @@ public class UnionVector implements FieldVector {
         throw new UnsupportedOperationException();
       }
     }
-
-    <#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")>
+    <#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.typeParams?? >
     public void setSafe(int index, Nullable${name}Holder holder) {
       setType(index, MinorType.${name?upper_case});
       get${name}Vector().getMutator().setSafe(index, holder);
     }
 
-    </#if>
-    </#list></#list>
+        </#if>
+      </#list>
+    </#list>
 
     public void setType(int index, MinorType type) {
       typeVector.getMutator().setSafe(index, (byte) type.ordinal());

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/UnionWriter.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/UnionWriter.java b/java/vector/src/main/codegen/templates/UnionWriter.java
index 4a7c472..f892bac 100644
--- a/java/vector/src/main/codegen/templates/UnionWriter.java
+++ b/java/vector/src/main/codegen/templates/UnionWriter.java
@@ -117,26 +117,26 @@ public class UnionWriter extends AbstractFieldWriter implements FieldWriter {
     case LIST:
       return getListWriter();
     <#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.typeParams??>
+      <#list type.minor as minor>
+        <#assign name = minor.class?cap_first />
+        <#assign fields = minor.fields!type.fields />
+        <#assign uncappedName = name?uncap_first/>
+        <#if !minor.typeParams??>
     case ${name?upper_case}:
       return get${name}Writer();
-      </#if>
-    </#list>
+        </#if>
+      </#list>
     </#list>
     default:
       throw new UnsupportedOperationException("Unknown type: " + minorType);
     }
   }
-
-  <#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.typeParams?? >
+  <#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.typeParams?? >
 
   private ${name}Writer ${name?uncap_first}Writer;
 
@@ -166,9 +166,9 @@ public class UnionWriter extends AbstractFieldWriter implements FieldWriter {
     get${name}Writer().setPosition(idx());
     get${name}Writer().write${name}(<#list fields as field>${field.name}<#if field_has_next>, </#if></#list>);
   }
-  </#if>
-
-  </#list></#list>
+      </#if>
+    </#list>
+  </#list>
 
   public void writeNull() {
   }

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/ValueHolders.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/ValueHolders.java b/java/vector/src/main/codegen/templates/ValueHolders.java
index a474b69..b74d919 100644
--- a/java/vector/src/main/codegen/templates/ValueHolders.java
+++ b/java/vector/src/main/codegen/templates/ValueHolders.java
@@ -50,7 +50,7 @@ public final class ${className} implements ValueHolder{
     
     <#if mode.name == "Optional">public int isSet;
     <#else>public final int isSet = 1;</#if>
-    <#assign fields = minor.fields!type.fields />
+    <#assign fields = (minor.fields!type.fields) + (minor.typeParams![]) />
     <#list fields as field>
     public ${field.type} ${field.name};
     </#list>

http://git-wip-us.apache.org/repos/asf/arrow/blob/b06602d0/java/vector/src/main/codegen/templates/VariableLengthVectors.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/VariableLengthVectors.java b/java/vector/src/main/codegen/templates/VariableLengthVectors.java
index f13291b..2ad7d20 100644
--- a/java/vector/src/main/codegen/templates/VariableLengthVectors.java
+++ b/java/vector/src/main/codegen/templates/VariableLengthVectors.java
@@ -421,23 +421,22 @@ public final class ${className} extends BaseDataValueVector implements VariableW
       holder.buffer = data;
     }
 
-
     <#switch minor.class>
-    <#case "VarChar">
+      <#case "VarChar">
     @Override
     public ${friendlyType} getObject(int index) {
       Text text = new Text();
       text.set(get(index));
       return text;
     }
-    <#break>
-    <#case "Decimal">
+      <#break>
+      <#case "Decimal">
     @Override
     public ${friendlyType} getObject(int index) {
       return new BigDecimal(new BigInteger(get(index)), scale);
     }
-    <#break>
-    <#default>
+      <#break>
+      <#default>
     @Override
     public ${friendlyType} getObject(int index) {
       return get(index);


Mime
View raw message