Class TypeInfoDataTypeConverter

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

@Internal public final class TypeInfoDataTypeConverter extends Object
Converter from TypeInformation to DataType.

DataType is richer than TypeInformation as it also includes details about the LogicalType. Therefore, some details will be added implicitly during the conversion. The conversion from DataType to TypeInformation is provided by the planner.

The behavior of this converter can be summarized as follows:

  • All subclasses of TypeInformation are mapped to LogicalType including nullability that is aligned with serializers.
  • TupleTypeInfoBase is translated into RowType or StructuredType.
  • BigDecimal is converted to DECIMAL(38, 18) by default.
  • The order of PojoTypeInfo fields is determined by the converter.
  • GenericTypeInfo and other type information that cannot be mapped to a logical type is converted to RawType by considering the current configuration.
  • TypeInformation that originated from Table API will keep its DataType information when implementing DataTypeQueryable.
  • Constructor Details

    • TypeInfoDataTypeConverter

      public TypeInfoDataTypeConverter()
  • Method Details

    • toDataType

      public static DataType toDataType(DataTypeFactory dataTypeFactory, org.apache.flink.api.common.typeinfo.TypeInformation<?> typeInfo)
      Converts the given TypeInformation into DataType.
    • toDataType

      public static DataType toDataType(DataTypeFactory dataTypeFactory, org.apache.flink.api.common.typeinfo.TypeInformation<?> typeInfo, boolean forceNullability)
      Converts the given TypeInformation into DataType but allows to make all fields nullable independent of the nullability in the serialization stack.