use of org.apache.drill.exec.vector.accessor.reader.VectorAccessors.SingleVectorAccessor 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);
}
use of org.apache.drill.exec.vector.accessor.reader.VectorAccessors.SingleVectorAccessor in project drill by apache.
the class SimpleReaderBuilder method buildVectorReader.
protected AbstractObjectReader buildVectorReader(ValueVector vector, VectorDescrip descrip) {
final VectorAccessor va = new SingleVectorAccessor(vector);
final MajorType type = va.type();
switch(type.getMinorType()) {
case DICT:
return buildDict(vector, va, descrip);
case MAP:
return buildMap((AbstractMapVector) vector, va, type.getMode(), descrip);
case UNION:
return buildUnion((UnionVector) vector, va, descrip);
case LIST:
return buildList(vector, va, descrip);
case LATE:
return AbstractScalarReader.nullReader(descrip.metadata);
default:
return buildScalarReader(va, descrip.metadata);
}
}
Aggregations