use of org.apache.drill.exec.record.RecordBatchSizer in project drill by apache.
the class OutputWidthVisitor method visitVarLenReadExpr.
/**
* Converts the {@link VarLenReadExpr} to a {@link FixedLenExpr} by getting
* the size for the corresponding column from the RecordBatchSizer.
*/
@Override
public OutputWidthExpression visitVarLenReadExpr(VarLenReadExpr varLenReadExpr, OutputWidthVisitorState state) throws RuntimeException {
String columnName = varLenReadExpr.getInputColumnName();
if (columnName == null) {
TypedFieldId fieldId = varLenReadExpr.getReadExpression().getTypedFieldId();
columnName = TypedFieldId.getPath(fieldId, state.manager.incomingBatch());
}
final RecordBatchSizer.ColumnSize columnSize = state.manager.getColumnSize(columnName);
int columnWidth = columnSize.getDataSizePerEntry();
return new FixedLenExpr(columnWidth);
}
Aggregations