use of org.apache.drill.exec.physical.resultSet.model.MetadataProvider 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 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 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.physical.resultSet.model.MetadataProvider in project drill by apache.
the class VectorAllocator method allocateMap.
private void allocateMap(AbstractMapVector vector, ColumnMetadata metadata, int valueCount, MetadataProvider mdProvider) {
final MetadataProvider mapProvider = mdProvider.childProvider(metadata);
final TupleMetadata mapSchema = metadata.tupleSchema();
assert mapSchema != null;
int i = 0;
for (final ValueVector child : vector) {
allocateVector(child, mapProvider.metadata(i, child.getField()), valueCount, mapProvider);
i++;
}
}
Aggregations