@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 name)
Creates a type by a fully or partially defined name.
|
DataType |
createDataType(UnresolvedIdentifier identifier)
Creates a type by a fully or partially defined identifier.
|
<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.
|
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 name)
The factory will parse and resolve the name of a type to a DataType
. This includes
both built-in types as well as 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 as well as 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 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.
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.