use of org.apache.drill.exec.vector.ValueVector in project drill by apache.
the class ExternalSortBatch method createCopier.
private void createCopier(VectorAccessible batch, List<BatchGroup> batchGroupList, VectorContainer outputContainer, boolean spilling) throws SchemaChangeException {
try {
if (copier == null) {
CodeGenerator<PriorityQueueCopier> cg = CodeGenerator.get(PriorityQueueCopier.TEMPLATE_DEFINITION, context.getFunctionRegistry(), context.getOptions());
cg.plainJavaCapable(true);
// Uncomment out this line to debug the generated code.
// cg.saveCodeForDebugging(true);
ClassGenerator<PriorityQueueCopier> g = cg.getRoot();
generateComparisons(g, batch);
g.setMappingSet(COPIER_MAPPING_SET);
CopyUtil.generateCopies(g, batch, true);
g.setMappingSet(MAIN_MAPPING);
copier = context.getImplementationClass(cg);
} else {
copier.close();
}
@SuppressWarnings("resource") BufferAllocator allocator = spilling ? copierAllocator : oAllocator;
for (VectorWrapper<?> i : batch) {
@SuppressWarnings("resource") ValueVector v = TypeHelper.getNewVector(i.getField(), allocator);
outputContainer.add(v);
}
copier.setup(context, allocator, batch, batchGroupList, outputContainer);
} catch (ClassTransformationException | IOException e) {
throw new RuntimeException(e);
}
}
use of org.apache.drill.exec.vector.ValueVector in project drill by apache.
the class FrameSupportTemplate method allocateInternal.
private void allocateInternal() {
for (VectorWrapper<?> w : container) {
ValueVector vv = internal.addOrGet(w.getField());
vv.allocateNew();
}
}
use of org.apache.drill.exec.vector.ValueVector in project drill by apache.
the class HyperVectorWrapper method getChildWrapper.
@Override
public VectorWrapper<?> getChildWrapper(int[] ids) {
if (ids.length == 1) {
return this;
}
ValueVector[] vectors = new ValueVector[this.vectors.length];
int index = 0;
for (ValueVector v : this.vectors) {
ValueVector vector = v;
for (int i = 1; i < ids.length; i++) {
final AbstractMapVector mapLike = AbstractMapVector.class.cast(vector);
if (mapLike == null) {
return null;
}
vector = mapLike.getChildByOrdinal(ids[i]);
}
vectors[index] = vector;
index++;
}
return new HyperVectorWrapper<ValueVector>(vectors[0].getField(), vectors);
}
use of org.apache.drill.exec.vector.ValueVector in project drill by apache.
the class SimpleVectorWrapper method getChildWrapper.
@SuppressWarnings("resource")
@Override
public VectorWrapper<?> getChildWrapper(int[] ids) {
if (ids.length == 1) {
return this;
}
ValueVector vector = this.vector;
for (int i = 1; i < ids.length; i++) {
final AbstractMapVector mapLike = AbstractMapVector.class.cast(vector);
if (mapLike == null) {
return null;
}
vector = mapLike.getChildByOrdinal(ids[i]);
}
return new SimpleVectorWrapper<>(vector);
}
use of org.apache.drill.exec.vector.ValueVector in project drill by apache.
the class VectorAccessibleComplexWriter method addOrGet.
@Override
public <T extends ValueVector> T addOrGet(String name, MajorType type, Class<T> clazz) {
final ValueVector v = vc.addOrGet(name, type, clazz);
putChild(name, v);
return this.typeify(v, clazz);
}
Aggregations