use of org.apache.flink.table.planner.codegen.ExprCodeGenerator in project flink by apache.
the class StreamExecTemporalJoin method getJoinOperator.
private TwoInputStreamOperator<RowData, RowData, RowData> getJoinOperator(ExecNodeConfig config, RowType leftInputType, RowType rightInputType) {
// input must not be nullable, because the runtime join function will make sure
// the code-generated function won't process null inputs
final CodeGeneratorContext ctx = new CodeGeneratorContext(config.getTableConfig());
final ExprCodeGenerator exprGenerator = new ExprCodeGenerator(ctx, false).bindInput(leftInputType, CodeGenUtils.DEFAULT_INPUT1_TERM(), JavaScalaConversionUtil.toScala(Optional.empty())).bindSecondInput(rightInputType, CodeGenUtils.DEFAULT_INPUT2_TERM(), JavaScalaConversionUtil.toScala(Optional.empty()));
String body = "return true;";
if (joinSpec.getNonEquiCondition().isPresent()) {
final GeneratedExpression condition = exprGenerator.generateExpression(joinSpec.getNonEquiCondition().get());
body = String.format("%s\nreturn %s;", condition.code(), condition.resultTerm());
}
GeneratedJoinCondition generatedJoinCondition = FunctionCodeGenerator.generateJoinCondition(ctx, "ConditionFunction", body, CodeGenUtils.DEFAULT_INPUT1_TERM(), CodeGenUtils.DEFAULT_INPUT2_TERM());
return createJoinOperator(config, leftInputType, rightInputType, generatedJoinCondition);
}
Aggregations