Class ProjectMemoryManager


public class ProjectMemoryManager extends RecordBatchMemoryManager
ProjectMemoryManager(PMM) is used to estimate the size of rows produced by ProjectRecordBatch. The PMM works as follows:

Setup phase: As and when ProjectRecordBatch creates or transfers a field, it registers the field with PMM. If the field is a variable-width field, PMM records the expression that produces the variable-width field. The expression is a tree of LogicalExpressions. The PMM walks this tree of LogicalExpressions to produce a tree of OutputWidthExpressions. The widths of fixed-width fields are just accumulated into a single total. Note: The PMM, currently, cannot handle new complex fields, it just uses a hard-coded estimate for such fields.

Execution phase: Just before a batch is processed by Project, the PMM walks the tree of OutputWidthExpressions and converts them to FixedWidthExpressions. It uses the RecordBatchSizer and the function annotations to do this conversion. See OutputWidthVisitor for details.