Search in sources :

Example 1 with SqlExprToRexConverter

use of org.apache.flink.table.planner.calcite.SqlExprToRexConverter in project flink by apache.

the class ParserImpl method parseSqlExpression.

@Override
public ResolvedExpression parseSqlExpression(String sqlExpression, RowType inputRowType, @Nullable LogicalType outputType) {
    final SqlExprToRexConverter sqlExprToRexConverter = sqlExprToRexConverterFactory.create(inputRowType, outputType);
    final RexNode rexNode = sqlExprToRexConverter.convertToRexNode(sqlExpression);
    final LogicalType logicalType = FlinkTypeFactory.toLogicalType(rexNode.getType());
    // expand expression for serializable expression strings similar to views
    final String sqlExpressionExpanded = sqlExprToRexConverter.expand(sqlExpression);
    return new RexNodeExpression(rexNode, TypeConversions.fromLogicalToDataType(logicalType), sqlExpression, sqlExpressionExpanded);
}
Also used : RexNodeExpression(org.apache.flink.table.planner.expressions.RexNodeExpression) SqlExprToRexConverter(org.apache.flink.table.planner.calcite.SqlExprToRexConverter) LogicalType(org.apache.flink.table.types.logical.LogicalType) RexNode(org.apache.calcite.rex.RexNode)

Aggregations

RexNode (org.apache.calcite.rex.RexNode)1 SqlExprToRexConverter (org.apache.flink.table.planner.calcite.SqlExprToRexConverter)1 RexNodeExpression (org.apache.flink.table.planner.expressions.RexNodeExpression)1 LogicalType (org.apache.flink.table.types.logical.LogicalType)1