Class RexLiteralUtil

java.lang.Object
org.apache.flink.table.planner.plan.utils.RexLiteralUtil

@Internal public class RexLiteralUtil extends Object
Utilities to work with RexLiteral.
  • 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's Comparable data 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 the Comparable data structures and RowData for details on Flink's internal data structures.

      Parameters:
      value - the value in Calcite's Comparable data structures
      valueType - 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