Search in sources :

Example 6 with AbstractMapVector

use of org.apache.drill.exec.vector.complex.AbstractMapVector in project drill by axbaretto.

the class HyperVectorWrapper method getChildWrapper.

@SuppressWarnings("resource")
@Override
public VectorWrapper<?> getChildWrapper(int[] ids) {
    if (ids.length == 1) {
        return this;
    }
    ValueVector[] vectors = new ValueVector[this.vectors.length];
    int index = 0;
    for (ValueVector v : this.vectors) {
        ValueVector vector = v;
        for (int i = 1; i < ids.length; i++) {
            final AbstractMapVector mapLike = AbstractMapVector.class.cast(vector);
            if (mapLike == null) {
                return null;
            }
            vector = mapLike.getChildByOrdinal(ids[i]);
        }
        vectors[index] = vector;
        index++;
    }
    return new HyperVectorWrapper<ValueVector>(vectors[0].getField(), vectors);
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) AbstractMapVector(org.apache.drill.exec.vector.complex.AbstractMapVector)

Example 7 with AbstractMapVector

use of org.apache.drill.exec.vector.complex.AbstractMapVector in project drill by apache.

the class BuildVectorsFromMetadata method buildMap.

/**
 * Build a map column including the members of the map given a map
 * column schema.
 *
 * @param schema the schema of the map column
 * @return the completed map vector column model
 */
private AbstractMapVector buildMap(ColumnMetadata schema) {
    // Creating the map vector will create its contained vectors if we
    // give it a materialized field with children. So, instead pass a clone
    // without children so we can add the children as we add vectors.
    final AbstractMapVector mapVector = (AbstractMapVector) TypeHelper.getNewVector(schema.emptySchema(), allocator, null);
    populateMap(mapVector, schema.tupleSchema(), false);
    return mapVector;
}
Also used : AbstractMapVector(org.apache.drill.exec.vector.complex.AbstractMapVector)

Aggregations

AbstractMapVector (org.apache.drill.exec.vector.complex.AbstractMapVector)7 ValueVector (org.apache.drill.exec.vector.ValueVector)4 ColumnMetadata (org.apache.drill.exec.record.metadata.ColumnMetadata)2 MaterializedField (org.apache.drill.exec.record.MaterializedField)1 TupleMetadata (org.apache.drill.exec.record.metadata.TupleMetadata)1 UInt4Vector (org.apache.drill.exec.vector.UInt4Vector)1 MapVector (org.apache.drill.exec.vector.complex.MapVector)1 RepeatedMapVector (org.apache.drill.exec.vector.complex.RepeatedMapVector)1