use of org.apache.drill.exec.vector.accessor.reader.VectorAccessor 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;
}
use of org.apache.drill.exec.vector.accessor.reader.VectorAccessor 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.VectorAccessor 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);
}
}
use of org.apache.drill.exec.vector.accessor.reader.VectorAccessor in project drill by apache.
the class HyperReaderBuilder method buildDict.
private AbstractObjectReader buildDict(VectorAccessor va, ColumnMetadata metadata) {
boolean isArray = metadata.isArray();
ValueVector vector = va.vector();
VectorAccessor dictAccessor;
if (isArray) {
ValueVector dictVector = ((RepeatedValueVector) vector).getDataVector();
dictAccessor = new VectorAccessors.SingleVectorAccessor(dictVector);
} else {
dictAccessor = va;
}
List<AbstractObjectReader> readers = buildMapMembers(dictAccessor, metadata.tupleSchema());
AbstractObjectReader reader = DictReaderImpl.build(metadata, dictAccessor, readers);
if (!isArray) {
return reader;
}
return ArrayReaderImpl.buildTuple(metadata, va, reader);
}
Aggregations