Search in sources :

Example 21 with RecordBatchSizer

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);
}
Also used : RecordBatchSizer(org.apache.drill.exec.record.RecordBatchSizer) FixedLenExpr(org.apache.drill.exec.physical.impl.project.OutputWidthExpression.FixedLenExpr) TypedFieldId(org.apache.drill.exec.record.TypedFieldId)

Aggregations

RecordBatchSizer (org.apache.drill.exec.record.RecordBatchSizer)21 ValueVector (org.apache.drill.exec.vector.ValueVector)11 VectorAccessible (org.apache.drill.exec.record.VectorAccessible)8 RecordBatch (org.apache.drill.exec.record.RecordBatch)7 ScanBatch (org.apache.drill.exec.physical.impl.ScanBatch)6 Test (org.junit.Test)6 MaterializedField (org.apache.drill.exec.record.MaterializedField)4 UInt4Vector (org.apache.drill.exec.vector.UInt4Vector)4 RepeatedListVector (org.apache.drill.exec.vector.complex.RepeatedListVector)4 RepeatedValueVector (org.apache.drill.exec.vector.complex.RepeatedValueVector)4 BatchSchema (org.apache.drill.exec.record.BatchSchema)3 SchemaChangeException (org.apache.drill.exec.exception.SchemaChangeException)2 RowSet (org.apache.drill.exec.physical.rowSet.RowSet)2 ColumnSize (org.apache.drill.exec.record.RecordBatchSizer.ColumnSize)2 VectorInitializer (org.apache.drill.exec.record.VectorInitializer)2 AllocationHint (org.apache.drill.exec.record.VectorInitializer.AllocationHint)2 VectorWrapper (org.apache.drill.exec.record.VectorWrapper)2 SelectionVector2 (org.apache.drill.exec.record.selection.SelectionVector2)2 SelectionVector4 (org.apache.drill.exec.record.selection.SelectionVector4)2 Text (org.apache.drill.exec.util.Text)2