drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [09/45] drill git commit: DRILL-3987: (MOVE) Extract key vector, field reader, complex/field writer classes.
Date Fri, 13 Nov 2015 02:37:39 GMT
http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/EmptyValuePopulator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/EmptyValuePopulator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/EmptyValuePopulator.java
deleted file mode 100644
index fa1de66..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/EmptyValuePopulator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-import com.google.common.base.Preconditions;
-import org.apache.drill.exec.vector.UInt4Vector;
-
-/**
- * A helper class that is used to track and populate empty values in repeated value vectors.
- */
-public class EmptyValuePopulator {
-  private final UInt4Vector offsets;
-
-  public EmptyValuePopulator(UInt4Vector offsets) {
-    this.offsets = Preconditions.checkNotNull(offsets, "offsets cannot be null");
-  }
-
-  /**
-   * Marks all values since the last set as empty. The last set value is obtained from underlying offsets vector.
-   *
-   * @param lastIndex  the last index (inclusive) in the offsets vector until which empty population takes place
-   * @throws java.lang.IndexOutOfBoundsException  if lastIndex is negative or greater than offsets capacity.
-   */
-  public void populate(int lastIndex) {
-    if (lastIndex < 0) {
-      throw new IndexOutOfBoundsException("index cannot be negative");
-    }
-    final UInt4Vector.Accessor accessor = offsets.getAccessor();
-    final UInt4Vector.Mutator mutator = offsets.getMutator();
-    final int lastSet = Math.max(accessor.getValueCount() - 1, 0);
-    final int previousEnd = accessor.get(lastSet);//0 ? 0 : accessor.get(lastSet);
-    for (int i = lastSet; i < lastIndex; i++) {
-      mutator.setSafe(i + 1, previousEnd);
-    }
-    mutator.setValueCount(lastIndex+1);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java
deleted file mode 100644
index 468a7f3..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.exec.record.TypedFieldId;
-import org.apache.drill.exec.vector.ValueVector;
-
-public class FieldIdUtil {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FieldIdUtil.class);
-  public static TypedFieldId getFieldIdIfMatches(ValueVector vector, TypedFieldId.Builder builder, boolean addToBreadCrumb, PathSegment seg) {
-    if (seg == null) {
-      if (addToBreadCrumb) {
-        builder.intermediateType(vector.getField().getType());
-      }
-      return builder.finalType(vector.getField().getType()).build();
-    }
-
-    if (seg.isArray()) {
-      if (seg.isLastPath()) {
-        MajorType type;
-        if (vector instanceof AbstractContainerVector) {
-          type = ((AbstractContainerVector) vector).getLastPathType();
-        } else if (vector instanceof ListVector) {
-          type = ((ListVector) vector).getDataVector().getField().getType();
-          builder.listVector();
-        } else {
-          throw new UnsupportedOperationException("FieldIdUtil does not support vector of type " + vector.getField().getType());
-        }
-        builder //
-                .withIndex() //
-                .finalType(type);
-
-        // remainder starts with the 1st array segment in SchemaPath.
-        // only set remainder when it's the only array segment.
-        if (addToBreadCrumb) {
-          addToBreadCrumb = false;
-          builder.remainder(seg);
-        }
-        return builder.build();
-      } else {
-        if (addToBreadCrumb) {
-          addToBreadCrumb = false;
-          builder.remainder(seg);
-        }
-      }
-    } else {
-      if (vector instanceof ListVector) {
-        return null;
-      }
-    }
-
-    ValueVector v;
-    if (vector instanceof AbstractContainerVector) {
-      VectorWithOrdinal vord = ((AbstractContainerVector) vector).getChildVectorWithOrdinal(seg.isArray() ? null : seg.getNameSegment().getPath());
-      if (vord == null) {
-        return null;
-      }
-      v = vord.vector;
-      if (addToBreadCrumb) {
-        builder.intermediateType(v.getField().getType());
-        builder.addId(vord.ordinal);
-      }
-    } else if (vector instanceof ListVector) {
-      v = ((ListVector) vector).getDataVector();
-    } else {
-      throw new UnsupportedOperationException("FieldIdUtil does not support vector of type " + vector.getField().getType());
-    }
-
-    if (v instanceof AbstractContainerVector) {
-      // we're looking for a multi path.
-      AbstractContainerVector c = (AbstractContainerVector) v;
-      return c.getFieldIdIfMatches(builder, addToBreadCrumb, seg.getChild());
-    } else if(v instanceof ListVector) {
-      ListVector list = (ListVector) v;
-      return list.getFieldIdIfMatches(builder, addToBreadCrumb, seg.getChild());
-    } else if (v instanceof  UnionVector) {
-      return ((UnionVector) v).getFieldIdIfMatches(builder, addToBreadCrumb, seg.getChild());
-    } else {
-      if (seg.isNamed()) {
-        if(addToBreadCrumb) {
-          builder.intermediateType(v.getField().getType());
-        }
-        builder.finalType(v.getField().getType());
-      } else {
-        builder.finalType(v.getField().getType().toBuilder().setMode(DataMode.OPTIONAL).build());
-      }
-
-      if (seg.isLastPath()) {
-        return builder.build();
-      } else {
-        PathSegment child = seg.getChild();
-        if (child.isLastPath() && child.isArray()) {
-          if (addToBreadCrumb) {
-            builder.remainder(child);
-          }
-          builder.withIndex();
-          builder.finalType(v.getField().getType().toBuilder().setMode(DataMode.OPTIONAL).build());
-          return builder.build();
-        } else {
-          logger.warn("You tried to request a complex type inside a scalar object or path or type is wrong.");
-          return null;
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
deleted file mode 100644
index e5d9443..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
-
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.drill.exec.vector.complex;
-
-import com.google.common.collect.ObjectArrays;
-import io.netty.buffer.DrillBuf;
-import org.apache.drill.common.expression.FieldReference;
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
-import org.apache.drill.exec.proto.UserBitShared;
-import org.apache.drill.exec.record.MaterializedField;
-import org.apache.drill.exec.record.TransferPair;
-import org.apache.drill.exec.record.TypedFieldId;
-import org.apache.drill.exec.util.CallBack;
-import org.apache.drill.exec.util.JsonStringArrayList;
-import org.apache.drill.exec.vector.AddOrGetResult;
-import org.apache.drill.exec.vector.UInt1Vector;
-import org.apache.drill.exec.vector.UInt4Vector;
-import org.apache.drill.exec.vector.ValueVector;
-import org.apache.drill.exec.vector.VectorDescriptor;
-import org.apache.drill.exec.vector.ZeroVector;
-import org.apache.drill.exec.vector.complex.impl.ComplexCopier;
-import org.apache.drill.exec.vector.complex.impl.UnionListReader;
-import org.apache.drill.exec.vector.complex.impl.UnionListWriter;
-import org.apache.drill.exec.vector.complex.reader.FieldReader;
-import org.apache.drill.exec.vector.complex.writer.FieldWriter;
-
-import java.util.List;
-
-public class ListVector extends BaseRepeatedValueVector {
-
-  private UInt4Vector offsets;
-  private final UInt1Vector bits;
-  private Mutator mutator = new Mutator();
-  private Accessor accessor = new Accessor();
-  private UnionListWriter writer;
-  private UnionListReader reader;
-  private CallBack callBack;
-
-  public ListVector(MaterializedField field, BufferAllocator allocator, CallBack callBack) {
-    super(field, allocator);
-    this.bits = new UInt1Vector(MaterializedField.create("$bits$", Types.required(MinorType.UINT1)), allocator);
-    offsets = getOffsetVector();
-    this.field.addChild(getDataVector().getField());
-    this.writer = new UnionListWriter(this);
-    this.reader = new UnionListReader(this);
-    this.callBack = callBack;
-  }
-
-  public UnionListWriter getWriter() {
-    return writer;
-  }
-
-  @Override
-  public void allocateNew() throws OutOfMemoryRuntimeException {
-    super.allocateNewSafe();
-  }
-
-  public void transferTo(ListVector target) {
-    offsets.makeTransferPair(target.offsets).transfer();
-    bits.makeTransferPair(target.bits).transfer();
-    if (target.getDataVector() instanceof ZeroVector) {
-      target.addOrGetVector(new VectorDescriptor(vector.getField().getType()));
-    }
-    getDataVector().makeTransferPair(target.getDataVector()).transfer();
-  }
-
-  public void copyFromSafe(int inIndex, int outIndex, ListVector from) {
-    copyFrom(inIndex, outIndex, from);
-  }
-
-  public void copyFrom(int inIndex, int outIndex, ListVector from) {
-    FieldReader in = from.getReader();
-    in.setPosition(inIndex);
-    FieldWriter out = getWriter();
-    out.setPosition(outIndex);
-    ComplexCopier.copy(in, out);
-  }
-
-  @Override
-  public ValueVector getDataVector() {
-    return vector;
-  }
-
-  @Override
-  public TransferPair getTransferPair(FieldReference ref) {
-    return new TransferImpl(field.withPath(ref));
-  }
-
-  @Override
-  public TransferPair makeTransferPair(ValueVector target) {
-    return new TransferImpl((ListVector) target);
-  }
-
-  private class TransferImpl implements TransferPair {
-
-    ListVector to;
-
-    public TransferImpl(MaterializedField field) {
-      to = new ListVector(field, allocator, null);
-      to.addOrGetVector(new VectorDescriptor(vector.getField().getType()));
-    }
-
-    public TransferImpl(ListVector to) {
-      this.to = to;
-      to.addOrGetVector(new VectorDescriptor(vector.getField().getType()));
-    }
-
-    @Override
-    public void transfer() {
-      transferTo(to);
-    }
-
-    @Override
-    public void splitAndTransfer(int startIndex, int length) {
-      to.allocateNew();
-      for (int i = 0; i < length; i++) {
-        copyValueSafe(startIndex + i, i);
-      }
-    }
-
-    @Override
-    public ValueVector getTo() {
-      return to;
-    }
-
-    @Override
-    public void copyValueSafe(int from, int to) {
-      this.to.copyFrom(from, to, ListVector.this);
-    }
-  }
-
-  @Override
-  public Accessor getAccessor() {
-    return accessor;
-  }
-
-  @Override
-  public Mutator getMutator() {
-    return mutator;
-  }
-
-  @Override
-  public FieldReader getReader() {
-    return reader;
-  }
-
-  @Override
-  public boolean allocateNewSafe() {
-    /* boolean to keep track if all the memory allocation were successful
-     * Used in the case of composite vectors when we need to allocate multiple
-     * buffers for multiple vectors. If one of the allocations failed we need to
-     * clear all the memory that we allocated
-     */
-    boolean success = false;
-    try {
-      if (!offsets.allocateNewSafe()) {
-        return false;
-      }
-      success = vector.allocateNewSafe();
-      success = success && bits.allocateNewSafe();
-    } finally {
-      if (!success) {
-        clear();
-      }
-    }
-    if (success) {
-      offsets.zeroVector();
-      bits.zeroVector();
-    }
-    return success;
-  }
-
-  @Override
-  protected UserBitShared.SerializedField.Builder getMetadataBuilder() {
-    return getField().getAsBuilder()
-            .setValueCount(getAccessor().getValueCount())
-            .setBufferLength(getBufferSize())
-            .addChild(offsets.getMetadata())
-            .addChild(bits.getMetadata())
-            .addChild(vector.getMetadata());
-  }
-  public <T extends ValueVector> AddOrGetResult<T> addOrGetVector(VectorDescriptor descriptor) {
-    AddOrGetResult<T> result = super.addOrGetVector(descriptor);
-    reader = new UnionListReader(this);
-    return result;
-  }
-
-  @Override
-  public int getBufferSize() {
-    if (getAccessor().getValueCount() == 0) {
-      return 0;
-    }
-    return offsets.getBufferSize() + bits.getBufferSize() + vector.getBufferSize();
-  }
-
-  @Override
-  public void clear() {
-    offsets.clear();
-    vector.clear();
-    bits.clear();
-    lastSet = 0;
-    super.clear();
-  }
-
-  @Override
-  public DrillBuf[] getBuffers(boolean clear) {
-    final DrillBuf[] buffers = ObjectArrays.concat(offsets.getBuffers(false), ObjectArrays.concat(bits.getBuffers(false),
-            vector.getBuffers(false), DrillBuf.class), DrillBuf.class);
-    if (clear) {
-      for (DrillBuf buffer:buffers) {
-        buffer.retain();
-      }
-      clear();
-    }
-    return buffers;
-  }
-
-  @Override
-  public void load(UserBitShared.SerializedField metadata, DrillBuf buffer) {
-    final UserBitShared.SerializedField offsetMetadata = metadata.getChild(0);
-    offsets.load(offsetMetadata, buffer);
-
-    final int offsetLength = offsetMetadata.getBufferLength();
-    final UserBitShared.SerializedField bitMetadata = metadata.getChild(1);
-    final int bitLength = bitMetadata.getBufferLength();
-    bits.load(bitMetadata, buffer.slice(offsetLength, bitLength));
-
-    final UserBitShared.SerializedField vectorMetadata = metadata.getChild(2);
-    if (getDataVector() == DEFAULT_DATA_VECTOR) {
-      addOrGetVector(VectorDescriptor.create(vectorMetadata.getMajorType()));
-    }
-
-    final int vectorLength = vectorMetadata.getBufferLength();
-    vector.load(vectorMetadata, buffer.slice(offsetLength + bitLength, vectorLength));
-  }
-
-  public UnionVector promoteToUnion() {
-    MaterializedField newField = MaterializedField.create(getField().getPath(), Types.optional(MinorType.UNION));
-    UnionVector vector = new UnionVector(newField, allocator, null);
-    replaceDataVector(vector);
-    reader = new UnionListReader(this);
-    return vector;
-  }
-
-  public TypedFieldId getFieldIdIfMatches(TypedFieldId.Builder builder, boolean addToBreadCrumb, PathSegment seg) {
-    return FieldIdUtil.getFieldIdIfMatches(this, builder, addToBreadCrumb, seg);
-  }
-
-  private int lastSet;
-
-  public class Accessor extends BaseRepeatedAccessor {
-
-    @Override
-    public Object getObject(int index) {
-      if (isNull(index)) {
-        return null;
-      }
-      final List<Object> vals = new JsonStringArrayList<>();
-      final UInt4Vector.Accessor offsetsAccessor = offsets.getAccessor();
-      final int start = offsetsAccessor.get(index);
-      final int end = offsetsAccessor.get(index + 1);
-      final ValueVector.Accessor valuesAccessor = getDataVector().getAccessor();
-      for(int i = start; i < end; i++) {
-        vals.add(valuesAccessor.getObject(i));
-      }
-      return vals;
-    }
-
-    @Override
-    public boolean isNull(int index) {
-      return bits.getAccessor().get(index) == 0;
-    }
-  }
-
-  public class Mutator extends BaseRepeatedMutator {
-    public void setNotNull(int index) {
-      bits.getMutator().setSafe(index, 1);
-      lastSet = index + 1;
-    }
-
-    @Override
-    public void startNewValue(int index) {
-      for (int i = lastSet; i <= index; i++) {
-        offsets.getMutator().setSafe(i + 1, offsets.getAccessor().get(i));
-      }
-      setNotNull(index);
-      lastSet = index + 1;
-    }
-
-    @Override
-    public void setValueCount(int valueCount) {
-      // TODO: populate offset end points
-      if (valueCount == 0) {
-        offsets.getMutator().setValueCount(0);
-      } else {
-        for (int i = lastSet; i < valueCount; i++) {
-          offsets.getMutator().setSafe(i + 1, offsets.getAccessor().get(i));
-        }
-        offsets.getMutator().setValueCount(valueCount + 1);
-      }
-      final int childValueCount = valueCount == 0 ? 0 : offsets.getAccessor().get(valueCount);
-      vector.getMutator().setValueCount(childValueCount);
-      bits.getMutator().setValueCount(valueCount);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/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
deleted file mode 100644
index 048358c..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-import com.google.common.collect.Ordering;
-import com.google.common.primitives.Ints;
-
-import io.netty.buffer.DrillBuf;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.drill.common.expression.FieldReference;
-import org.apache.drill.common.expression.SchemaPath;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.expr.TypeHelper;
-import org.apache.drill.exec.expr.holders.ComplexHolder;
-import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.proto.UserBitShared.SerializedField;
-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;
-import org.apache.drill.exec.vector.complex.reader.FieldReader;
-
-import com.google.common.base.Preconditions;
-
-public class MapVector extends AbstractMapVector {
-  //private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MapVector.class);
-
-  public final static MajorType TYPE = Types.required(MinorType.MAP);
-
-  private final SingleMapReaderImpl reader = new SingleMapReaderImpl(MapVector.this);
-  private final Accessor accessor = new Accessor();
-  private final Mutator mutator = new Mutator();
-  private int valueCount;
-
-  public MapVector(String path, BufferAllocator allocator, CallBack callBack){
-    this(MaterializedField.create(SchemaPath.getSimplePath(path), TYPE), allocator, callBack);
-  }
-
-  public MapVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
-    super(field, allocator, callBack);
-  }
-
-  @Override
-  public FieldReader getReader() {
-    //return new SingleMapReaderImpl(MapVector.this);
-    return reader;
-  }
-
-  transient private MapTransferPair ephPair;
-  transient private MapSingleCopier ephPair2;
-
-  public void copyFromSafe(int fromIndex, int thisIndex, MapVector from) {
-    if(ephPair == null || ephPair.from != from) {
-      ephPair = (MapTransferPair) from.makeTransferPair(this);
-    }
-    ephPair.copyValueSafe(fromIndex, thisIndex);
-  }
-
-  public void copyFromSafe(int fromSubIndex, int thisIndex, RepeatedMapVector from) {
-    if(ephPair2 == null || ephPair2.from != from) {
-      ephPair2 = from.makeSingularCopier(this);
-    }
-    ephPair2.copySafe(fromSubIndex, thisIndex);
-  }
-
-  @Override
-  protected boolean supportsDirectRead() {
-    return true;
-  }
-
-  public Iterator<String> fieldNameIterator() {
-    return getChildFieldNames().iterator();
-  }
-
-  @Override
-  public void setInitialCapacity(int numRecords) {
-    for (final ValueVector v : (Iterable<ValueVector>) this) {
-      v.setInitialCapacity(numRecords);
-    }
-  }
-
-  @Override
-  public int getBufferSize() {
-    if (valueCount == 0 || size() == 0) {
-      return 0;
-    }
-    long buffer = 0;
-    for (final ValueVector v : (Iterable<ValueVector>)this) {
-      buffer += v.getBufferSize();
-    }
-
-    return (int) buffer;
-  }
-
-  @Override
-  public int getBufferSizeFor(final int valueCount) {
-    if (valueCount == 0) {
-      return 0;
-    }
-
-    long bufferSize = 0;
-    for (final ValueVector v : (Iterable<ValueVector>) this) {
-      bufferSize += v.getBufferSizeFor(valueCount);
-    }
-
-    return (int) bufferSize;
-  }
-
-  @Override
-  public DrillBuf[] getBuffers(boolean clear) {
-    int expectedSize = getBufferSize();
-    int actualSize   = super.getBufferSize();
-
-    Preconditions.checkArgument(expectedSize == actualSize);
-    return super.getBuffers(clear);
-  }
-
-  @Override
-  public TransferPair getTransferPair() {
-    return new MapTransferPair(this, getField().getPath());
-  }
-
-  @Override
-  public TransferPair makeTransferPair(ValueVector to) {
-    return new MapTransferPair(this, (MapVector) to);
-  }
-
-  @Override
-  public TransferPair getTransferPair(FieldReference ref) {
-    return new MapTransferPair(this, ref);
-  }
-
-  protected static class MapTransferPair implements TransferPair{
-    private final TransferPair[] pairs;
-    private final MapVector from;
-    private final MapVector to;
-
-    public MapTransferPair(MapVector from, SchemaPath path) {
-      this(from, new MapVector(MaterializedField.create(path, TYPE), from.allocator, from.callBack), false);
-    }
-
-    public MapTransferPair(MapVector from, MapVector to) {
-      this(from, to, true);
-    }
-
-    protected MapTransferPair(MapVector from, MapVector to, boolean allocate) {
-      this.from = from;
-      this.to = to;
-      this.pairs = new TransferPair[from.size()];
-      this.to.ephPair = null;
-      this.to.ephPair2 = null;
-
-      int i = 0;
-      ValueVector vector;
-      for (String child:from.getChildFieldNames()) {
-        int preSize = to.size();
-        vector = from.getChild(child);
-        if (vector == null) {
-          continue;
-        }
-        //DRILL-1872: we add the child fields for the vector, looking up the field by name. For a map vector,
-        // the child fields may be nested fields of the top level child. For example if the structure
-        // of a child field is oa.oab.oabc then we add oa, then add oab to oa then oabc to oab.
-        // But the children member of a Materialized field is a HashSet. If the fields are added in the
-        // children HashSet, and the hashCode of the Materialized field includes the hash code of the
-        // children, the hashCode value of oa changes *after* the field has been added to the HashSet.
-        // (This is similar to what happens in ScanBatch where the children cannot be added till they are
-        // read). To take care of this, we ensure that the hashCode of the MaterializedField does not
-        // include the hashCode of the children but is based only on MaterializedField$key.
-        final ValueVector newVector = to.addOrGet(child, vector.getField().getType(), vector.getClass());
-        if (allocate && to.size() != preSize) {
-          newVector.allocateNew();
-        }
-        pairs[i++] = vector.makeTransferPair(newVector);
-      }
-    }
-
-    @Override
-    public void transfer() {
-      for (final TransferPair p : pairs) {
-        p.transfer();
-      }
-      to.valueCount = from.valueCount;
-      from.clear();
-    }
-
-    @Override
-    public ValueVector getTo() {
-      return to;
-    }
-
-    @Override
-    public void copyValueSafe(int from, int to) {
-      for (TransferPair p : pairs) {
-        p.copyValueSafe(from, to);
-      }
-    }
-
-    @Override
-    public void splitAndTransfer(int startIndex, int length) {
-      for (TransferPair p : pairs) {
-        p.splitAndTransfer(startIndex, length);
-      }
-      to.getMutator().setValueCount(length);
-    }
-  }
-
-  @Override
-  public int getValueCapacity() {
-    if (size() == 0) {
-      return 0;
-    }
-
-    final Ordering<ValueVector> natural = new Ordering<ValueVector>() {
-      @Override
-      public int compare(@Nullable ValueVector left, @Nullable ValueVector right) {
-        return Ints.compare(
-            Preconditions.checkNotNull(left).getValueCapacity(),
-            Preconditions.checkNotNull(right).getValueCapacity()
-        );
-      }
-    };
-
-    return natural.min(getChildren()).getValueCapacity();
-  }
-
-  @Override
-  public Accessor getAccessor() {
-    return accessor;
-  }
-
-  @Override
-  public void load(SerializedField metadata, DrillBuf buf) {
-    final List<SerializedField> fields = metadata.getChildList();
-    valueCount = metadata.getValueCount();
-
-    int bufOffset = 0;
-    for (final SerializedField child : fields) {
-      final MaterializedField fieldDef = MaterializedField.create(child);
-
-      ValueVector vector = getChild(fieldDef.getLastName());
-      if (vector == null) {
-        // if we arrive here, we didn't have a matching vector.
-        vector = TypeHelper.getNewVector(fieldDef, allocator);
-        putChild(fieldDef.getLastName(), vector);
-      }
-      if (child.getValueCount() == 0) {
-        vector.clear();
-      } else {
-        vector.load(child, buf.slice(bufOffset, child.getBufferLength()));
-      }
-      bufOffset += child.getBufferLength();
-    }
-
-    assert bufOffset == buf.capacity();
-  }
-
-  @Override
-  public SerializedField getMetadata() {
-    SerializedField.Builder b = getField() //
-        .getAsBuilder() //
-        .setBufferLength(getBufferSize()) //
-        .setValueCount(valueCount);
-
-
-    for(ValueVector v : getChildren()) {
-      b.addChild(v.getMetadata());
-    }
-    return b.build();
-  }
-
-  @Override
-  public Mutator getMutator() {
-    return mutator;
-  }
-
-  public class Accessor extends BaseValueVector.BaseAccessor {
-
-    @Override
-    public Object getObject(int index) {
-      Map<String, Object> vv = new JsonStringHashMap<>();
-      for (String child:getChildFieldNames()) {
-        ValueVector v = getChild(child);
-        // TODO(DRILL-4001):  Resolve this hack:
-        // The index/value count check in the following if statement is a hack
-        // to work around the current fact that RecordBatchLoader.load and
-        // MapVector.load leave child vectors with a length of zero (as opposed
-        // to matching the lengths of siblings and the parent map vector)
-        // because they don't remove (or set the lengths of) vectors from
-        // previous batches that aren't in the current batch.
-        if (v != null && index < v.getAccessor().getValueCount()) {
-          Object value = v.getAccessor().getObject(index);
-          if (value != null) {
-            vv.put(child, value);
-          }
-        }
-      }
-      return vv;
-    }
-
-    public void get(int index, ComplexHolder holder) {
-      reader.setPosition(index);
-      holder.reader = reader;
-    }
-
-    @Override
-    public int getValueCount() {
-      return valueCount;
-    }
-  }
-
-  public ValueVector getVectorById(int id) {
-    return getChildByOrdinal(id);
-  }
-
-  public class Mutator extends BaseValueVector.BaseMutator {
-
-    @Override
-    public void setValueCount(int valueCount) {
-      for (final ValueVector v : getChildren()) {
-        v.getMutator().setValueCount(valueCount);
-      }
-      MapVector.this.valueCount = valueCount;
-    }
-
-    @Override
-    public void reset() { }
-
-    @Override
-    public void generateTestData(int values) { }
-  }
-
-  @Override
-  public void clear() {
-    for (final ValueVector v : getChildren()) {
-      v.clear();
-    }
-    valueCount = 0;
-  }
-
-  @Override
-  public void close() {
-    final Collection<ValueVector> vectors = getChildren();
-    for (final ValueVector v : vectors) {
-      v.close();
-    }
-    vectors.clear();
-    valueCount = 0;
-
-    super.close();
- }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/Positionable.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/Positionable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/Positionable.java
deleted file mode 100644
index 6d86a64..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/Positionable.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-public interface Positionable {
-  public void setPosition(int index);
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedFixedWidthVectorLike.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedFixedWidthVectorLike.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedFixedWidthVectorLike.java
deleted file mode 100644
index a6967f3..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedFixedWidthVectorLike.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-/**
- * A {@link org.apache.drill.exec.vector.ValueVector} mix-in that can be used in conjunction with
- * {@link RepeatedValueVector} subtypes.
- */
-public interface RepeatedFixedWidthVectorLike {
-  /**
-   * Allocate a new memory space for this vector.  Must be called prior to using the ValueVector.
-   *
-   * @param valueCount   Number of separate repeating groupings.
-   * @param innerValueCount   Number of supported values in the vector.
-   */
-  void allocateNew(int valueCount, int innerValueCount);
-
-  /**
-   * Load the records in the provided buffer based on the given number of values.
-   * @param valueCount   Number of separate repeating groupings.
-   * @param innerValueCount Number atomic values the buffer contains.
-   * @param buf Incoming buffer.
-   * @return The number of bytes of the buffer that were consumed.
-   */
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/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
deleted file mode 100644
index 330eed4..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import io.netty.buffer.DrillBuf;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.drill.common.expression.FieldReference;
-import org.apache.drill.common.expression.SchemaPath;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.expr.holders.ComplexHolder;
-import org.apache.drill.exec.expr.holders.RepeatedListHolder;
-import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
-import org.apache.drill.exec.proto.UserBitShared.SerializedField;
-import org.apache.drill.exec.record.MaterializedField;
-import org.apache.drill.exec.record.TransferPair;
-import org.apache.drill.exec.util.JsonStringArrayList;
-import org.apache.drill.exec.vector.AddOrGetResult;
-import org.apache.drill.exec.util.CallBack;
-import org.apache.drill.exec.vector.UInt4Vector;
-import org.apache.drill.exec.vector.ValueVector;
-import org.apache.drill.exec.vector.VectorDescriptor;
-import org.apache.drill.exec.vector.complex.impl.NullReader;
-import org.apache.drill.exec.vector.complex.impl.RepeatedListReaderImpl;
-import org.apache.drill.exec.vector.complex.reader.FieldReader;
-
-public class RepeatedListVector extends AbstractContainerVector
-    implements RepeatedValueVector, RepeatedFixedWidthVectorLike {
-
-  public final static MajorType TYPE = Types.repeated(MinorType.LIST);
-  private final RepeatedListReaderImpl reader = new RepeatedListReaderImpl(null, this);
-  private final DelegateRepeatedVector delegate;
-
-  protected static class DelegateRepeatedVector extends BaseRepeatedValueVector {
-
-    private final RepeatedListAccessor accessor = new RepeatedListAccessor();
-    private final RepeatedListMutator mutator = new RepeatedListMutator();
-    private final EmptyValuePopulator emptyPopulator;
-    private transient DelegateTransferPair ephPair;
-
-    public class RepeatedListAccessor extends BaseRepeatedValueVector.BaseRepeatedAccessor {
-
-      @Override
-      public Object getObject(int index) {
-        final List<Object> list = new JsonStringArrayList();
-        final int start = offsets.getAccessor().get(index);
-        final int until = offsets.getAccessor().get(index+1);
-        for (int i = start; i < until; i++) {
-          list.add(vector.getAccessor().getObject(i));
-        }
-        return list;
-      }
-
-      public void get(int index, RepeatedListHolder holder) {
-        assert index <= getValueCapacity();
-        holder.start = getOffsetVector().getAccessor().get(index);
-        holder.end = getOffsetVector().getAccessor().get(index+1);
-      }
-
-      public void get(int index, ComplexHolder holder) {
-        final FieldReader reader = getReader();
-        reader.setPosition(index);
-        holder.reader = reader;
-      }
-
-      public void get(int index, int arrayIndex, ComplexHolder holder) {
-        final RepeatedListHolder listHolder = new RepeatedListHolder();
-        get(index, listHolder);
-        int offset = listHolder.start + arrayIndex;
-        if (offset >= listHolder.end) {
-          holder.reader = NullReader.INSTANCE;
-        } else {
-          FieldReader r = getDataVector().getReader();
-          r.setPosition(offset);
-          holder.reader = r;
-        }
-      }
-    }
-
-    public class RepeatedListMutator extends BaseRepeatedValueVector.BaseRepeatedMutator {
-
-      public int add(int index) {
-        final int curEnd = getOffsetVector().getAccessor().get(index+1);
-        getOffsetVector().getMutator().setSafe(index + 1, curEnd + 1);
-        return curEnd;
-      }
-
-      @Override
-      public void startNewValue(int index) {
-        emptyPopulator.populate(index+1);
-        super.startNewValue(index);
-      }
-
-      @Override
-      public void setValueCount(int valueCount) {
-        emptyPopulator.populate(valueCount);
-        super.setValueCount(valueCount);
-      }
-    }
-
-
-    public class DelegateTransferPair implements TransferPair {
-      private final DelegateRepeatedVector target;
-      private final TransferPair[] children;
-
-      public DelegateTransferPair(DelegateRepeatedVector target) {
-        this.target = Preconditions.checkNotNull(target);
-        if (target.getDataVector() == DEFAULT_DATA_VECTOR) {
-          target.addOrGetVector(VectorDescriptor.create(getDataVector().getField()));
-          target.getDataVector().allocateNew();
-        }
-        this.children = new TransferPair[] {
-            getOffsetVector().makeTransferPair(target.getOffsetVector()),
-            getDataVector().makeTransferPair(target.getDataVector())
-        };
-      }
-
-      @Override
-      public void transfer() {
-        for (TransferPair child:children) {
-          child.transfer();
-        }
-      }
-
-      @Override
-      public ValueVector getTo() {
-        return target;
-      }
-
-      @Override
-      public void splitAndTransfer(int startIndex, int length) {
-        target.allocateNew();
-        for (int i = 0; i < length; i++) {
-          copyValueSafe(startIndex + i, i);
-        }
-      }
-
-      @Override
-      public void copyValueSafe(int srcIndex, int destIndex) {
-        final RepeatedListHolder holder = new RepeatedListHolder();
-        getAccessor().get(srcIndex, holder);
-        target.emptyPopulator.populate(destIndex+1);
-        final TransferPair vectorTransfer = children[1];
-        int newIndex = target.getOffsetVector().getAccessor().get(destIndex);
-        //todo: make this a bulk copy.
-        for (int i = holder.start; i < holder.end; i++, newIndex++) {
-          vectorTransfer.copyValueSafe(i, newIndex);
-        }
-        target.getOffsetVector().getMutator().setSafe(destIndex + 1, newIndex);
-      }
-    }
-
-    public DelegateRepeatedVector(SchemaPath path, BufferAllocator allocator) {
-      this(MaterializedField.create(path, TYPE), allocator);
-    }
-
-    public DelegateRepeatedVector(MaterializedField field, BufferAllocator allocator) {
-      super(field, allocator);
-      emptyPopulator = new EmptyValuePopulator(getOffsetVector());
-    }
-
-    @Override
-    public void allocateNew() throws OutOfMemoryRuntimeException {
-      if (!allocateNewSafe()) {
-        throw new OutOfMemoryRuntimeException();
-      }
-    }
-
-    @Override
-    public TransferPair getTransferPair(FieldReference ref) {
-      return makeTransferPair(new DelegateRepeatedVector(ref, allocator));
-    }
-
-    @Override
-    public TransferPair makeTransferPair(ValueVector target) {
-      return new DelegateTransferPair(DelegateRepeatedVector.class.cast(target));
-    }
-
-    @Override
-    public RepeatedListAccessor getAccessor() {
-      return accessor;
-    }
-
-    @Override
-    public RepeatedListMutator getMutator() {
-      return mutator;
-    }
-
-    @Override
-    public FieldReader getReader() {
-      throw new UnsupportedOperationException();
-    }
-
-    public void copyFromSafe(int fromIndex, int thisIndex, DelegateRepeatedVector from) {
-      if(ephPair == null || ephPair.target != from) {
-        ephPair = DelegateTransferPair.class.cast(from.makeTransferPair(this));
-      }
-      ephPair.copyValueSafe(fromIndex, thisIndex);
-    }
-
-  }
-
-  protected class RepeatedListTransferPair implements TransferPair {
-    private final TransferPair delegate;
-
-    public RepeatedListTransferPair(TransferPair delegate) {
-      this.delegate = delegate;
-    }
-
-    public void transfer() {
-      delegate.transfer();
-    }
-
-    @Override
-    public void splitAndTransfer(int startIndex, int length) {
-      delegate.splitAndTransfer(startIndex, length);
-    }
-
-    @Override
-    public ValueVector getTo() {
-      final DelegateRepeatedVector delegateVector = DelegateRepeatedVector.class.cast(delegate.getTo());
-      return new RepeatedListVector(getField(), allocator, callBack, delegateVector);
-    }
-
-    @Override
-    public void copyValueSafe(int from, int to) {
-      delegate.copyValueSafe(from, to);
-    }
-  }
-
-  public RepeatedListVector(SchemaPath path, BufferAllocator allocator, CallBack callBack) {
-    this(MaterializedField.create(path, TYPE), allocator, callBack);
-  }
-
-  public RepeatedListVector(MaterializedField field, BufferAllocator allocator, CallBack callBack) {
-    this(field, allocator, callBack, new DelegateRepeatedVector(field, allocator));
-  }
-
-  protected RepeatedListVector(MaterializedField field, BufferAllocator allocator, CallBack callBack, DelegateRepeatedVector delegate) {
-    super(field, allocator, callBack);
-    this.delegate = Preconditions.checkNotNull(delegate);
-
-    final List<MaterializedField> children = Lists.newArrayList(field.getChildren());
-    final int childSize = children.size();
-    assert childSize < 3;
-    final boolean hasChild = childSize > 0;
-    if (hasChild) {
-      // the last field is data field
-      final MaterializedField child = children.get(childSize-1);
-      addOrGetVector(VectorDescriptor.create(child));
-    }
-  }
-
-
-    @Override
-  public RepeatedListReaderImpl getReader() {
-    return reader;
-  }
-
-  @Override
-  public DelegateRepeatedVector.RepeatedListAccessor getAccessor() {
-    return delegate.getAccessor();
-  }
-
-  @Override
-  public DelegateRepeatedVector.RepeatedListMutator getMutator() {
-    return delegate.getMutator();
-  }
-
-  @Override
-  public UInt4Vector getOffsetVector() {
-    return delegate.getOffsetVector();
-  }
-
-  @Override
-  public ValueVector getDataVector() {
-    return delegate.getDataVector();
-  }
-
-  @Override
-  public void allocateNew() throws OutOfMemoryRuntimeException {
-    delegate.allocateNew();
-  }
-
-  @Override
-  public boolean allocateNewSafe() {
-    return delegate.allocateNewSafe();
-  }
-
-  @Override
-  public <T extends ValueVector> AddOrGetResult<T> addOrGetVector(VectorDescriptor descriptor) {
-    final AddOrGetResult<T> result = delegate.addOrGetVector(descriptor);
-    if (result.isCreated() && callBack != null) {
-      callBack.doWork();
-    }
-    return result;
-  }
-
-  @Override
-  public int size() {
-    return delegate.size();
-  }
-
-  @Override
-  public int getBufferSize() {
-    return delegate.getBufferSize();
-  }
-
-  @Override
-  public int getBufferSizeFor(final int valueCount) {
-    return delegate.getBufferSizeFor(valueCount);
-  }
-
-  @Override
-  public void close() {
-    delegate.close();
-  }
-
-  @Override
-  public void clear() {
-    delegate.clear();
-  }
-
-  @Override
-  public TransferPair getTransferPair() {
-    return new RepeatedListTransferPair(delegate.getTransferPair());
-  }
-
-  @Override
-  public TransferPair getTransferPair(FieldReference ref) {
-    return new RepeatedListTransferPair(delegate.getTransferPair(ref));
-  }
-
-  @Override
-  public TransferPair makeTransferPair(ValueVector to) {
-    final RepeatedListVector target = RepeatedListVector.class.cast(to);
-    return new RepeatedListTransferPair(delegate.makeTransferPair(target.delegate));
-  }
-
-  @Override
-  public int getValueCapacity() {
-    return delegate.getValueCapacity();
-  }
-
-  @Override
-  public DrillBuf[] getBuffers(boolean clear) {
-    return delegate.getBuffers(clear);
-  }
-
-
-  @Override
-  public void load(SerializedField metadata, DrillBuf buf) {
-    delegate.load(metadata, buf);
-  }
-
-  @Override
-  public SerializedField getMetadata() {
-    return delegate.getMetadata();
-  }
-
-  @Override
-  public Iterator<ValueVector> iterator() {
-    return delegate.iterator();
-  }
-
-  @Override
-  public void setInitialCapacity(int numRecords) {
-    delegate.setInitialCapacity(numRecords);
-  }
-
-  /**
-   * @deprecated
-   *   prefer using {@link #addOrGetVector(org.apache.drill.exec.vector.VectorDescriptor)} instead.
-   */
-  @Override
-  public <T extends ValueVector> T addOrGet(String name, MajorType type, Class<T> clazz) {
-    final AddOrGetResult<T> result = addOrGetVector(VectorDescriptor.create(type));
-    return result.getVector();
-  }
-
-  @Override
-  public <T extends ValueVector> T getChild(String name, Class<T> clazz) {
-    if (name != null) {
-      return null;
-    }
-    return typeify(delegate.getDataVector(), clazz);
-  }
-
-  @Override
-  public void allocateNew(int valueCount, int innerValueCount) {
-    clear();
-    getOffsetVector().allocateNew(valueCount + 1);
-    getMutator().reset();
-  }
-
-  @Override
-  public VectorWithOrdinal getChildVectorWithOrdinal(String name) {
-    if (name != null) {
-      return null;
-    }
-    return new VectorWithOrdinal(delegate.getDataVector(), 0);
-  }
-
-  public void copyFromSafe(int fromIndex, int thisIndex, RepeatedListVector from) {
-    delegate.copyFromSafe(fromIndex, thisIndex, from.delegate);
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/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
deleted file mode 100644
index 618e3a3..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
+++ /dev/null
@@ -1,611 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-import io.netty.buffer.DrillBuf;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.drill.common.expression.FieldReference;
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.expression.SchemaPath;
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.expr.TypeHelper;
-import org.apache.drill.exec.expr.holders.ComplexHolder;
-import org.apache.drill.exec.expr.holders.RepeatedMapHolder;
-import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
-import org.apache.drill.exec.proto.UserBitShared.SerializedField;
-import org.apache.drill.exec.record.MaterializedField;
-import org.apache.drill.exec.record.TransferPair;
-import org.apache.drill.exec.record.TypedFieldId;
-import org.apache.drill.exec.util.CallBack;
-import org.apache.drill.exec.util.JsonStringArrayList;
-import org.apache.drill.exec.vector.AddOrGetResult;
-import org.apache.drill.exec.vector.AllocationHelper;
-import org.apache.drill.exec.vector.UInt4Vector;
-import org.apache.drill.exec.vector.ValueVector;
-import org.apache.drill.exec.vector.VectorDescriptor;
-import org.apache.drill.exec.vector.complex.impl.NullReader;
-import org.apache.drill.exec.vector.complex.impl.RepeatedMapReaderImpl;
-import org.apache.drill.exec.vector.complex.reader.FieldReader;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-
-public class RepeatedMapVector extends AbstractMapVector
-    implements RepeatedValueVector, RepeatedFixedWidthVectorLike {
-  //private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RepeatedMapVector.class);
-
-  public final static MajorType TYPE = MajorType.newBuilder().setMinorType(MinorType.MAP).setMode(DataMode.REPEATED).build();
-
-  private final UInt4Vector offsets;   // offsets to start of each record (considering record indices are 0-indexed)
-  private final RepeatedMapReaderImpl reader = new RepeatedMapReaderImpl(RepeatedMapVector.this);
-  private final RepeatedMapAccessor accessor = new RepeatedMapAccessor();
-  private final Mutator mutator = new Mutator();
-  private final EmptyValuePopulator emptyPopulator;
-
-  public RepeatedMapVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
-    super(field, allocator, callBack);
-    this.offsets = new UInt4Vector(BaseRepeatedValueVector.OFFSETS_FIELD, allocator);
-    this.emptyPopulator = new EmptyValuePopulator(offsets);
-  }
-
-  @Override
-  public UInt4Vector getOffsetVector() {
-    return offsets;
-  }
-
-  @Override
-  public ValueVector getDataVector() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public <T extends ValueVector> AddOrGetResult<T> addOrGetVector(VectorDescriptor descriptor) {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public void setInitialCapacity(int numRecords) {
-    offsets.setInitialCapacity(numRecords + 1);
-    for(final ValueVector v : (Iterable<ValueVector>) this) {
-      v.setInitialCapacity(numRecords * RepeatedValueVector.DEFAULT_REPEAT_PER_RECORD);
-    }
-  }
-
-  @Override
-  public RepeatedMapReaderImpl getReader() {
-    return reader;
-  }
-
-  @Override
-  public void allocateNew(int groupCount, int innerValueCount) {
-    clear();
-    try {
-      offsets.allocateNew(groupCount + 1);
-      for (ValueVector v : getChildren()) {
-        AllocationHelper.allocatePrecomputedChildCount(v, groupCount, 50, innerValueCount);
-      }
-    } catch (OutOfMemoryRuntimeException e){
-      clear();
-      throw e;
-    }
-    offsets.zeroVector();
-    mutator.reset();
-  }
-
-  public Iterator<String> fieldNameIterator() {
-    return getChildFieldNames().iterator();
-  }
-
-  @Override
-  public List<ValueVector> getPrimitiveVectors() {
-    final List<ValueVector> primitiveVectors = super.getPrimitiveVectors();
-    primitiveVectors.add(offsets);
-    return primitiveVectors;
-  }
-
-  @Override
-  public int getBufferSize() {
-    if (getAccessor().getValueCount() == 0) {
-      return 0;
-    }
-    long bufferSize = offsets.getBufferSize();
-    for (final ValueVector v : (Iterable<ValueVector>) this) {
-      bufferSize += v.getBufferSize();
-    }
-    return (int) bufferSize;
-  }
-
-  @Override
-  public int getBufferSizeFor(final int valueCount) {
-    if (valueCount == 0) {
-      return 0;
-    }
-
-    long bufferSize = 0;
-    for (final ValueVector v : (Iterable<ValueVector>) this) {
-      bufferSize += v.getBufferSizeFor(valueCount);
-    }
-
-    return (int) bufferSize;
-  }
-
-  @Override
-  public void close() {
-    offsets.close();
-    super.close();
-  }
-
-  @Override
-  public TransferPair getTransferPair() {
-    return new RepeatedMapTransferPair(this, getField().getPath());
-  }
-
-  @Override
-  public TransferPair makeTransferPair(ValueVector to) {
-    return new RepeatedMapTransferPair(this, (RepeatedMapVector)to);
-  }
-
-  MapSingleCopier makeSingularCopier(MapVector to) {
-    return new MapSingleCopier(this, to);
-  }
-
-  protected static class MapSingleCopier {
-    private final TransferPair[] pairs;
-    public final RepeatedMapVector from;
-
-    public MapSingleCopier(RepeatedMapVector from, MapVector to) {
-      this.from = from;
-      this.pairs = new TransferPair[from.size()];
-
-      int i = 0;
-      ValueVector vector;
-      for (final String child:from.getChildFieldNames()) {
-        int preSize = to.size();
-        vector = from.getChild(child);
-        if (vector == null) {
-          continue;
-        }
-        final ValueVector newVector = to.addOrGet(child, vector.getField().getType(), vector.getClass());
-        if (to.size() != preSize) {
-          newVector.allocateNew();
-        }
-        pairs[i++] = vector.makeTransferPair(newVector);
-      }
-    }
-
-    public void copySafe(int fromSubIndex, int toIndex) {
-      for (TransferPair p : pairs) {
-        p.copyValueSafe(fromSubIndex, toIndex);
-      }
-    }
-  }
-
-  @Override
-  public TypedFieldId getFieldIdIfMatches(TypedFieldId.Builder builder, boolean addToBreadCrumb, PathSegment seg) {
-    if (seg != null && seg.isArray() && !seg.isLastPath()) {
-      if (addToBreadCrumb) {
-        addToBreadCrumb = false;
-        builder.remainder(seg);
-      }
-      // skip the first array segment as there is no corresponding child vector.
-      seg = seg.getChild();
-
-      // multi-level numbered access to a repeated map is not possible so return if the next part is also an array
-      // segment.
-      if (seg.isArray()) {
-        return null;
-      }
-    }
-
-    return super.getFieldIdIfMatches(builder, addToBreadCrumb, seg);
-  }
-
-  public TransferPair getTransferPairToSingleMap(FieldReference reference) {
-    return new SingleMapTransferPair(this, reference);
-  }
-
-  @Override
-  public TransferPair getTransferPair(FieldReference ref) {
-    return new RepeatedMapTransferPair(this, ref);
-  }
-
-  @Override
-  public boolean allocateNewSafe() {
-    /* boolean to keep track if all the memory allocation were successful
-     * Used in the case of composite vectors when we need to allocate multiple
-     * buffers for multiple vectors. If one of the allocations failed we need to
-     * clear all the memory that we allocated
-     */
-    boolean success = false;
-    try {
-      if (!offsets.allocateNewSafe()) {
-        return false;
-      }
-      success =  super.allocateNewSafe();
-    } finally {
-      if (!success) {
-        clear();
-      }
-    }
-    offsets.zeroVector();
-    return success;
-  }
-
-  protected static class SingleMapTransferPair implements TransferPair {
-    private final TransferPair[] pairs;
-    private final RepeatedMapVector from;
-    private final MapVector to;
-    private static final MajorType MAP_TYPE = Types.required(MinorType.MAP);
-
-    public SingleMapTransferPair(RepeatedMapVector from, SchemaPath path) {
-      this(from, new MapVector(MaterializedField.create(path, MAP_TYPE), from.allocator, from.callBack), false);
-    }
-
-    public SingleMapTransferPair(RepeatedMapVector from, MapVector to) {
-      this(from, to, true);
-    }
-
-    public SingleMapTransferPair(RepeatedMapVector from, MapVector to, boolean allocate) {
-      this.from = from;
-      this.to = to;
-      this.pairs = new TransferPair[from.size()];
-      int i = 0;
-      ValueVector vector;
-      for (final String child : from.getChildFieldNames()) {
-        int preSize = to.size();
-        vector = from.getChild(child);
-        if (vector == null) {
-          continue;
-        }
-        final ValueVector newVector = to.addOrGet(child, vector.getField().getType(), vector.getClass());
-        if (allocate && to.size() != preSize) {
-          newVector.allocateNew();
-        }
-        pairs[i++] = vector.makeTransferPair(newVector);
-      }
-    }
-
-
-    @Override
-    public void transfer() {
-      for (TransferPair p : pairs) {
-        p.transfer();
-      }
-      to.getMutator().setValueCount(from.getAccessor().getValueCount());
-      from.clear();
-    }
-
-    @Override
-    public ValueVector getTo() {
-      return to;
-    }
-
-    @Override
-    public void copyValueSafe(int from, int to) {
-      for (TransferPair p : pairs) {
-        p.copyValueSafe(from, to);
-      }
-    }
-
-    @Override
-    public void splitAndTransfer(int startIndex, int length) {
-      for (TransferPair p : pairs) {
-        p.splitAndTransfer(startIndex, length);
-      }
-      to.getMutator().setValueCount(length);
-    }
-  }
-
-  private static class RepeatedMapTransferPair implements TransferPair{
-
-    private final TransferPair[] pairs;
-    private final RepeatedMapVector to;
-    private final RepeatedMapVector from;
-
-    public RepeatedMapTransferPair(RepeatedMapVector from, SchemaPath path) {
-      this(from, new RepeatedMapVector(MaterializedField.create(path, TYPE), from.allocator, from.callBack), false);
-    }
-
-    public RepeatedMapTransferPair(RepeatedMapVector from, RepeatedMapVector to) {
-      this(from, to, true);
-    }
-
-    public RepeatedMapTransferPair(RepeatedMapVector from, RepeatedMapVector to, boolean allocate) {
-      this.from = from;
-      this.to = to;
-      this.pairs = new TransferPair[from.size()];
-      this.to.ephPair = null;
-
-      int i = 0;
-      ValueVector vector;
-      for (final String child : from.getChildFieldNames()) {
-        final int preSize = to.size();
-        vector = from.getChild(child);
-        if (vector == null) {
-          continue;
-        }
-
-        final ValueVector newVector = to.addOrGet(child, vector.getField().getType(), vector.getClass());
-        if (to.size() != preSize) {
-          newVector.allocateNew();
-        }
-
-        pairs[i++] = vector.makeTransferPair(newVector);
-      }
-    }
-
-    @Override
-    public void transfer() {
-      from.offsets.transferTo(to.offsets);
-      for (TransferPair p : pairs) {
-        p.transfer();
-      }
-      from.clear();
-    }
-
-    @Override
-    public ValueVector getTo() {
-      return to;
-    }
-
-    @Override
-    public void copyValueSafe(int srcIndex, int destIndex) {
-      RepeatedMapHolder holder = new RepeatedMapHolder();
-      from.getAccessor().get(srcIndex, holder);
-      to.emptyPopulator.populate(destIndex + 1);
-      int newIndex = to.offsets.getAccessor().get(destIndex);
-      //todo: make these bulk copies
-      for (int i = holder.start; i < holder.end; i++, newIndex++) {
-        for (TransferPair p : pairs) {
-          p.copyValueSafe(i, newIndex);
-        }
-      }
-      to.offsets.getMutator().setSafe(destIndex + 1, newIndex);
-    }
-
-    @Override
-    public void splitAndTransfer(final int groupStart, final int groups) {
-      final UInt4Vector.Accessor a = from.offsets.getAccessor();
-      final UInt4Vector.Mutator m = to.offsets.getMutator();
-
-      final int startPos = a.get(groupStart);
-      final int endPos = a.get(groupStart + groups);
-      final int valuesToCopy = endPos - startPos;
-
-      to.offsets.clear();
-      to.offsets.allocateNew(groups + 1);
-
-      int normalizedPos;
-      for (int i = 0; i < groups + 1; i++) {
-        normalizedPos = a.get(groupStart + i) - startPos;
-        m.set(i, normalizedPos);
-      }
-
-      m.setValueCount(groups + 1);
-      to.emptyPopulator.populate(groups);
-
-      for (final TransferPair p : pairs) {
-        p.splitAndTransfer(startPos, valuesToCopy);
-      }
-    }
-  }
-
-
-  transient private RepeatedMapTransferPair ephPair;
-
-  public void copyFromSafe(int fromIndex, int thisIndex, RepeatedMapVector from) {
-    if (ephPair == null || ephPair.from != from) {
-      ephPair = (RepeatedMapTransferPair) from.makeTransferPair(this);
-    }
-    ephPair.copyValueSafe(fromIndex, thisIndex);
-  }
-
-  @Override
-  public int getValueCapacity() {
-    return Math.max(offsets.getValueCapacity() - 1, 0);
-  }
-
-  @Override
-  public RepeatedMapAccessor getAccessor() {
-    return accessor;
-  }
-
-  @Override
-  public DrillBuf[] getBuffers(boolean clear) {
-    final int expectedBufferSize = getBufferSize();
-    final int actualBufferSize = super.getBufferSize();
-
-    Preconditions.checkArgument(expectedBufferSize == actualBufferSize + offsets.getBufferSize());
-    return ArrayUtils.addAll(offsets.getBuffers(clear), super.getBuffers(clear));
-  }
-
-
-  @Override
-  public void load(SerializedField metadata, DrillBuf buffer) {
-    final List<SerializedField> children = metadata.getChildList();
-
-    final SerializedField offsetField = children.get(0);
-    offsets.load(offsetField, buffer);
-    int bufOffset = offsetField.getBufferLength();
-
-    for (int i = 1; i < children.size(); i++) {
-      final SerializedField child = children.get(i);
-      final MaterializedField fieldDef = MaterializedField.create(child);
-      ValueVector vector = getChild(fieldDef.getLastName());
-      if (vector == null) {
-        // if we arrive here, we didn't have a matching vector.
-        vector = TypeHelper.getNewVector(fieldDef, allocator);
-        putChild(fieldDef.getLastName(), vector);
-      }
-      final int vectorLength = child.getBufferLength();
-      vector.load(child, buffer.slice(bufOffset, vectorLength));
-      bufOffset += vectorLength;
-    }
-
-    assert bufOffset == buffer.capacity();
-  }
-
-
-  @Override
-  public SerializedField getMetadata() {
-    SerializedField.Builder builder = getField() //
-        .getAsBuilder() //
-        .setBufferLength(getBufferSize()) //
-        // while we don't need to actually read this on load, we need it to make sure we don't skip deserialization of this vector
-        .setValueCount(accessor.getValueCount());
-    builder.addChild(offsets.getMetadata());
-    for (final ValueVector child : getChildren()) {
-      builder.addChild(child.getMetadata());
-    }
-    return builder.build();
-  }
-
-  @Override
-  public Mutator getMutator() {
-    return mutator;
-  }
-
-  public class RepeatedMapAccessor implements RepeatedAccessor {
-    @Override
-    public Object getObject(int index) {
-      final List<Object> list = new JsonStringArrayList<>();
-      final int end = offsets.getAccessor().get(index+1);
-      String fieldName;
-      for (int i =  offsets.getAccessor().get(index); i < end; i++) {
-        final Map<String, Object> vv = Maps.newLinkedHashMap();
-        for (final MaterializedField field : getField().getChildren()) {
-          if (!field.equals(BaseRepeatedValueVector.OFFSETS_FIELD)) {
-            fieldName = field.getLastName();
-            final Object value = getChild(fieldName).getAccessor().getObject(i);
-            if (value != null) {
-              vv.put(fieldName, value);
-            }
-          }
-        }
-        list.add(vv);
-      }
-      return list;
-    }
-
-    @Override
-    public int getValueCount() {
-      return Math.max(offsets.getAccessor().getValueCount() - 1, 0);
-    }
-
-    @Override
-    public int getInnerValueCount() {
-      final int valueCount = getValueCount();
-      if (valueCount == 0) {
-        return 0;
-      }
-      return offsets.getAccessor().get(valueCount);
-    }
-
-    @Override
-    public int getInnerValueCountAt(int index) {
-      return offsets.getAccessor().get(index+1) - offsets.getAccessor().get(index);
-    }
-
-    @Override
-    public boolean isEmpty(int index) {
-      return false;
-    }
-
-    @Override
-    public boolean isNull(int index) {
-      return false;
-    }
-
-    public void get(int index, RepeatedMapHolder holder) {
-      assert index < getValueCapacity() :
-        String.format("Attempted to access index %d when value capacity is %d",
-            index, getValueCapacity());
-      final UInt4Vector.Accessor offsetsAccessor = offsets.getAccessor();
-      holder.start = offsetsAccessor.get(index);
-      holder.end = offsetsAccessor.get(index + 1);
-    }
-
-    public void get(int index, ComplexHolder holder) {
-      final FieldReader reader = getReader();
-      reader.setPosition(index);
-      holder.reader = reader;
-    }
-
-    public void get(int index, int arrayIndex, ComplexHolder holder) {
-      final RepeatedMapHolder h = new RepeatedMapHolder();
-      get(index, h);
-      final int offset = h.start + arrayIndex;
-
-      if (offset >= h.end) {
-        holder.reader = NullReader.INSTANCE;
-      } else {
-        reader.setSinglePosition(index, arrayIndex);
-        holder.reader = reader;
-      }
-    }
-  }
-
-  public class Mutator implements RepeatedMutator {
-    @Override
-    public void startNewValue(int index) {
-      emptyPopulator.populate(index + 1);
-      offsets.getMutator().setSafe(index + 1, offsets.getAccessor().get(index));
-    }
-
-    @Override
-    public void setValueCount(int topLevelValueCount) {
-      emptyPopulator.populate(topLevelValueCount);
-      offsets.getMutator().setValueCount(topLevelValueCount == 0 ? 0 : topLevelValueCount + 1);
-      int childValueCount = offsets.getAccessor().get(topLevelValueCount);
-      for (final ValueVector v : getChildren()) {
-        v.getMutator().setValueCount(childValueCount);
-      }
-    }
-
-    @Override
-    public void reset() {}
-
-    @Override
-    public void generateTestData(int values) {}
-
-    public int add(int index) {
-      final int prevEnd = offsets.getAccessor().get(index + 1);
-      offsets.getMutator().setSafe(index + 1, prevEnd + 1);
-      return prevEnd;
-    }
-  }
-
-  @Override
-  public void clear() {
-    getMutator().reset();
-
-    offsets.clear();
-    for(final ValueVector vector : getChildren()) {
-      vector.clear();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedValueVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedValueVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedValueVector.java
deleted file mode 100644
index 0fba292..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedValueVector.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-import org.apache.drill.exec.vector.UInt4Vector;
-import org.apache.drill.exec.vector.ValueVector;
-import org.apache.drill.exec.vector.complex.ContainerVectorLike;
-
-/**
- * An abstraction representing repeated value vectors.
- *
- * A repeated vector contains values that may either be flat or nested. A value consists of zero or more cells(inner values).
- * Current design maintains data and offsets vectors. Each cell is stored in the data vector. Repeated vector
- * uses the offset vector to determine the sequence of cells pertaining to an individual value.
- *
- */
-public interface RepeatedValueVector extends ValueVector, ContainerVectorLike {
-
-  final static int DEFAULT_REPEAT_PER_RECORD = 5;
-
-  /**
-   * Returns the underlying offset vector or null if none exists.
-   *
-   * TODO(DRILL-2995): eliminate exposing low-level interfaces.
-   */
-  UInt4Vector getOffsetVector();
-
-  /**
-   * Returns the underlying data vector or null if none exists.
-   */
-  ValueVector getDataVector();
-
-  @Override
-  RepeatedAccessor getAccessor();
-
-  @Override
-  RepeatedMutator getMutator();
-
-  interface RepeatedAccessor extends ValueVector.Accessor {
-    /**
-     * Returns total number of cells that vector contains.
-     *
-     * The result includes empty, null valued cells.
-     */
-    int getInnerValueCount();
-
-
-    /**
-     * Returns number of cells that the value at the given index contains.
-     */
-    int getInnerValueCountAt(int index);
-
-    /**
-     * Returns true if the value at the given index is empty, false otherwise.
-     *
-     * @param index  value index
-     */
-    boolean isEmpty(int index);
-  }
-
-  interface RepeatedMutator extends ValueVector.Mutator {
-    /**
-     * Starts a new value that is a container of cells.
-     *
-     * @param index  index of new value to start
-     */
-    void startNewValue(int index);
-
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedVariableWidthVectorLike.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedVariableWidthVectorLike.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedVariableWidthVectorLike.java
deleted file mode 100644
index 67954e7..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedVariableWidthVectorLike.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-public interface RepeatedVariableWidthVectorLike {
-  /**
-   * Allocate a new memory space for this vector.  Must be called prior to using the ValueVector.
-   *
-   * @param totalBytes   Desired size of the underlying data buffer.
-   * @param parentValueCount   Number of separate repeating groupings.
-   * @param childValueCount   Number of supported values in the vector.
-   */
-  void allocateNew(int totalBytes, int parentValueCount, int childValueCount);
-
-  /**
-   * Provide the maximum amount of variable width bytes that can be stored int his vector.
-   * @return
-   */
-  int getByteCapacity();
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/StateTool.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/StateTool.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/StateTool.java
deleted file mode 100644
index f5ed3a0..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/StateTool.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-import java.util.Arrays;
-
-public class StateTool {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StateTool.class);
-
-  public static <T extends Enum<?>> void check(T currentState, T... expectedStates) {
-    for (T s : expectedStates) {
-      if (s == currentState) {
-        return;
-      }
-    }
-    throw new IllegalArgumentException(String.format("Expected to be in one of these states %s but was actuall in state %s", Arrays.toString(expectedStates), currentState));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/VectorWithOrdinal.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/VectorWithOrdinal.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/VectorWithOrdinal.java
deleted file mode 100644
index a0c8dd8..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/VectorWithOrdinal.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex;
-
-import org.apache.drill.exec.vector.ValueVector;
-
-public class VectorWithOrdinal {
-  public final ValueVector vector;
-  public final int ordinal;
-
-  public VectorWithOrdinal(ValueVector v, int ordinal) {
-    this.vector = v;
-    this.ordinal = ordinal;
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseReader.java
deleted file mode 100644
index 05fe63f..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseReader.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex.impl;
-
-import java.util.Iterator;
-
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.expr.holders.UnionHolder;
-import org.apache.drill.exec.record.MaterializedField;
-import org.apache.drill.exec.vector.complex.reader.FieldReader;
-import org.apache.drill.exec.vector.complex.writer.BaseWriter.ListWriter;
-import org.apache.drill.exec.vector.complex.writer.FieldWriter;
-
-
-abstract class AbstractBaseReader implements FieldReader{
-
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractBaseReader.class);
-
-  private int index;
-
-  public AbstractBaseReader() {
-    super();
-  }
-
-  public void setPosition(int index){
-    this.index = index;
-  }
-
-  int idx(){
-    return index;
-  }
-
-  @Override
-  public void reset() {
-    index = 0;
-  }
-
-  @Override
-  public Iterator<String> iterator() {
-    throw new IllegalStateException("The current reader doesn't support reading as a map.");
-  }
-
-  public MajorType getType(){
-    throw new IllegalStateException("The current reader doesn't support getting type information.");
-  }
-
-  @Override
-  public MaterializedField getField() {
-    return MaterializedField.create("unknown", Types.LATE_BIND_TYPE);
-  }
-
-  @Override
-  public boolean next() {
-    throw new IllegalStateException("The current reader doesn't support getting next information.");
-  }
-
-  @Override
-  public int size() {
-    throw new IllegalStateException("The current reader doesn't support getting size information.");
-  }
-
-  @Override
-  public void read(UnionHolder holder) {
-    holder.reader = this;
-    holder.isSet = this.isSet() ? 1 : 0;
-  }
-
-  @Override
-  public void read(int index, UnionHolder holder) {
-    throw new IllegalStateException("The current reader doesn't support reading union type");
-  }
-
-  @Override
-  public void copyAsValue(UnionWriter writer) {
-    throw new IllegalStateException("The current reader doesn't support reading union type");
-  }
-
-  @Override
-  public void copyAsValue(ListWriter writer) {
-    ComplexCopier.copy(this, (FieldWriter)writer);
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/9969d8bd/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseWriter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseWriter.java
deleted file mode 100644
index bd16223..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseWriter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.vector.complex.impl;
-
-import org.apache.drill.exec.vector.complex.writer.FieldWriter;
-
-
-abstract class AbstractBaseWriter implements FieldWriter {
-  //private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractBaseWriter.class);
-
-  final FieldWriter parent;
-  private int index;
-
-  public AbstractBaseWriter(FieldWriter parent) {
-    this.parent = parent;
-  }
-
-  @Override
-  public String toString() {
-    return super.toString() + "[index = " + index + ", parent = " + parent + "]";
-  }
-
-  @Override
-  public FieldWriter getParent() {
-    return parent;
-  }
-
-  public boolean isRoot() {
-    return parent == null;
-  }
-
-  int idx() {
-    return index;
-  }
-
-  @Override
-  public void setPosition(int index) {
-    this.index = index;
-  }
-
-  @Override
-  public void end() {
-  }
-}


Mime
View raw message