use of org.apache.drill.exec.physical.rowSet.impl.ColumnState.BaseMapColumnState in project drill by axbaretto.
the class TupleState method buildSchema.
/**
* When creating a schema up front, provide the schema of the desired tuple,
* then build vectors and writers to match. Allows up-front schema definition
* in addition to on-the-fly schema creation handled elsewhere.
*
* @param schema desired tuple schema to be materialized
*/
public void buildSchema(TupleMetadata schema) {
for (int i = 0; i < schema.size(); i++) {
ColumnMetadata colSchema = schema.metadata(i);
AbstractObjectWriter colWriter;
if (colSchema.isMap()) {
colWriter = addColumn(colSchema.cloneEmpty());
BaseMapColumnState mapColState = (BaseMapColumnState) columns.get(columns.size() - 1);
mapColState.mapState().buildSchema(colSchema.mapSchema());
} else {
colWriter = addColumn(colSchema);
}
writer().addColumnWriter(colWriter);
}
}
use of org.apache.drill.exec.physical.rowSet.impl.ColumnState.BaseMapColumnState in project drill by axbaretto.
the class VectorContainerBuilder method updateTuple.
private void updateTuple(TupleState sourceModel, TupleProxy destProxy) {
int prevCount = destProxy.size();
List<ColumnState> cols = sourceModel.columns();
int currentCount = cols.size();
for (int i = 0; i < prevCount; i++) {
ColumnState colState = cols.get(i);
if (!colState.schema().isProjected()) {
continue;
}
if (colState.schema().isMap()) {
updateTuple((TupleState) ((BaseMapColumnState) colState).mapState(), destProxy.mapProxy(i));
}
}
for (int i = prevCount; i < currentCount; i++) {
ColumnState colState = cols.get(i);
if (!colState.schema().isProjected()) {
continue;
}
if (colState.addVersion > outputSchemaVersion) {
break;
}
if (colState.schema().isMap()) {
buildMap(destProxy, (BaseMapColumnState) colState);
} else {
destProxy.add(colState.vector());
destProxy.schema.addColumn(colState.schema());
assert destProxy.size() == destProxy.schema.size();
}
}
}
Aggregations