public class CodeGenerator extends Object implements org.apache.calcite.rex.RexVisitor<GeneratedExpression>
Function
s.
Constructor and Description |
---|
CodeGenerator(TableConfig config,
boolean nullableInput,
TypeInformation<Object> input,
int[] inputPojoFieldMapping)
A code generator for generating unary Flink
Function s with one input. |
CodeGenerator(TableConfig config,
boolean nullableInput,
TypeInformation<Object> input1,
scala.Option<TypeInformation<Object>> input2,
scala.Option<int[]> inputPojoFieldMapping) |
Modifier and Type | Method and Description |
---|---|
String |
addReusableDecimal(BigDecimal decimal) |
void |
addReusableOutRecord(TypeInformation<?> ti) |
String |
addReusablePrivateFieldAccess(Class<?> clazz,
String fieldName) |
String |
collectorTerm() |
GeneratedExpression |
generateConverterResultExpression(TypeInformation<?> returnType,
scala.collection.Seq<String> resultFieldNames)
Generates an expression that converts the first input (and second input) into the given type.
|
GeneratedExpression |
generateExpression(org.apache.calcite.rex.RexNode rex)
Generates an expression from a RexNode.
|
<T extends Function> |
generateFunction(String name,
Class<T> clazz,
String bodyCode,
TypeInformation<Object> returnType)
Generates a
Function that can be passed to Java
compiler. |
GeneratedExpression |
generateResultExpression(scala.collection.Seq<GeneratedExpression> fieldExprs,
TypeInformation<?> returnType,
scala.collection.Seq<String> resultFieldNames)
Generates an expression from a sequence of other expressions.
|
GeneratedExpression |
generateResultExpression(TypeInformation<?> returnType,
scala.collection.Seq<String> resultFieldNames,
scala.collection.Seq<org.apache.calcite.rex.RexNode> rexNodes)
Generates an expression from a sequence of RexNode.
|
String |
input1Term() |
String |
input2Term() |
boolean |
nullCheck() |
String |
outRecordTerm() |
String |
reuseInitCode() |
String |
reuseInputUnboxingCode() |
String |
reuseMemberCode() |
GeneratedExpression |
visitCall(org.apache.calcite.rex.RexCall call) |
GeneratedExpression |
visitCorrelVariable(org.apache.calcite.rex.RexCorrelVariable correlVariable) |
GeneratedExpression |
visitDynamicParam(org.apache.calcite.rex.RexDynamicParam dynamicParam) |
GeneratedExpression |
visitFieldAccess(org.apache.calcite.rex.RexFieldAccess rexFieldAccess) |
GeneratedExpression |
visitInputRef(org.apache.calcite.rex.RexInputRef inputRef) |
GeneratedExpression |
visitLiteral(org.apache.calcite.rex.RexLiteral literal) |
GeneratedExpression |
visitLocalRef(org.apache.calcite.rex.RexLocalRef localRef) |
GeneratedExpression |
visitOver(org.apache.calcite.rex.RexOver over) |
GeneratedExpression |
visitRangeRef(org.apache.calcite.rex.RexRangeRef rangeRef) |
GeneratedExpression |
visitSubQuery(org.apache.calcite.rex.RexSubQuery subQuery) |
public CodeGenerator(TableConfig config, boolean nullableInput, TypeInformation<Object> input1, scala.Option<TypeInformation<Object>> input2, scala.Option<int[]> inputPojoFieldMapping)
public CodeGenerator(TableConfig config, boolean nullableInput, TypeInformation<Object> input, int[] inputPojoFieldMapping)
Function
s with one input.
config
- configuration that determines runtime behaviornullableInput
- input(s) can be null.input
- type information about the input of the FunctioninputPojoFieldMapping
- additional mapping information necessary if input is a
POJO (POJO types have no deterministic field order).public String reuseMemberCode()
public String reuseInitCode()
public String reuseInputUnboxingCode()
public String input1Term()
public String input2Term()
public String collectorTerm()
public String outRecordTerm()
public boolean nullCheck()
public GeneratedExpression generateExpression(org.apache.calcite.rex.RexNode rex)
rex
- Calcite row expressionpublic <T extends Function> GeneratedFunction<T> generateFunction(String name, Class<T> clazz, String bodyCode, TypeInformation<Object> returnType)
Function
that can be passed to Java
compiler.
name
- Class name of the Function. Must not be unique but has to be a valid Java class
identifier.clazz
- Flink Function to be generated.bodyCode
- code contents of the SAM (Single Abstract Method). Inputs, collector, or
output record can be accessed via the given term methods.returnType
- expected return typepublic GeneratedExpression generateConverterResultExpression(TypeInformation<?> returnType, scala.collection.Seq<String> resultFieldNames)
outRecordTerm
).
returnType
- conversion target type. Inputs and output must have the same arity.resultFieldNames
- result field names necessary for a mapping to POJO fields.public GeneratedExpression generateResultExpression(TypeInformation<?> returnType, scala.collection.Seq<String> resultFieldNames, scala.collection.Seq<org.apache.calcite.rex.RexNode> rexNodes)
outRecordTerm
).
returnType
- conversion target type. Type must have the same arity than rexNodes.resultFieldNames
- result field names necessary for a mapping to POJO fields.rexNodes
- sequence of RexNode to be convertedpublic GeneratedExpression generateResultExpression(scala.collection.Seq<GeneratedExpression> fieldExprs, TypeInformation<?> returnType, scala.collection.Seq<String> resultFieldNames)
outRecordTerm
).
fieldExprs
- field expressions to be convertedreturnType
- conversion target type. Type must have the same arity than fieldExprs.resultFieldNames
- result field names necessary for a mapping to POJO fields.public GeneratedExpression visitInputRef(org.apache.calcite.rex.RexInputRef inputRef)
visitInputRef
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitFieldAccess(org.apache.calcite.rex.RexFieldAccess rexFieldAccess)
visitFieldAccess
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitLiteral(org.apache.calcite.rex.RexLiteral literal)
visitLiteral
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitCorrelVariable(org.apache.calcite.rex.RexCorrelVariable correlVariable)
visitCorrelVariable
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitLocalRef(org.apache.calcite.rex.RexLocalRef localRef)
visitLocalRef
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitRangeRef(org.apache.calcite.rex.RexRangeRef rangeRef)
visitRangeRef
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitDynamicParam(org.apache.calcite.rex.RexDynamicParam dynamicParam)
visitDynamicParam
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitCall(org.apache.calcite.rex.RexCall call)
visitCall
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitOver(org.apache.calcite.rex.RexOver over)
visitOver
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public GeneratedExpression visitSubQuery(org.apache.calcite.rex.RexSubQuery subQuery)
visitSubQuery
in interface org.apache.calcite.rex.RexVisitor<GeneratedExpression>
public void addReusableOutRecord(TypeInformation<?> ti)
public String addReusablePrivateFieldAccess(Class<?> clazz, String fieldName)
public String addReusableDecimal(BigDecimal decimal)
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.