Search in sources :

Example 1 with SqlThrowExceptionFunction

use of org.apache.flink.table.planner.functions.sql.SqlThrowExceptionFunction in project flink by apache.

the class ThrowExceptionConverter method convert.

@Override
public RexNode convert(CallExpression call, CallExpressionConvertRule.ConvertContext context) {
    checkArgumentNumber(call, 2);
    DataType type = ((TypeLiteralExpression) call.getChildren().get(1)).getOutputDataType();
    SqlThrowExceptionFunction function = new SqlThrowExceptionFunction(context.getTypeFactory().createFieldTypeFromLogicalType(fromDataTypeToLogicalType(type)));
    return context.getRelBuilder().call(function, context.toRexNode(call.getChildren().get(0)));
}
Also used : SqlThrowExceptionFunction(org.apache.flink.table.planner.functions.sql.SqlThrowExceptionFunction) DataType(org.apache.flink.table.types.DataType) TypeLiteralExpression(org.apache.flink.table.expressions.TypeLiteralExpression)

Aggregations

TypeLiteralExpression (org.apache.flink.table.expressions.TypeLiteralExpression)1 SqlThrowExceptionFunction (org.apache.flink.table.planner.functions.sql.SqlThrowExceptionFunction)1 DataType (org.apache.flink.table.types.DataType)1