Search in sources :

Example 1 with AbstractObjectReader

use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by axbaretto.

the class BaseReaderBuilder method buildMap.

private List<AbstractObjectReader> buildMap(HyperVectorWrapper<? extends AbstractMapVector> vectors, VectorDescrip descrip) {
    List<AbstractObjectReader> readers = new ArrayList<>();
    MetadataProvider provider = descrip.parent.childProvider(descrip.metadata);
    MaterializedField mapField = vectors.getField();
    for (int i = 0; i < mapField.getChildren().size(); i++) {
        HyperVectorWrapper<? extends ValueVector> child = (HyperVectorWrapper<? extends ValueVector>) vectors.getChildWrapper(new int[] { i });
        VectorDescrip childDescrip = new VectorDescrip(provider, i, child.getField());
        readers.add(buildVectorReader(child, childDescrip));
        i++;
    }
    return readers;
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) MetadataProvider(org.apache.drill.exec.physical.rowSet.model.MetadataProvider) ArrayList(java.util.ArrayList) MaterializedField(org.apache.drill.exec.record.MaterializedField) HyperVectorWrapper(org.apache.drill.exec.record.HyperVectorWrapper) VectorDescrip(org.apache.drill.exec.physical.rowSet.model.MetadataProvider.VectorDescrip)

Example 2 with AbstractObjectReader

use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by axbaretto.

the class BaseReaderBuilder method buildContainerChildren.

protected AbstractObjectReader[] buildContainerChildren(VectorContainer container, MetadataProvider mdProvider) {
    List<AbstractObjectReader> readers = new ArrayList<>();
    for (int i = 0; i < container.getNumberOfColumns(); i++) {
        VectorWrapper<?> vw = container.getValueVector(i);
        VectorDescrip descrip = new VectorDescrip(mdProvider, i, vw.getField());
        readers.add(buildVectorReader(vw, descrip));
    }
    return readers.toArray(new AbstractObjectReader[readers.size()]);
}
Also used : AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) ArrayList(java.util.ArrayList) VectorDescrip(org.apache.drill.exec.physical.rowSet.model.MetadataProvider.VectorDescrip)

Example 3 with AbstractObjectReader

use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by axbaretto.

the class BaseReaderBuilder method buildMap.

private List<AbstractObjectReader> buildMap(AbstractMapVector vector, VectorDescrip descrip) {
    List<AbstractObjectReader> readers = new ArrayList<>();
    MetadataProvider provider = descrip.parent.childProvider(descrip.metadata);
    int i = 0;
    for (ValueVector child : vector) {
        VectorDescrip childDescrip = new VectorDescrip(provider, i, child.getField());
        readers.add(buildVectorReader(child, childDescrip));
        i++;
    }
    return readers;
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) MetadataProvider(org.apache.drill.exec.physical.rowSet.model.MetadataProvider) ArrayList(java.util.ArrayList) VectorDescrip(org.apache.drill.exec.physical.rowSet.model.MetadataProvider.VectorDescrip)

Example 4 with AbstractObjectReader

use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by apache.

the class SimpleReaderBuilder method build.

public static RowSetReaderImpl build(VectorContainer container, ReaderIndex rowIndex) {
    MetadataCreator mdCreator = new MetadataCreator();
    List<AbstractObjectReader> children = INSTANCE.buildContainerChildren(container, mdCreator);
    return new RowSetReaderImpl(mdCreator.tuple(), rowIndex, children);
}
Also used : AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) RowSetReaderImpl(org.apache.drill.exec.physical.rowSet.RowSetReaderImpl) MetadataCreator(org.apache.drill.exec.physical.resultSet.model.MetadataProvider.MetadataCreator)

Example 5 with AbstractObjectReader

use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by apache.

the class HyperReaderBuilder method buildMap.

private AbstractObjectReader buildMap(VectorAccessor va, DataMode mode, ColumnMetadata metadata) {
    boolean isArray = mode == DataMode.REPEATED;
    // Map type
    AbstractObjectReader mapReader = MapReader.build(metadata, isArray ? null : va, buildMapMembers(va, metadata.tupleSchema()));
    if (!isArray) {
        return mapReader;
    }
    return ArrayReaderImpl.buildTuple(metadata, va, mapReader);
}
Also used : AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader)

Aggregations

AbstractObjectReader (org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader)16 ArrayList (java.util.ArrayList)8 ValueVector (org.apache.drill.exec.vector.ValueVector)8 RepeatedValueVector (org.apache.drill.exec.vector.complex.RepeatedValueVector)6 VectorDescrip (org.apache.drill.exec.physical.resultSet.model.MetadataProvider.VectorDescrip)4 VectorDescrip (org.apache.drill.exec.physical.rowSet.model.MetadataProvider.VectorDescrip)4 VectorAccessor (org.apache.drill.exec.vector.accessor.reader.VectorAccessor)3 MetadataProvider (org.apache.drill.exec.physical.rowSet.model.MetadataProvider)2 ColumnMetadata (org.apache.drill.exec.record.metadata.ColumnMetadata)2 BaseHyperVectorAccessor (org.apache.drill.exec.vector.accessor.reader.VectorAccessors.BaseHyperVectorAccessor)2 MinorType (org.apache.drill.common.types.TypeProtos.MinorType)1 MetadataProvider (org.apache.drill.exec.physical.resultSet.model.MetadataProvider)1 MetadataCreator (org.apache.drill.exec.physical.resultSet.model.MetadataProvider.MetadataCreator)1 RowSetReaderImpl (org.apache.drill.exec.physical.rowSet.RowSetReaderImpl)1 HyperVectorWrapper (org.apache.drill.exec.record.HyperVectorWrapper)1 MaterializedField (org.apache.drill.exec.record.MaterializedField)1 VariantMetadata (org.apache.drill.exec.record.metadata.VariantMetadata)1 VectorAccessors (org.apache.drill.exec.vector.accessor.reader.VectorAccessors)1 SingleVectorAccessor (org.apache.drill.exec.vector.accessor.reader.VectorAccessors.SingleVectorAccessor)1 DictVector (org.apache.drill.exec.vector.complex.DictVector)1