Class RexLiteralUtil
java.lang.Object
org.apache.flink.table.planner.plan.utils.RexLiteralUtil
Utilities to work with
RexLiteral.-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjecttoFlinkInternalValue(Comparable<?> value, org.apache.flink.table.types.logical.LogicalType valueType) Convert a value from Calcite'sComparabledata structures to Flink internal data structures and also tries to be a bit flexible by accepting usual Java types such as String and boxed numerics.static org.apache.flink.api.java.tuple.Tuple2<Object,org.apache.flink.table.types.logical.LogicalType> toFlinkInternalValue(org.apache.calcite.rex.RexLiteral literal)
-
Method Details
-
toFlinkInternalValue
public static org.apache.flink.api.java.tuple.Tuple2<Object,org.apache.flink.table.types.logical.LogicalType> toFlinkInternalValue(org.apache.calcite.rex.RexLiteral literal) -
toFlinkInternalValue
public static Object toFlinkInternalValue(Comparable<?> value, org.apache.flink.table.types.logical.LogicalType valueType) Convert a value from Calcite'sComparabledata structures to Flink internal data structures and also tries to be a bit flexible by accepting usual Java types such as String and boxed numerics.In case of symbol types, this function will return provided value, checking that it's an
Enum.This function is essentially like
FlinkTypeFactory#toLogicalType(RelDataType)but for values.Check
RexLiteral.valueMatchesType(Comparable, SqlTypeName, boolean)for details on theComparabledata structures andRowDatafor details on Flink's internal data structures.- Parameters:
value- the value in Calcite'sComparabledata structuresvalueType- the type of the value- Returns:
- the value in Flink's internal data structures
- Throws:
IllegalArgumentException- in case the class of value does not match the expectations of valueType
-