Search in sources :

Example 16 with AbstractObjectReader

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

the class HyperReaderBuilder method buildUnion.

private AbstractObjectReader buildUnion(VectorAccessor unionAccessor, ColumnMetadata metadata) {
    VariantMetadata unionSchema = metadata.variantSchema();
    final AbstractObjectReader[] variants = new AbstractObjectReader[MinorType.values().length];
    for (ColumnMetadata member : unionSchema.members()) {
        // The following builds a synthetic field since we have no good way to
        // access the real field at this point.
        variants[member.type().ordinal()] = buildVectorReader(new VectorAccessors.UnionMemberHyperVectorAccessor(unionAccessor, member.majorType()), member);
    }
    return UnionReaderImpl.build(metadata, unionAccessor, variants);
}
Also used : VariantMetadata(org.apache.drill.exec.record.metadata.VariantMetadata) AbstractObjectReader(org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader) ColumnMetadata(org.apache.drill.exec.record.metadata.ColumnMetadata)

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