@PublicEvolving public interface DataTypeFactory
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.
Modifier and Type | Method and Description |
---|---|
DataType |
createDataType(AbstractDataType<?> abstractDataType)
Creates a type out of an
AbstractDataType . |
<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 given
TypeInformation . |
DataType |
createDataType(UnresolvedIdentifier identifier)
Creates a type by a fully or partially defined identifier.
|
LogicalType |
createLogicalType(String typeString)
Creates a
LogicalType by a fully or partially defined name. |
LogicalType |
createLogicalType(UnresolvedIdentifier identifier)
Creates a
LogicalType from an UnresolvedIdentifier for resolving user-defined
types (see DistinctType and StructuredType ). |
<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 given
TypeInformation . |
DataType createDataType(AbstractDataType<?> abstractDataType)
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
.
DataType createDataType(String typeString)
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
).
DataType createDataType(UnresolvedIdentifier 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
).
<T> DataType createDataType(Class<T> clazz)
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.
<T> DataType createDataType(TypeInformation<T> typeInfo)
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.
<T> DataType createRawDataType(Class<T> clazz)
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.
<T> DataType createRawDataType(TypeInformation<T> typeInfo)
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.
LogicalType createLogicalType(String typeString)
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
).
LogicalType createLogicalType(UnresolvedIdentifier identifier)
LogicalType
from an UnresolvedIdentifier
for resolving user-defined
types (see DistinctType
and StructuredType
).Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.