use of org.apache.flink.table.planner.expressions.RexNodeExpression in project flink by apache.
the class ResolvedExpressionJsonDeserializer method deserializeRexNodeExpression.
private ResolvedExpression deserializeRexNodeExpression(ObjectNode jsonNode, ObjectCodec codec, DeserializationContext ctx) throws IOException {
RexNode node = ctx.readValue(jsonNode.get(REX_NODE).traverse(codec), RexNode.class);
String serializableString = jsonNode.get(SERIALIZABLE_STRING).asText();
return new RexNodeExpression(node, DataTypes.of(FlinkTypeFactory.toLogicalType(node.getType())), node.toString(), serializableString);
}
use of org.apache.flink.table.planner.expressions.RexNodeExpression 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);
}
Aggregations