drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject drill git commit: DRILL-2280: Refactor ValueVector interface & add an abstract ValueVector implementation
Date Wed, 01 Apr 2015 00:12:19 GMT
Repository: drill
Updated Branches:
  refs/heads/master 064fc0265 -> 1b0c52f91


DRILL-2280: Refactor ValueVector interface & add an abstract ValueVector implementation


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

Branch: refs/heads/master
Commit: 1b0c52f91dbe2284438e2ef7aa839cb9c6717f65
Parents: 064fc02
Author: Hanifi Gunes <hgunes@maprtech.com>
Authored: Mon Feb 23 11:17:51 2015 -0800
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Tue Mar 31 17:11:39 2015 -0700

----------------------------------------------------------------------
 .../templates/EventBasedRecordWriter.java       |   2 +-
 .../codegen/templates/FixedValueVectors.java    |  27 ++--
 .../codegen/templates/NullableValueVectors.java |  40 ++---
 .../codegen/templates/RecordValueAccessor.java  |   2 +-
 .../codegen/templates/RepeatedValueVectors.java |  21 +--
 .../templates/VariableLengthVectors.java        |  15 +-
 .../drill/exec/expr/EvaluationVisitor.java      |   2 +-
 .../parquet/columnreaders/ColumnReader.java     |   3 +-
 .../columnreaders/NullableColumnReader.java     |   7 +-
 .../exec/store/parquet2/DrillParquetReader.java |   2 +-
 .../drill/exec/vector/BaseDataValueVector.java  |   3 -
 .../drill/exec/vector/BaseValueVector.java      |  38 ++---
 .../org/apache/drill/exec/vector/BitVector.java |  12 +-
 .../apache/drill/exec/vector/ObjectVector.java  |  29 +---
 .../apache/drill/exec/vector/ValueVector.java   | 148 +++++++++++--------
 .../vector/complex/AbstractContainerVector.java |   5 +-
 .../drill/exec/vector/complex/MapVector.java    |  31 ++--
 .../exec/vector/complex/RepeatedListVector.java |  19 +--
 .../exec/vector/complex/RepeatedMapVector.java  |  19 +--
 .../complex/impl/RepeatedListReaderImpl.java    |   2 +-
 .../complex/impl/RepeatedMapReaderImpl.java     |   2 +-
 .../complex/impl/SingleListReaderImpl.java      |   2 +-
 .../complex/impl/SingleMapReaderImpl.java       |   2 +-
 .../apache/drill/exec/expr/ExpressionTest.java  |   4 +-
 .../vector/complex/writer/TestRepeated.java     |   2 +-
 25 files changed, 222 insertions(+), 217 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/codegen/templates/EventBasedRecordWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/EventBasedRecordWriter.java b/exec/java-exec/src/main/codegen/templates/EventBasedRecordWriter.java
index e76178a..797f3cb 100644
--- a/exec/java-exec/src/main/codegen/templates/EventBasedRecordWriter.java
+++ b/exec/java-exec/src/main/codegen/templates/EventBasedRecordWriter.java
@@ -73,7 +73,7 @@ public class EventBasedRecordWriter {
     try {
       int fieldId = 0;
       for (VectorWrapper w : batch) {
-        FieldReader reader = w.getValueVector().getAccessor().getReader();
+        FieldReader reader = w.getValueVector().getReader();
         FieldConverter converter = getConverter(recordWriter, fieldId++, w.getField().getLastName(), reader);
         fieldConverters.add(converter);
       }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
index b922767..f7260e7 100644
--- a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+import java.lang.Override;
+
 <@pp.dropOutputFile />
 <#list vv.types as type>
 <#list type.minor as minor>
@@ -40,7 +42,9 @@ package org.apache.drill.exec.vector;
  */
 @SuppressWarnings("unused")
 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();
 
@@ -51,6 +55,11 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
     super(field, allocator);
   }
 
+  @Override
+  public FieldReader getReader(){
+    return reader;
+  }
+
   public int getValueCapacity(){
     return (int) (data.capacity() *1.0 / ${type.width});
   }
@@ -238,14 +247,8 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
     ++allocationMonitor;
   }
 
