Search in sources :

Example 51 with ValueVector

use of org.apache.drill.exec.vector.ValueVector in project drill by apache.

the class FrameSupportTemplate method allocateInternal.

private void allocateInternal() {
    for (VectorWrapper<?> w : container) {
        ValueVector vv = internal.addOrGet(w.getField());
        vv.allocateNew();
    }
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) BaseDataValueVector(org.apache.drill.exec.vector.BaseDataValueVector)

Example 52 with ValueVector

use of org.apache.drill.exec.vector.ValueVector in project drill by apache.

the class HyperVectorWrapper method getChildWrapper.

@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 53 with ValueVector

use of org.apache.drill.exec.vector.ValueVector in project drill by apache.

the class SimpleVectorWrapper method getChildWrapper.

@SuppressWarnings("resource")
@Override
public VectorWrapper<?> getChildWrapper(int[] ids) {
    if (ids.length == 1) {
        return this;
    }
    ValueVector vector = this.vector;
    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]);
    }
    return new SimpleVectorWrapper<>(vector);
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) AbstractMapVector(org.apache.drill.exec.vector.complex.AbstractMapVector)

Example 54 with ValueVector

use of org.apache.drill.exec.vector.ValueVector in project drill by apache.

the class VectorAccessibleComplexWriter method addOrGet.

@Override
public <T extends ValueVector> T addOrGet(String name, MajorType type, Class<T> clazz) {
    final ValueVector v = vc.addOrGet(name, type, clazz);
    putChild(name, v);
    return this.typeify(v, clazz);
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector)

Example 55 with ValueVector

use of org.apache.drill.exec.vector.ValueVector in project drill by apache.

the class VectorContainer method addOrGet.

@SuppressWarnings({ "resource", "unchecked" })
public <T extends ValueVector> T addOrGet(final MaterializedField field, final SchemaChangeCallBack callBack) {
    final TypedFieldId id = getValueVectorId(SchemaPath.getSimplePath(field.getPath()));
    final ValueVector vector;
    final Class<?> clazz = TypeHelper.getValueVectorClass(field.getType().getMinorType(), field.getType().getMode());
    if (id != null) {
        vector = getValueAccessorById(id.getFieldIds()).getValueVector();
        if (id.getFieldIds().length == 1 && clazz != null && !clazz.isAssignableFrom(vector.getClass())) {
            final ValueVector newVector = TypeHelper.getNewVector(field, this.getAllocator(), callBack);
            replace(vector, newVector);
            return (T) newVector;
        }
    } else {
        vector = TypeHelper.getNewVector(field, this.getAllocator(), callBack);
        add(vector);
    }
    return (T) vector;
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector)

Aggregations

ValueVector (org.apache.drill.exec.vector.ValueVector)130 MaterializedField (org.apache.drill.exec.record.MaterializedField)29 Test (org.junit.Test)21 SchemaChangeException (org.apache.drill.exec.exception.SchemaChangeException)18 RecordBatchLoader (org.apache.drill.exec.record.RecordBatchLoader)13 VectorWrapper (org.apache.drill.exec.record.VectorWrapper)13 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)12 ExecTest (org.apache.drill.exec.ExecTest)11 IOException (java.io.IOException)10 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)10 VectorContainer (org.apache.drill.exec.record.VectorContainer)10 Drillbit (org.apache.drill.exec.server.Drillbit)10 ErrorCollector (org.apache.drill.common.expression.ErrorCollector)9 ErrorCollectorImpl (org.apache.drill.common.expression.ErrorCollectorImpl)9 RemoteServiceSet (org.apache.drill.exec.server.RemoteServiceSet)9 SchemaPath (org.apache.drill.common.expression.SchemaPath)8 MajorType (org.apache.drill.common.types.TypeProtos.MajorType)8 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)8 FragmentContext (org.apache.drill.exec.ops.FragmentContext)8 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)8