Package dev.frostlake.executor.operators
Class ProjectOperator
java.lang.Object
dev.frostlake.executor.operators.ProjectOperator
- All Implemented Interfaces:
Operator
PROJECT operator - projects (selects) specific columns from rows.
This operator handles the SELECT list evaluation for non-aggregate queries.
It evaluates expressions for each row and creates new rows with only the
selected columns.
-
Constructor Summary
ConstructorsConstructorDescriptionProjectOperator(List<String> projectionExpressions, List<String> columnAliases, RowExpressionEvaluator expressionEvaluator) Create a PROJECT operator.ProjectOperator(List<String> projectionExpressions, List<String> columnAliases, RowExpressionEvaluator expressionEvaluator, Map<String, Object> lateralAliasSink) Create a PROJECT operator with lateral column-alias support.ProjectOperator(List<String> projectionExpressions, List<String> columnAliases, RowExpressionEvaluator expressionEvaluator, Map<String, Object> lateralAliasSink, Map<String, Object> baseBindings) AsProjectOperator(List, List, RowExpressionEvaluator, Map), additionally carrying the OUTER bindings of a LATERAL / correlated execution. -
Method Summary
Modifier and TypeMethodDescriptionexecute(List<Row> input, OperatorContext context) Execute this operator on the input rows.Get a description of this operator for debugging/logging.voidsetExpressionOrigins(List<SourcePosition> expressionOrigins) Where each projection item began in the statement, index-aligned with the expressions.
-
Constructor Details
-
ProjectOperator
public ProjectOperator(List<String> projectionExpressions, List<String> columnAliases, RowExpressionEvaluator expressionEvaluator) Create a PROJECT operator.- Parameters:
projectionExpressions- List of expressions to evaluate (e.g., "name", "age + 1", "COUNT(*)")columnAliases- List of column aliases (null entries allowed for no alias)expressionEvaluator- Evaluator to evaluate expressions on a row
-
ProjectOperator
public ProjectOperator(List<String> projectionExpressions, List<String> columnAliases, RowExpressionEvaluator expressionEvaluator, Map<String, Object> lateralAliasSink) Create a PROJECT operator with lateral column-alias support.- Parameters:
lateralAliasSink- a map SHARED withexpressionEvaluator's lateral context: as each aliased SELECT item is evaluated left-to-right, its (uppercased) alias → value is written here so a LATER item in the same SELECT list can reference it (Snowflake lateral column aliases). Cleared per input row. When null, no lateral-alias values are exposed to later items (only the exact-whole-item-is-an-alias shortcut applies).
-
ProjectOperator
public ProjectOperator(List<String> projectionExpressions, List<String> columnAliases, RowExpressionEvaluator expressionEvaluator, Map<String, Object> lateralAliasSink, Map<String, Object> baseBindings) AsProjectOperator(List, List, RowExpressionEvaluator, Map), additionally carrying the OUTER bindings of a LATERAL / correlated execution.- Parameters:
baseBindings- outer-row name → value bindings re-seeded intolateralAliasSinkafter its per-row reset, so a SELECT item may reference an outer alias by qualified name (SELECT fa.asset_keyinsideLEFT JOIN LATERAL (…)) — the sink is the evaluator's lateral context, and its per-row clear would otherwise drop them. Item aliases fill in later, so they shadow a same-named outer key; null when the query does not execute under an outer row.
-
-
Method Details
-
setExpressionOrigins
Where each projection item began in the statement, index-aligned with the expressions. Null entries are synthesised items (star expansion), which nobody wrote and which therefore report no position. -
execute
Description copied from interface:OperatorExecute this operator on the input rows. -
getDescription
Description copied from interface:OperatorGet a description of this operator for debugging/logging.- Specified by:
getDescriptionin interfaceOperator- Returns:
- A human-readable description of the operator
-