-  public final class Accessor extends BaseValueVector.BaseAccessor{
+  public final class Accessor extends BaseDataValueVector.BaseAccessor {
 
-    final FieldReader reader = new ${minor.class}ReaderImpl(${minor.class}Vector.this);
-    
-    public FieldReader getReader(){
-      return reader;
-    }
-    
     public int getValueCount() {
       return valueCount;
     }
@@ -525,7 +528,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
   *
   * NB: this class is automatically generated from ValueVectorTypes.tdd using FreeMarker.
   */
-  public final class Mutator extends BaseValueVector.BaseMutator{
+  public final class Mutator extends BaseDataValueVector.BaseMutator {
 
     private Mutator(){};
    /**
@@ -679,8 +682,8 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
        }
      }
    }
-   
-   
+
+
 
 
    <#else> <#-- type.width <= 8 -->
@@ -729,8 +732,8 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
        }
      }
    }
-   
-   
+
+
    public void generateTestDataAlt(int size) {
      setValueCount(size);
      boolean even = true;

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
index 2ec7492..075316e 100644
--- a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import org.apache.drill.exec.vector.BaseDataValueVector;
 import org.apache.drill.exec.vector.NullableVectorDefinitionSetter;
 
 import java.lang.Override;
@@ -44,22 +45,26 @@ package org.apache.drill.exec.vector;
  * NB: this class is automatically generated from ValueVectorTypes.tdd using FreeMarker.
  */
 @SuppressWarnings("unused")
-public final class ${className} extends BaseValueVector implements <#if type.major == "VarLen">VariableWidth<#else>FixedWidth</#if>Vector, NullableVector{
+public final class ${className} extends BaseDataValueVector implements <#if type.major == "VarLen">VariableWidth<#else>FixedWidth</#if>Vector, NullableVector{
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(${className}.class);
+
+  private final FieldReader reader = new Nullable${minor.class}ReaderImpl(Nullable${minor.class}Vector.this);
 
   private int valueCount;
-  final UInt1Vector bits;
-  final ${valuesName} values;
-  private final Accessor accessor;
-  private final Mutator mutator;
+  private final UInt1Vector bits = new UInt1Vector(MaterializedField.create(field + "_bits", Types.required(MinorType.UINT1)), allocator);
+  private final ${valuesName} values = new ${minor.class}Vector(field, allocator);
+  private final Mutator mutator = new Mutator();
+  private final Accessor accessor = new Accessor();
 
   public ${className}(MaterializedField field, BufferAllocator allocator) {
     super(field, allocator);
-    this.bits = new UInt1Vector(MaterializedField.create(field + "_bits", Types.required(MinorType.UINT1)), allocator);
-    this.values = new ${minor.class}Vector(field, allocator);
-    this.accessor = new Accessor();
-    this.mutator = new Mutator();
   }
-  
+
+  @Override
+  public FieldReader getReader(){
+    return reader;
+  }
+
   public int getValueCapacity(){
     return Math.min(bits.getValueCapacity(), values.getValueCapacity());
   }
@@ -354,16 +359,11 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
   }
   </#if>
   
-  public final class Accessor implements ValueVector.Accessor<#if type.major = "VarLen">, VariableWidthVector.VariableWidthAccessor</#if>{
+  public final class Accessor extends BaseDataValueVector.BaseAccessor <#if type.major = "VarLen">implements VariableWidthVector.VariableWidthAccessor</#if> {
 
-    final FieldReader reader = new Nullable${minor.class}ReaderImpl(Nullable${minor.class}Vector.this);
     final UInt1Vector.Accessor bAccessor = bits.getAccessor();
     final ${valuesName}.Accessor vAccessor = values.getAccessor();
-    
-    public FieldReader getReader(){
-      return reader;
-    }
-    
+
     /**
      * Get the element at the specified position.
      *
@@ -440,7 +440,7 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
     public void reset(){}
   }
   
-  public final class Mutator implements ValueVector.Mutator, NullableVectorDefinitionSetter<#if type.major = "VarLen">, VariableWidthVector.VariableWidthMutator</#if> {
+  public final class Mutator extends BaseDataValueVector.BaseMutator implements NullableVectorDefinitionSetter<#if type.major = "VarLen">, VariableWidthVector.VariableWidthMutator</#if> {
     
     private int setCount;
     <#if type.major = "VarLen"> private int lastSet = -1;</#if>
@@ -613,14 +613,14 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
     public boolean noNulls(){
       return valueCount == setCount;
     }
-    
+
     public void generateTestData(int valueCount){
       bits.getMutator().generateTestDataAlt(valueCount);
       values.getMutator().generateTestData(valueCount);
       <#if type.major = "VarLen">lastSet = valueCount;</#if>
       setValueCount(valueCount);
     }
-    
+
     public void reset(){
       setCount = 0;
       <#if type.major = "VarLen">lastSet = -1;</#if>

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/codegen/templates/RecordValueAccessor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/RecordValueAccessor.java b/exec/java-exec/src/main/codegen/templates/RecordValueAccessor.java
index 4719731..b91d383 100644
--- a/exec/java-exec/src/main/codegen/templates/RecordValueAccessor.java
+++ b/exec/java-exec/src/main/codegen/templates/RecordValueAccessor.java
@@ -64,7 +64,7 @@ public class RecordValueAccessor {
 
   public void getFieldById(int fieldId, ComplexHolder holder) {
     holder.isSet = vectors[fieldId].getAccessor().isNull(currentIndex) ? 1 : 0;
-    holder.reader = (vectors[fieldId]).getAccessor().getReader();
+    holder.reader = (vectors[fieldId]).getReader();
     holder.reader.setPosition(currentIndex);
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java b/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
index ee40cc2..c7cf8e6 100644
--- a/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
@@ -48,12 +48,14 @@ package org.apache.drill.exec.vector;
  */
 
 public final class Repeated${minor.class}Vector extends BaseValueVector implements Repeated<#if type.major == "VarLen">VariableWidth<#else>FixedWidth</#if>Vector {
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Repeated${minor.class}Vector.class);
 
   private int parentValueCount;
   private int childValueCount;
 
   private final UInt4Vector offsets;   // offsets to start of each record
   private final ${minor.class}Vector values;
+  private final FieldReader reader = new Repeated${minor.class}ReaderImpl(Repeated${minor.class}Vector.this);
   private final Mutator mutator = new Mutator();
   private final Accessor accessor = new Accessor();
   
@@ -65,6 +67,11 @@ public final class Repeated${minor.class}Vector extends BaseValueVector implemen
     this.values = new ${minor.class}Vector(mf, allocator);
   }
 
+  @Override
+  public FieldReader getReader(){
+    return reader;
+  }
+
   public int getValueCapacity(){
     return Math.min(values.getValueCapacity(), offsets.getValueCapacity() - 1);
   }
@@ -305,13 +312,7 @@ public final class Repeated${minor.class}Vector extends BaseValueVector implemen
   // in the future, the interface shold be declared in the respective value vector superclasses for fixed and variable
   // and we should refer to each in the generation template
   public final class Accessor implements RepeatedFixedWidthVector.RepeatedAccessor{
-    
-    final FieldReader reader = new Repeated${minor.class}ReaderImpl(Repeated${minor.class}Vector.this);
-    
-    public FieldReader getReader(){
-      return reader;
-    }
-    
+
     /**
      * Get the elements at the given index.
      */
@@ -517,19 +518,19 @@ public final class Repeated${minor.class}Vector extends BaseValueVector implemen
       offsets.getMutator().setValueCount(groupCount == 0 ? 0 : groupCount+1);
       values.getMutator().setValueCount(childValueCount);
     }
-    
+
     public void generateTestData(final int valCount){
       int[] sizes = {1,2,0,6};
       int size = 0;
       int runningOffset = 0;
       for(int i =1; i < valCount+1; i++, size++){
         runningOffset += sizes[size % sizes.length];
-        offsets.getMutator().set(i, runningOffset);  
+        offsets.getMutator().set(i, runningOffset);
       }
       values.getMutator().generateTestData(valCount*9);
       setValueCount(size);
     }
-    
+
     public void reset(){
       
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java b/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
index 93557e2..61a2481 100644
--- a/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+import java.lang.Override;
+
 import org.apache.drill.exec.vector.BaseDataValueVector;
 import org.apache.drill.exec.vector.BaseValueVector;
 import org.apache.drill.exec.vector.VariableWidthVector;
@@ -55,6 +57,8 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
   private static final int MIN_BYTE_COUNT = 4096;
   
   private final UInt${type.width}Vector offsetVector;
+  private final FieldReader reader = new ${minor.class}ReaderImpl(${minor.class}Vector.this);
+
   private final Accessor accessor;
   private final Mutator mutator;
   
@@ -72,6 +76,11 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
     this.mutator = new Mutator();
   }
 
+  @Override
+  public FieldReader getReader(){
+    return reader;
+  }
+
   public int getBufferSize(){
     if(valueCount == 0) return 0;
     return offsetVector.getBufferSize() + data.writerIndex();
@@ -316,12 +325,8 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
   }
   
   public final class Accessor extends BaseValueVector.BaseAccessor implements VariableWidthAccessor {
-    final FieldReader reader = new ${minor.class}ReaderImpl(${minor.class}Vector.this);
     final UInt${type.width}Vector.Accessor oAccessor = offsetVector.getAccessor();
-    public FieldReader getReader(){
-      return reader;
-    }
-    
+
     public long getStartEnd(int index){
       return oAccessor.getTwoAsLong(index);
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
index c20ff14..386ab79 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
@@ -360,7 +360,7 @@ public class EvaluationVisitor {
 
       } else {
         JExpression vector = e.isSuperReader() ? vv1.component(componentVariable) : vv1;
-        JExpression expr = vector.invoke("getAccessor").invoke("getReader");
+        JExpression expr = vector.invoke("getReader");
         PathSegment seg = e.getReadPath();
 
         JVar isNull = null;

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java
index 2424fac..759327a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java
@@ -22,6 +22,7 @@ import io.netty.buffer.ByteBuf;
 import java.io.IOException;
 
 import org.apache.drill.common.exceptions.ExecutionSetupException;
+import org.apache.drill.exec.vector.BaseDataValueVector;
 import org.apache.drill.exec.vector.BaseValueVector;
 import org.apache.drill.exec.vector.ValueVector;
 
@@ -180,7 +181,7 @@ public abstract class ColumnReader<V extends ValueVector> {
     readLengthInBits = 0;
     recordsReadInThisIteration = 0;
     bytesReadInCurrentPass = 0;
-    vectorData = ((BaseValueVector) valueVec).getData();
+    vectorData = ((BaseDataValueVector) valueVec).getData();
   }
 
   public int capacity() {

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java
index c7ada6b..16519a8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java
@@ -20,6 +20,7 @@ package org.apache.drill.exec.store.parquet.columnreaders;
 import java.io.IOException;
 
 import org.apache.drill.common.exceptions.ExecutionSetupException;
+import org.apache.drill.exec.vector.BaseDataValueVector;
 import org.apache.drill.exec.vector.BaseValueVector;
 import org.apache.drill.exec.vector.NullableVectorDefinitionSetter;
 import org.apache.drill.exec.vector.ValueVector;
@@ -35,7 +36,7 @@ abstract class NullableColumnReader<V extends ValueVector> extends ColumnReader<
   int rightBitShift;
   // used when copying less than a byte worth of data at a time, to indicate the number of used bits in the current byte
   int bitsUsed;
-  BaseValueVector castedBaseVector;
+  BaseDataValueVector castedBaseVector;
   NullableVectorDefinitionSetter castedVectorMutator;
   long definitionLevelsRead;
   long totalDefinitionLevelsRead;
@@ -43,7 +44,7 @@ abstract class NullableColumnReader<V extends ValueVector> extends ColumnReader<
   NullableColumnReader(ParquetRecordReader parentReader, int allocateSize, ColumnDescriptor descriptor, ColumnChunkMetaData columnChunkMetaData,
                boolean fixedLength, V v, SchemaElement schemaElement) throws ExecutionSetupException {
     super(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, v, schemaElement);
-    castedBaseVector = (BaseValueVector) v;
+    castedBaseVector = (BaseDataValueVector) v;
     castedVectorMutator = (NullableVectorDefinitionSetter) v.getMutator();
     totalDefinitionLevelsRead = 0;
   }
@@ -114,7 +115,7 @@ abstract class NullableColumnReader<V extends ValueVector> extends ColumnReader<
         }
         valuesReadInCurrentPass += nullsFound;
 
-        int writerIndex = ((BaseValueVector) valueVec).getData().writerIndex();
+        int writerIndex = ((BaseDataValueVector) valueVec).getData().writerIndex();
         if ( dataTypeLengthInBits > 8  || (dataTypeLengthInBits < 8 && totalValuesRead + runLength % 8 == 0)){
           castedBaseVector.getData().setIndex(0, writerIndex + (int) Math.ceil( nullsFound * dataTypeLengthInBits / 8.0));
         }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java
index 9d85b67..fa78213 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java
@@ -340,7 +340,7 @@ public class DrillParquetReader extends AbstractRecordReader {
   private int getPercentFilled() {
     int filled = 0;
     for (ValueVector v : primitiveVectors) {
-      filled = Math.max(filled, ((BaseValueVector) v).getCurrentValueCount() * 100 / v.getValueCapacity());
+      filled = Math.max(filled, v.getAccessor().getValueCount() * 100 / v.getValueCapacity());
       if (v instanceof VariableWidthVector) {
         filled = Math.max(filled, ((VariableWidthVector) v).getCurrentSizeInBytes() * 100 / ((VariableWidthVector) v).getByteCapacity());
       }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java
index bc3edaa..d48ea99 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java
@@ -54,12 +54,10 @@ public abstract class BaseDataValueVector extends BaseValueVector{
     }
   }
 
-  @Override
   public void setCurrentValueCount(int count) {
     currentValueCount = count;
   }
 
-  @Override
   public int getCurrentValueCount() {
     return currentValueCount;
   }
@@ -93,7 +91,6 @@ public abstract class BaseDataValueVector extends BaseValueVector{
   @Override
   public abstract SerializedField getMetadata();
 
-  @Override
   public DrillBuf getData() {
     return data;
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java
index 18da67d..81d3a86 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java
@@ -17,27 +17,26 @@
  */
 package org.apache.drill.exec.vector;
 
-import io.netty.buffer.DrillBuf;
-
 import java.util.Iterator;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Iterators;
 import org.apache.drill.common.expression.FieldReference;
 import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 import org.apache.drill.exec.record.MaterializedField;
 
-import com.google.common.collect.Iterators;
-
-public abstract class BaseValueVector implements ValueVector{
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BaseValueVector.class);
+public abstract class BaseValueVector<V extends BaseValueVector<V, A, M>, A extends BaseValueVector.BaseAccessor,
+    M extends BaseValueVector.BaseMutator> implements ValueVector<V, A, M> {
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BaseValueVector.class);
 
   protected final BufferAllocator allocator;
   protected final MaterializedField field;
   public static final int INITIAL_VALUE_ALLOCATION = 4096;
 
-  BaseValueVector(MaterializedField field, BufferAllocator allocator) {
-    this.allocator = allocator;
+  protected BaseValueVector(MaterializedField field, BufferAllocator allocator) {
     this.field = field;
+    this.allocator = Preconditions.checkNotNull(allocator, "allocator cannot be null");
   }
 
   @Override
@@ -54,26 +53,27 @@ public abstract class BaseValueVector implements ValueVector{
     return getField().clone(ref);
   }
 
-  protected SerializedField.Builder getMetadataBuilder(){
+  protected SerializedField.Builder getMetadataBuilder() {
     return getField().getAsBuilder();
   }
 
-  public abstract int getCurrentValueCount();
-  public abstract void setCurrentValueCount(int count);
-
-  abstract public DrillBuf getData();
+  public abstract static class BaseAccessor implements ValueVector.Accessor {
+    protected BaseAccessor() { }
 
-  abstract static class BaseAccessor implements ValueVector.Accessor{
-    public abstract int getValueCount();
-    public void reset(){}
+    @Override
+    public boolean isNull(int index) {
+      return false;
+    }
   }
 
-  abstract class BaseMutator implements Mutator{
-    public void reset(){}
+  public abstract static class BaseMutator implements ValueVector.Mutator {
+    protected BaseMutator() { }
+
+    public void reset() { }
   }
 
   @Override
-  public Iterator<ValueVector> iterator() {
+  public Iterator<ValueVector<V,A,M>> iterator() {
     return Iterators.emptyIterator();
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java
index a152a0e..1558e19 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java
@@ -38,6 +38,7 @@ import org.apache.drill.exec.vector.complex.reader.FieldReader;
 public final class BitVector extends BaseDataValueVector implements FixedWidthVector {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BitVector.class);
 
+  private final FieldReader reader = new BitReaderImpl(BitVector.this);
   private final Accessor accessor = new Accessor();
   private final Mutator mutator = new Mutator();
 
@@ -49,6 +50,11 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
   }
 
   @Override
+  public FieldReader getReader() {
+    return reader;
+  }
+
+  @Override
   public SerializedField getMetadata() {
     return field.getAsBuilder() //
         .setValueCount(valueCount) //
@@ -278,6 +284,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
       return Long.bitCount(b &  (1L << bitIndex));
     }
 
+    @Override
     public boolean isNull(int index) {
       return false;
     }
@@ -300,11 +307,6 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
       holder.isSet = 1;
       holder.value = get(index);
     }
-
-    @Override
-    public FieldReader getReader() {
-      return new BitReaderImpl(BitVector.this);
-    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
index ac050e1..967f051 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
@@ -51,6 +51,11 @@ public class ObjectVector extends BaseValueVector{
     maxCount += allocationSize;
   }
 
+  @Override
+  public FieldReader getReader() {
+    throw new UnsupportedOperationException("ObjectVector does not support this");
+  }
+
   public final class Mutator implements ValueVector.Mutator {
 
     public void set(int index, Object obj) {
@@ -138,20 +143,6 @@ public class ObjectVector extends BaseValueVector{
   }
 
   @Override
-  public int getCurrentValueCount() {
-    return 0;
-  }
-
-  @Override
-  public void setCurrentValueCount(int count) {
-  }
-
-  @Override
-  public DrillBuf getData() {
-    throw new UnsupportedOperationException("ObjectVector does not support this");
-  }
-
-  @Override
   public TransferPair getTransferPair() {
     throw new UnsupportedOperationException("ObjectVector does not support this");
   }
@@ -217,16 +208,6 @@ public class ObjectVector extends BaseValueVector{
       return count;
     }
 
-    @Override
-    public boolean isNull(int index) {
-      return false;
-    }
-
-    @Override
-    public FieldReader getReader() {
-      throw new UnsupportedOperationException("ObjectVector does not support this");
-    }
-
     public Object get(int index) {
       return getObject(index);
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java
index 42e25e7..e4a0997 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java
@@ -29,24 +29,32 @@ import org.apache.drill.exec.record.TransferPair;
 import org.apache.drill.exec.vector.complex.reader.FieldReader;
 
 /**
- * ValueVectorTypes defines a set of template-generated classes which implement type-specific value vectors. The
- * template approach was chosen due to the lack of multiple inheritence. It is also important that all related logic be
- * as efficient as possible.
+ * An abstraction that is used to store a sequence of values in an individual column.
+ *
+ * A {@link ValueVector value vector} stores underlying data in-memory in a columnar fashion that is compact and
+ * efficient. The column whose data is stored, is referred by {@link #getField()}.
+ *
+ * A vector when instantiated, relies on a {@link org.apache.drill.exec.record.DeadBuf dead buffer}. It is important
+ * that vector is allocated before attempting to read or write.
+ *
+ * @param <V>  actual value vector type
+ * @param <A>  accessor type that supports reading from this vector
+ * @param <M>  mutator type that supports writing to this vector
  */
-public interface ValueVector extends Closeable, Iterable<ValueVector> {
-
+public interface ValueVector<V extends ValueVector, A extends ValueVector.Accessor, M extends ValueVector.Mutator>
+    extends Closeable, Iterable<ValueVector<V, A, M>> {
 
   /**
    * Allocate new buffers. ValueVector implements logic to determine how much to allocate.
    * @throws OutOfMemoryRuntimeException Thrown if no memory can be allocated.
    */
-  public void allocateNew() throws OutOfMemoryRuntimeException;
+  void allocateNew() throws OutOfMemoryRuntimeException;
 
   /**
    * Allocates new buffers. ValueVector implements logic to determine how much to allocate.
    * @return Returns true if allocation was succesful.
    */
-  public boolean allocateNewSafe();
+  boolean allocateNewSafe();
 
   /**
    * Set the initial record capacity
@@ -54,51 +62,69 @@ public interface ValueVector extends Closeable, Iterable<ValueVector> {
    */
   public void setInitialCapacity(int numRecords);
 
-  public int getBufferSize();
+  /**
+   * Returns the maximum number of values that can be stored in this vector instance.
+   */
+  int getValueCapacity();
 
   /**
    * Alternative to clear(). Allows use as closeable in try-with-resources.
    */
-  public void close();
+  void close();
 
   /**
    * Release the underlying DrillBuf and reset the ValueVector to empty.
    */
-  public void clear();
+  void clear();
 
   /**
    * Get information about how this field is materialized.
-   *
-   * @return
    */
-  public MaterializedField getField();
+  MaterializedField getField();
 
   /**
-   * Get a transfer pair to allow transferring this vectors data between this vector and a destination vector of the
-   * same type. Will also generate a second instance of this vector class that is connected through the TransferPair.
-   *
-   * @return
+   * Returns a {@link org.apache.drill.exec.record.TransferPair transfer pair}, creating a new target vector of
+   * the same type.
    */
-  public TransferPair getTransferPair();
+  TransferPair getTransferPair();
 
-  public TransferPair makeTransferPair(ValueVector to);
+  TransferPair getTransferPair(FieldReference ref);
 
-  public TransferPair getTransferPair(FieldReference ref);
+  /**
+   * Returns a new {@link org.apache.drill.exec.record.TransferPair transfer pair} that is used to transfer underlying
+   * buffers into the target vector.
+   */
+  TransferPair makeTransferPair(V target);
 
   /**
-   * Given the current buffer allocation, return the maximum number of values that this buffer can contain.
-   *
-   * @return Maximum values buffer can contain. In the case of a Repeated field, this is the number of atoms, not
-   *         repeated groups.
+   * Returns an {@link org.apache.drill.exec.vector.ValueVector.Accessor accessor} that is used to read from this vector
+   * instance.
    */
-  public int getValueCapacity();
+  A getAccessor();
 
   /**
-   * Get Accessor to read value vector data.
+   * Returns an {@link org.apache.drill.exec.vector.ValueVector.Mutator mutator} that is used to write to this vector
+   * instance.
+   */
+  M getMutator();
+
+  /**
+   * Returns a {@link org.apache.drill.exec.vector.complex.reader.FieldReader field reader} that supports reading values
+   * from this vector.
+   */
+  FieldReader getReader();
+
+  /**
+   * Get the metadata for this field. Used in serialization
    *
-   * @return
+   * @return FieldMetadata for this field.
+   */
+  SerializedField getMetadata();
+
+  /**
+   * Returns the number of bytes that is used by this vector instance.
    */
-  public abstract Accessor getAccessor();
+  int getBufferSize();
 
   /**
    * Return the underlying buffers associated with this vector. Note that this doesn't impact the reference counts for
@@ -108,9 +134,9 @@ public interface ValueVector extends Closeable, Iterable<ValueVector> {
    * @param clear
    *          Whether to clear vector
    *
-   * @return The underlying ByteBuf.
+   * @return The underlying {@link io.netty.buffer.DrillBuf buffers} that is used by this vector instance.
    */
-  public abstract DrillBuf[] getBuffers(boolean clear);
+  DrillBuf[] getBuffers(boolean clear);
 
   /**
    * Load the data provided in the buffer. Typically used when deserializing from the wire.
@@ -120,58 +146,54 @@ public interface ValueVector extends Closeable, Iterable<ValueVector> {
    * @param buffer
    *          The buffer that contains the ValueVector.
    */
-  public void load(SerializedField metadata, DrillBuf buffer);
+  void load(SerializedField metadata, DrillBuf buffer);
 
   /**
-   * Get the metadata for this field. Used in serialization
-   *
-   * @return FieldMetadata for this field.
-   */
-  public SerializedField getMetadata();
-
-  /**
-   * Get a Mutator to update this vectors data.
+   * An abstraction that is used to read from this vector instance.
    *
-   * @return
+   * @param <BT>  boxed value type that is stored in this vector.
    */
-  public abstract Mutator getMutator();
-
-  public interface Accessor {
-
-    // /**
-    // * Get the number of records allocated for this value vector.
-    // * @return number of allocated records
-    // */
-    // public int getRecordCount();
-
+  interface Accessor<BT> {
     /**
      * Get the Java Object representation of the element at the specified position. Useful for testing.
      *
      * @param index
      *          Index of the value to get
      */
-    public abstract Object getObject(int index);
-
-    public int getValueCount();
-
-    public boolean isNull(int index);
+    BT getObject(int index);
 
-    public void reset();
+    /**
+     * Returns the number of values that is stored in this vector.
+     */
+    int getValueCount();
 
-    public FieldReader getReader();
+    /**
+     * Returns true if the value at the given index is null, false otherwise.
+     */
+    boolean isNull(int index);
   }
 
-  public interface Mutator {
+  /**
+   * An abstractiong that is used to write into this vector instance.
+   */
+  interface Mutator {
     /**
-     * Set the top number values (optional/required) or number of value groupings (repeated) in this vector.
+     * Sets the number of values that is stored in this vector to the given value count.
      *
-     * @param valueCount
+     * @param valueCount  value count to set.
      */
-    public void setValueCount(int valueCount);
+    void setValueCount(int valueCount);
 
-    public void reset();
+    /**
+     * Resets the mutator to pristine state.
+     */
+    void reset();
 
-    public void generateTestData(int values);
+    /**
+     * @deprecated  this has nothing to do with value vector abstraction and should be removed.
+     */
+    @Deprecated
+    void generateTestData(int values);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
index acf9ec7..d14dca6 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
@@ -17,13 +17,16 @@
  */
 package org.apache.drill.exec.vector.complex;
 
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 
 import javax.annotation.Nullable;
 
 import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import org.apache.drill.common.expression.PathSegment;
 import org.apache.drill.common.types.TypeProtos.DataMode;
@@ -94,7 +97,7 @@ public abstract class AbstractContainerVector implements ValueVector {
    */
  @Override
   public void close() {
-    for (ValueVector vector:this) {
+    for (ValueVector vector:(Iterable<ValueVector>)this) {
       vector.close();
     }
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
index 54ffeb2..4138839 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
@@ -41,6 +41,7 @@ import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
 import org.apache.drill.exec.util.CallBack;
 import org.apache.drill.exec.util.JsonStringHashMap;
+import org.apache.drill.exec.vector.BaseValueVector;
 import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.exec.vector.complex.RepeatedMapVector.MapSingleCopier;
 import org.apache.drill.exec.vector.complex.impl.SingleMapReaderImpl;
@@ -66,6 +67,12 @@ public class MapVector extends AbstractMapVector {
     super(field, allocator, callBack);
   }
 
+  @Override
+  public FieldReader getReader() {
+    //return new SingleMapReaderImpl(MapVector.this);
+    return reader;
+  }
+
   transient private MapTransferPair ephPair;
   transient private MapSingleCopier ephPair2;
 
@@ -94,7 +101,7 @@ public class MapVector extends AbstractMapVector {
 
   @Override
   public void setInitialCapacity(int numRecords) {
-    for (ValueVector v : this) {
+    for (ValueVector v : (ValueVector<?,?,?>)this) {
       v.setInitialCapacity(numRecords);
     }
   }
@@ -105,7 +112,7 @@ public class MapVector extends AbstractMapVector {
       return 0;
     }
     long buffer = 0;
-    for (ValueVector v : this) {
+    for (ValueVector v : (Iterable<ValueVector>)this) {
       buffer += v.getBufferSize();
     }
 
@@ -280,7 +287,7 @@ public class MapVector extends AbstractMapVector {
     return mutator;
   }
 
-  public class Accessor implements ValueVector.Accessor{
+  public class Accessor extends BaseValueVector.BaseAccessor {
 
     @Override
     public Object getObject(int index) {
@@ -304,23 +311,13 @@ public class MapVector extends AbstractMapVector {
       return valueCount;
     }
 
-    @Override
-    public boolean isNull(int index) {
-      return false;
-    }
-
-    @Override
-    public void reset() {
-    }
+  }
 
-    @Override
-    public FieldReader getReader() {
-      //return new SingleMapReaderImpl(MapVector.this);
-      return reader;
-    }
+  public ValueVector getVectorById(int id) {
+    return getChildByOrdinal(id);
   }
 
-  public class Mutator implements ValueVector.Mutator{
+  public class Mutator extends BaseValueVector.BaseMutator {
 
     @Override
     public void setValueCount(int valueCount) {

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
index cc68181..c0f5299 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
@@ -82,6 +82,11 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
   }
 
   @Override
+  public RepeatedListReaderImpl getReader() {
+    return reader;
+  }
+
+  @Override
   public int size() {
     return vector != null ? 1 : 0;
   }
@@ -217,7 +222,7 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
       if (offset >= h.end) {
         holder.reader = NullReader.INSTANCE;
       } else {
-        FieldReader r = vector.getAccessor().getReader();
+        FieldReader r = vector.getReader();
         r.setPosition(offset);
         holder.reader = r;
       }
@@ -229,15 +234,6 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
     }
 
     @Override
-    public void reset() {
-    }
-
-    @Override
-    public FieldReader getReader() {
-      return reader;
-    }
-
-    @Override
     public int getGroupCount() {
       final int valueCount = offsets.getAccessor().getValueCount();
       return valueCount == 0 ? 0 : valueCount - 1;
@@ -416,9 +412,8 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
   @Override
   public void allocateNew(int parentValueCount, int childValueCount) {
     clear();
-    offsets.allocateNew(parentValueCount+1);
+    offsets.allocateNew(parentValueCount + 1);
     mutator.reset();
-    accessor.reset();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
index 5afc889..e5d48dd 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
@@ -73,12 +73,17 @@ public class RepeatedMapVector extends AbstractMapVector implements RepeatedFixe
 
   public void setInitialCapacity(int numRecords) {
     offsets.setInitialCapacity(numRecords + 1);
-    for(ValueVector v : this) {
+    for(ValueVector v : (ValueVector<?,?,?>)this) {
       v.setInitialCapacity(numRecords * DEFAULT_REPEAT_PER_RECORD);
     }
   }
 
   @Override
+  public RepeatedMapReaderImpl getReader() {
+    return reader;
+  }
+
+  @Override
   public void allocateNew(int groupCount, int valueCount) {
     clear();
     offsets.allocateNew(groupCount+1);
@@ -87,7 +92,6 @@ public class RepeatedMapVector extends AbstractMapVector implements RepeatedFixe
       AllocationHelper.allocatePrecomputedChildCount(v, groupCount, 50, valueCount);
     }
     mutator.reset();
-    accessor.reset();
   }
 
   public void reAlloc() {
@@ -111,7 +115,7 @@ public class RepeatedMapVector extends AbstractMapVector implements RepeatedFixe
       return 0;
     }
     long buffer = offsets.getBufferSize();
-    for (ValueVector v : this) {
+    for (ValueVector v : (Iterable<ValueVector>)this) {
       buffer += v.getBufferSize();
     }
     return (int) buffer;
@@ -506,15 +510,6 @@ public class RepeatedMapVector extends AbstractMapVector implements RepeatedFixe
     }
 
     @Override
-    public void reset() {
-    }
-
-    @Override
-    public FieldReader getReader() {
-      return reader;
-    }
-
-    @Override
     public int getGroupCount() {
       final int valueCount = offsets.getAccessor().getValueCount();
       return valueCount == 0 ? 0 : valueCount - 1;

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java
index 805ba89..3d0a861 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java
@@ -121,7 +121,7 @@ public class RepeatedListReaderImpl extends AbstractFieldReader{
   @Override
   public FieldReader reader() {
     if (reader == null) {
-      reader = container.getChild(name).getAccessor().getReader();
+      reader = container.getChild(name).getReader();
       if (currentOffset == NO_VALUES) {
         reader = NullReader.INSTANCE;
       } else {

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java
index 1cee547..aa98818 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java
@@ -54,7 +54,7 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{
       if (child == null) {
         reader = NullReader.INSTANCE;
       } else {
-        reader = child.getAccessor().getReader();
+        reader = child.getReader();
       }
       fields.put(name, reader);
       reader.setPosition(currentOffset);

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java
index 40fa6d4..60d8c4e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java
@@ -64,7 +64,7 @@ public class SingleListReaderImpl extends AbstractFieldReader{
   @Override
   public FieldReader reader() {
     if (reader == null) {
-      reader = container.getChild(name).getAccessor().getReader();
+      reader = container.getChild(name).getReader();
       setPosition(idx());
     }
     return reader;

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java
index 5c8f688..ec6009e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java
@@ -55,7 +55,7 @@ public class SingleMapReaderImpl extends AbstractFieldReader{
       if(child == null){
         reader = NullReader.INSTANCE;
       }else{
-        reader = child.getAccessor().getReader();
+        reader = child.getReader();
       }
       fields.put(name, reader);
       reader.setPosition(idx());

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java
index 2311cfd..dd14106 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java
@@ -40,6 +40,8 @@ import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.ExecTest;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
+import org.apache.drill.exec.memory.BufferAllocator;
+import org.apache.drill.exec.memory.TopLevelAllocator;
 import org.apache.drill.exec.physical.impl.project.Projector;
 import org.apache.drill.exec.record.RecordBatch;
 import org.apache.drill.exec.record.TypedFieldId;
@@ -71,7 +73,7 @@ public class ExpressionTest extends ExecTest {
         batch.getValueAccessorById(IntVector.class, tfid.getFieldIds());
         result = wrapper;
         wrapper.getValueVector();
-        result = new IntVector(null, null);
+        result = new IntVector(null, new TopLevelAllocator(0));
       }
 
     };

http://git-wip-us.apache.org/repos/asf/drill/blob/1b0c52f9/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
index feaef4d..098c7de 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
@@ -248,7 +248,7 @@ public class TestRepeated {
 
     ByteArrayOutputStream stream = new ByteArrayOutputStream();
     JsonWriter jsonWriter = new JsonWriter(stream, true);
-    FieldReader reader = v.getChild("col", MapVector.class).getAccessor().getReader();
+    FieldReader reader = v.getChild("col", MapVector.class).getReader();
     reader.setPosition(0);
     jsonWriter.write(reader);
     reader.setPosition(1);


Mime
View raw message