Search in sources :

Example 6 with AbstractObjectReader

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

the class HyperReaderBuilder method buildContainerChildren.

protected List<AbstractObjectReader> buildContainerChildren(VectorContainer container, TupleMetadata schema) {
    List<AbstractObjectReader> readers = new ArrayList<>();
    for (int i = 0; i < container.getNumberOfColumns(); i++) {
        VectorWrapper<?> vw = container.getValueVector(i);
        VectorAccessor va = new HyperVectorAccessor(vw);
        readers.add(buildVectorReader(va, schema.metadata(i)));
    }
    return readers;
}
Also used : AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) BaseHyperVectorAccessor(org.apache.drill.exec.vector.accessor.reader.VectorAccessors.BaseHyperVectorAccessor) ArrayList(java.util.ArrayList) BaseHyperVectorAccessor(org.apache.drill.exec.vector.accessor.reader.VectorAccessors.BaseHyperVectorAccessor) VectorAccessor(org.apache.drill.exec.vector.accessor.reader.VectorAccessor)

Example 7 with AbstractObjectReader

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

the class SimpleReaderBuilder method buildDict.

private AbstractObjectReader buildDict(ValueVector vector, VectorAccessor va, VectorDescrip descrip) {
    boolean isArray = descrip.metadata.isArray();
    DictVector dictVector;
    VectorAccessor dictAccessor;
    if (isArray) {
        dictVector = (DictVector) ((RepeatedValueVector) vector).getDataVector();
        dictAccessor = new SingleVectorAccessor(dictVector);
    } else {
        dictVector = (DictVector) vector;
        dictAccessor = va;
    }
    List<AbstractObjectReader> readers = buildMapMembers(dictVector, descrip.childProvider());
    AbstractObjectReader reader = DictReaderImpl.build(descrip.metadata, dictAccessor, readers);
    if (!isArray) {
        return reader;
    }
    return ArrayReaderImpl.buildTuple(descrip.metadata, va, reader);
}
Also used : DictVector(org.apache.drill.exec.vector.complex.DictVector) AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) RepeatedValueVector(org.apache.drill.exec.vector.complex.RepeatedValueVector) SingleVectorAccessor(org.apache.drill.exec.vector.accessor.reader.VectorAccessors.SingleVectorAccessor) VectorAccessor(org.apache.drill.exec.vector.accessor.reader.VectorAccessor) SingleVectorAccessor(org.apache.drill.exec.vector.accessor.reader.VectorAccessors.SingleVectorAccessor)

Example 8 with AbstractObjectReader

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

the class SimpleReaderBuilder method buildMultiDList.

private AbstractObjectReader buildMultiDList(RepeatedListVector vector, VectorAccessor listAccessor, VectorDescrip listDescrip) {
    final ValueVector child = vector.getDataVector();
    if (child == null) {
        throw new UnsupportedOperationException("No child vector for repeated list.");
    }
    final VectorDescrip childDescrip = new VectorDescrip(listDescrip.childProvider(), 0, child.getField());
    final AbstractObjectReader elementReader = buildVectorReader(child, childDescrip);
    return ArrayReaderImpl.buildRepeatedList(listDescrip.metadata, listAccessor, elementReader);
}
Also used : RepeatedValueVector(org.apache.drill.exec.vector.complex.RepeatedValueVector) ValueVector(org.apache.drill.exec.vector.ValueVector) AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) VectorDescrip(org.apache.drill.exec.physical.resultSet.model.MetadataProvider.VectorDescrip)

Example 9 with AbstractObjectReader

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

the class BaseReaderBuilder method buildContainerChildren.

protected List<AbstractObjectReader> buildContainerChildren(VectorContainer container, MetadataProvider mdProvider) {
    List<AbstractObjectReader> writers = new ArrayList<>();
    for (int i = 0; i < container.getNumberOfColumns(); i++) {
        @SuppressWarnings("resource") ValueVector vector = container.getValueVector(i).getValueVector();
        VectorDescrip descrip = new VectorDescrip(mdProvider, i, vector.getField());
        writers.add(buildVectorReader(vector, descrip));
    }
    return writers;
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) ArrayList(java.util.ArrayList) VectorDescrip(org.apache.drill.exec.physical.rowSet.model.MetadataProvider.VectorDescrip)

Example 10 with AbstractObjectReader

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

the class SimpleReaderBuilder method buildMap.

private AbstractObjectReader buildMap(AbstractMapVector vector, VectorAccessor va, DataMode mode, VectorDescrip descrip) {
    final boolean isArray = mode == DataMode.REPEATED;
    // Map type
    final AbstractObjectReader mapReader = MapReader.build(descrip.metadata, isArray ? null : va, buildMapMembers(vector, descrip.parent.childProvider(descrip.metadata)));
    if (!isArray) {
        return mapReader;
    }
    return ArrayReaderImpl.buildTuple(descrip.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