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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> DataType
createDataType(Class<T> clazz)
Creates a type by analyzing the given class.DataType
createDataType(String typeString)
Creates a type by a fully or partially defined name.<T> DataType
createDataType(TypeInformation<T> typeInfo)
Creates a type for the givenTypeInformation
.DataType
createDataType(UnresolvedIdentifier identifier)
Creates a type by a fully or partially defined identifier.DataType
createDataType(AbstractDataType<?> abstractDataType)
Creates a type out of anAbstractDataType
.LogicalType
createLogicalType(String typeString)
Creates aLogicalType
by a fully or partially defined name.LogicalType
createLogicalType(UnresolvedIdentifier identifier)
Creates aLogicalType
from anUnresolvedIdentifier
for resolving user-defined types (seeDistinctType
andStructuredType
).<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.<T> DataType
createRawDataType(TypeInformation<T> typeInfo)
Creates a RAW type for the givenTypeInformation
.
-
-
-
Method Detail
-
createDataType
DataType createDataType(AbstractDataType<?> abstractDataType)
Creates a type out of anAbstractDataType
.If the given type is already a
DataType
, the factory will return it unmodified. In case ofUnresolvedDataType
, the factory will resolve it to aDataType
.
-
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 (seeDistinctType
andStructuredType
).
-
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 (seeDistinctType
andStructuredType
).
-
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(TypeInformation<T> typeInfo)
Creates a type for the givenTypeInformation
.DataType
is richer thanTypeInformation
as it also includes details about theLogicalType
. 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 asDataTypes.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 createDataTypes.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(TypeInformation<T> typeInfo)
Creates a RAW type for the givenTypeInformation
. Since type information does not contain aTypeSerializer
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 aLogicalType
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 (seeDistinctType
andStructuredType
).
-
createLogicalType
LogicalType createLogicalType(UnresolvedIdentifier identifier)
Creates aLogicalType
from anUnresolvedIdentifier
for resolving user-defined types (seeDistinctType
andStructuredType
).
-
-