Class ClassDataTypeConverter

java.lang.Object
org.apache.flink.table.types.utils.ClassDataTypeConverter

@Internal public final class ClassDataTypeConverter extends Object
Class-based data type extractor that supports extraction of clearly identifiable data types for input and output conversion.

Note: In most of the cases, DataTypeExtractor is more useful as it also considers structured types and type variables possibly annotated with DataTypeHint.

  • Method Details

    • extractDataType

      public static Optional<DataType> extractDataType(Class<?> clazz)
      Returns the clearly identifiable data type if possible. For example, Long can be expressed as DataTypes.BIGINT(). However, for example, Row cannot be extracted as information about the fields is missing. Or BigDecimal needs to be mapped from a variable precision/scale to constant ones.