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);
}
use of org.apache.drill.exec.vector.ValueVector in project drill by apache.
the class VectorContainer method addOrGet.
@SuppressWarnings({ "resource", "unchecked" })
public <T extends ValueVector> T addOrGet(final MaterializedField field, final SchemaChangeCallBack callBack) {
final TypedFieldId id = getValueVectorId(SchemaPath.getSimplePath(field.getPath()));
final ValueVector vector;
final Class<?> clazz = TypeHelper.getValueVectorClass(field.getType().getMinorType(), field.getType().getMode());
if (id != null) {
vector = getValueAccessorById(id.getFieldIds()).getValueVector();
if (id.getFieldIds().length == 1 && clazz != null && !clazz.isAssignableFrom(vector.getClass())) {
final ValueVector newVector = TypeHelper.getNewVector(field, this.getAllocator(), callBack);
replace(vector, newVector);
return (T) newVector;
}
} else {
vector = TypeHelper.getNewVector(field, this.getAllocator(), callBack);
add(vector);
}
return (T) vector;
}
Aggregations