/**
* A collection of expressions which read inputs, compute output expressions,
* and optionally use a condition to filter rows.
*
* <p>Programs are immutable. It may help to use a {@link RexProgramBuilder},
* which has the same relationship to {@link RexProgram} as {@link StringBuilder}
* has to {@link String}.
*
* <p>A program can contain aggregate functions. If it does, the arguments to
* each aggregate function must be an {@link RexInputRef}.
*
* @see RexProgramBuilder
*/
public class RexProgram {
//~ Instance fields --------------------------------------------------------
/**
* First stage of expression evaluation. The expressions in this array can
* refer to inputs (using input ordinal #0) or previous expressions in the
* array (using input ordinal #1).
*/
// 最开始的表达式信息,一般是RexInputRef, RexCall, RexLocalRef 等node
private final List<RexNode> exprs;
/**
* With {@link #condition}, the second stage of expression evaluation.
*/
// 经过 Condition 条件过滤之后的表达式信息
private final List<RexLocalRef> projects;
/**
* The optional condition. If null, the calculator does not filter rows.
*/
private final RexLocalRef condition;
private final RelDataType inputRowType;
private final RelDataType outputRowType;
/**
* Reference counts for each expression, computed on demand.
*/
private int[] refCounts;
}