use of org.apache.drill.exec.physical.resultSet.model.MetadataProvider.VectorDescrip in project drill by apache.
the class BaseWriterBuilder method buildContainerChildren.
protected List<AbstractObjectWriter> buildContainerChildren(VectorContainer container, MetadataProvider mdProvider) {
final List<AbstractObjectWriter> writers = 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());
writers.add(buildVectorWriter(vector, descrip));
}
return writers;
}
use of org.apache.drill.exec.physical.resultSet.model.MetadataProvider.VectorDescrip in project drill by apache.
the class BaseWriterBuilder method buildMap.
private List<AbstractObjectWriter> buildMap(AbstractMapVector vector, VectorDescrip descrip) {
final List<AbstractObjectWriter> writers = new ArrayList<>();
final MetadataProvider provider = descrip.parent.childProvider(descrip.metadata);
int i = 0;
for (final ValueVector child : vector) {
final VectorDescrip childDescrip = new VectorDescrip(provider, i, child.getField());
writers.add(buildVectorWriter(child, childDescrip));
i++;
}
return writers;
}
use of org.apache.drill.exec.physical.resultSet.model.MetadataProvider.VectorDescrip in project drill by apache.
the class BaseWriterBuilder method build1DList.
private AbstractObjectWriter build1DList(ListVector vector, VectorDescrip descrip) {
final ValueVector dataVector = vector.getDataVector();
VectorDescrip dataMetadata;
if (dataVector.getField().getType().getMinorType() == MinorType.UNION) {
// If the list holds a union, then the list and union are collapsed
// together in the metadata layer.
dataMetadata = descrip;
} else {
dataMetadata = new VectorDescrip(descrip.childProvider(), 0, dataVector.getField());
}
return new ArrayObjectWriter(new ListWriterImpl(descrip.metadata, vector, buildVectorWriter(dataVector, dataMetadata)));
}
use of org.apache.drill.exec.physical.resultSet.model.MetadataProvider.VectorDescrip in project drill by apache.
the class BaseWriterBuilder method buildUnion.
private AbstractObjectWriter buildUnion(UnionVector vector, VectorDescrip descrip) {
if (vector == null) {
throw new UnsupportedOperationException("Dummy variant writer not yet supported");
}
final AbstractObjectWriter[] variants = new AbstractObjectWriter[MinorType.values().length];
final MetadataProvider mdProvider = descrip.childProvider();
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(mdProvider, i++, memberVector.getField());
variants[type.ordinal()] = buildVectorWriter(memberVector, memberDescrip);
}
return new VariantObjectWriter(new UnionWriterImpl(descrip.metadata, vector, variants));
}
use of org.apache.drill.exec.physical.resultSet.model.MetadataProvider.VectorDescrip 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);
}
Aggregations