@Internal public interface OpFusionCodegenSpec
Modifier and Type | Method and Description |
---|---|
String |
doEndInputConsume(int inputId)
The endInput method is used to do clean work for operator corresponding input, such as the
HashAgg operator needs to flush data, and the HashJoin build side need to build hash table,
so each operator needs to implement the corresponding clean logic in this method.
|
void |
doEndInputProduce(org.apache.flink.table.planner.codegen.CodeGeneratorContext codegenCtx)
Generate the Java source code to do operator clean work, only the leaf operator in operator
DAG need to generate the code, other middle operators just call its input `endInputProduce`
normally, otherwise, the operator has some specific logic.
|
String |
doProcessConsume(int inputId,
List<org.apache.flink.table.planner.codegen.GeneratedExpression> inputVars,
org.apache.flink.table.planner.codegen.GeneratedExpression row)
The process method is responsible for the operator data processing logic, so each operator
needs to implement this method to generate the code to process the row.
|
void |
doProcessProduce(org.apache.flink.table.planner.codegen.CodeGeneratorContext codegenCtx)
Generate the Java source code to process rows, only the leaf operator in operator DAG need to
generate the code which produce the row, other middle operators just call its input
OpFusionCodegenSpecGenerator.processProduce(CodeGeneratorContext) normally, otherwise, the
operator has some specific logic. |
org.apache.flink.table.planner.codegen.CodeGeneratorContext |
getCodeGeneratorContext()
Every operator need one
CodeGeneratorContext to store the context needed during
operator fusion codegen. |
org.apache.flink.table.planner.codegen.ExprCodeGenerator |
getExprCodeGenerator()
Get the
ExprCodeGenerator used by this operator during operator fusion codegen, . |
Class<? extends RowData> |
getInputRowDataClass(int inputId)
|
void |
setup(OpFusionContext opFusionContext)
Initializes the operator spec.
|
Set<Integer> |
usedInputColumns(int inputId)
The subset of column index those should be evaluated before this operator.
|
String |
variablePrefix()
Prefix used in the current operator's variable names.
|
void setup(OpFusionContext opFusionContext)
String variablePrefix()
Set<Integer> usedInputColumns(int inputId)
We will use this to insert some code to access those columns that are actually used by current operator before calling doProcessConsume().
Class<? extends RowData> getInputRowDataClass(int inputId)
RowData
type, this is used to notify the
upstream operator wrap the proper RowData
we needed before call doProcessConsume
method. For example, HashJoin build side need BinaryRowData
.org.apache.flink.table.planner.codegen.CodeGeneratorContext getCodeGeneratorContext()
CodeGeneratorContext
to store the context needed during
operator fusion codegen.org.apache.flink.table.planner.codegen.ExprCodeGenerator getExprCodeGenerator()
ExprCodeGenerator
used by this operator during operator fusion codegen, .void doProcessProduce(org.apache.flink.table.planner.codegen.CodeGeneratorContext codegenCtx)
OpFusionCodegenSpecGenerator.processProduce(CodeGeneratorContext)
normally, otherwise, the
operator has some specific logic. The leaf operator produce row first, and then call OpFusionContext.processConsume(List)
method to consume row.
The code generated by leaf operator will be saved in fusionCtx, so this method doesn't has return type.
String doProcessConsume(int inputId, List<org.apache.flink.table.planner.codegen.GeneratedExpression> inputVars, org.apache.flink.table.planner.codegen.GeneratedExpression row)
OpFusionCodegenSpecGenerator.processConsume(List, String)
.
Note: A operator can either consume the rows as RowData (row), or a list of variables (inputVars).
inputId
- This is numbered starting from 1, and `1` indicates the first input.inputVars
- field variables of current input.row
- row variable of current input.void doEndInputProduce(org.apache.flink.table.planner.codegen.CodeGeneratorContext codegenCtx)
The code generated by leaf operator will be saved in fusionCtx, so this method doesn't has return type.
String doEndInputConsume(int inputId)
For blocking operators such as HashAgg, the OpFusionContext.processConsume(List,
String)
method needs to be called first to consume the data, followed by the
`endInputConsume` method to do the cleanup work of the downstream operators. For pipeline
operators such as Project, you only need to call the `endInputConsume` method.
inputId
- This is numbered starting from 1, and `1` indicates the first input.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.