use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by apache.
the class SimpleReaderBuilder method buildMapMembers.
protected List<AbstractObjectReader> buildMapMembers(AbstractMapVector mapVector, MetadataProvider provider) {
final List<AbstractObjectReader> readers = new ArrayList<>();
int i = 0;
for (final ValueVector vector : mapVector) {
final VectorDescrip descrip = new VectorDescrip(provider, i, vector.getField());
readers.add(buildVectorReader(vector, descrip));
i++;
}
return readers;
}
use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by apache.
the class SimpleReaderBuilder method buildUnion.
private AbstractObjectReader buildUnion(UnionVector vector, VectorAccessor unionAccessor, VectorDescrip descrip) {
final MetadataProvider provider = descrip.childProvider();
final AbstractObjectReader[] variants = new AbstractObjectReader[MinorType.values().length];
int i = 0;
for (final MinorType type : vector.getField().getType().getSubTypeList()) {
// This call will create the vector if it does not yet exist.
// Will throw an exception for unsupported types.
// so call this only if the MajorType reports that the type
// already exists.
final ValueVector memberVector = vector.getMember(type);
final VectorDescrip memberDescrip = new VectorDescrip(provider, i++, memberVector.getField());
variants[type.ordinal()] = buildVectorReader(memberVector, memberDescrip);
}
return UnionReaderImpl.build(descrip.metadata, unionAccessor, variants);
}
use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by apache.
the class SimpleReaderBuilder method buildContainerChildren.
public List<AbstractObjectReader> buildContainerChildren(VectorContainer container, MetadataProvider mdProvider) {
final List<AbstractObjectReader> readers = new ArrayList<>();
for (int i = 0; i < container.getNumberOfColumns(); i++) {
final ValueVector vector = container.getValueVector(i).getValueVector();
final VectorDescrip descrip = new VectorDescrip(mdProvider, i, vector.getField());
readers.add(buildVectorReader(vector, descrip));
}
return readers;
}
use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader 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);
}
use of org.apache.drill.exec.vector.accessor.reader.AbstractObjectReader in project drill by apache.
the class HyperReaderBuilder method buildMapMembers.
protected List<AbstractObjectReader> buildMapMembers(VectorAccessor va, TupleMetadata mapSchema) {
List<AbstractObjectReader> readers = new ArrayList<>();
for (int i = 0; i < mapSchema.size(); i++) {
ColumnMetadata member = mapSchema.metadata(i);
// Does not use the hyper-vector mechanism.
readers.add(buildVectorReader(new VectorAccessors.MapMemberHyperVectorAccessor(va, i, member.majorType()), member));
}
return readers;
}
Aggregations