Interface DataTypeFactory


@PublicEvolving public interface DataTypeFactory
Factory for creating fully resolved data types that can be used for planning.

The factory is useful for types that cannot be created with one of the static methods in DataTypes) because they require access to configuration or catalog.

  • Method Details

    • createDataType

      DataType createDataType(AbstractDataType<?> abstractDataType)
      Creates a type out of an AbstractDataType.

      If the given type is already a DataType, the factory will return it unmodified. In case of UnresolvedDataType, the factory will resolve it to a DataType.

    • createDataType

      DataType createDataType(String typeString)
      Creates a type by a fully or partially defined name.

      The factory will parse and resolve the name of a type to a DataType. This includes both built-in types and user-defined types (see DistinctType and StructuredType).

    • createDataType

      DataType createDataType(UnresolvedIdentifier identifier)
      Creates a type by a fully or partially defined identifier.

      The factory will parse and resolve the name of a type to a DataType. This includes both built-in types and user-defined types (see DistinctType and StructuredType).

    • createDataType

      <T> DataType createDataType(Class<T> clazz)
      Creates a type by analyzing the given class.

      It does this by using Java reflection which can be supported by DataTypeHint annotations for nested, structured types.

      It will throw an ValidationException in cases where the reflective extraction needs more information or simply fails.

      See DataTypes.of(Class) for further examples.

    • createDataType

      <T> DataType createDataType(org.apache.flink.api.common.typeinfo.TypeInformation<T> typeInfo)
      Creates a type for the given TypeInformation.

      DataType is richer than TypeInformation as it also includes details about the LogicalType. Therefore, some details will be added implicitly during the conversion. The mapping to data type happens on a best effort basis. If no data type is suitable, the type information is interpreted as DataTypes.RAW(Class, TypeSerializer).

      See TypeInfoDataTypeConverter for more information.

    • createRawDataType

      <T> DataType createRawDataType(Class<T> clazz)
      Creates a RAW type for the given class in cases where no serializer is known and a generic serializer should be used. The factory will create DataTypes.RAW(Class, TypeSerializer) with Flink's default RAW serializer that is automatically configured.

      Note: This type is a black box within the table ecosystem and is only deserialized at the edges of the API.

    • createRawDataType

      <T> DataType createRawDataType(org.apache.flink.api.common.typeinfo.TypeInformation<T> typeInfo)
      Creates a RAW type for the given TypeInformation. Since type information does not contain a TypeSerializer yet. The serializer will be generated by considering the current configuration.

      Note: This type is a black box within the table ecosystem and is only deserialized at the edges of the API.

    • createLogicalType

      LogicalType createLogicalType(String typeString)
      Creates a LogicalType by a fully or partially defined name.

      The factory will parse and resolve the name of a type to a LogicalType. This includes both built-in types and user-defined types (see DistinctType and StructuredType).

    • createLogicalType

      LogicalType createLogicalType(UnresolvedIdentifier identifier)
      Creates a LogicalType from an UnresolvedIdentifier for resolving user-defined types (see DistinctType and StructuredType).