use of org.apache.flink.table.functions.ScalarFunction in project flink by apache.
the class LegacyScalarFunctionConvertRule method convert.
@Override
public Optional<RexNode> convert(CallExpression call, ConvertContext context) {
FunctionDefinition def = call.getFunctionDefinition();
if (def instanceof ScalarFunctionDefinition) {
ScalarFunction scalaFunc = ((ScalarFunctionDefinition) def).getScalarFunction();
FunctionIdentifier identifier = call.getFunctionIdentifier().orElse(FunctionIdentifier.of(generateInlineFunctionName(scalaFunc)));
SqlFunction sqlFunction = UserDefinedFunctionUtils.createScalarSqlFunction(identifier, scalaFunc.toString(), scalaFunc, context.getTypeFactory());
return Optional.of(context.getRelBuilder().call(sqlFunction, toRexNodes(context, call.getChildren())));
}
return Optional.empty();
}
Aggregations