Class DataTypes
DataType can be used to declare input and/or output types of operations. This class
enumerates all pre-defined data types of the Table & SQL API.
For convenience, this class also contains methods for creating UnresolvedDataTypes
that need to be resolved at later stages. This is in particular useful for more complex types
that are expressed as Class (see of(Class)) or types that need to be looked up
in a catalog (see of(String)).
NOTE: Planners might not support every data type with the desired precision or parameter. Please see the planner compatibility and limitations section in the website documentation before using a data type.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCommon helper class for resolved and unresolved fields of a row or structured type.static final classHelper class for defining the field of a row or structured type.static final classHelper class for defining the resolution of an interval.static final classHelper class for defining the unresolved field of a row or structured type. -
Method Summary
Modifier and TypeMethodDescriptionstatic UnresolvedDataTypeARRAY(AbstractDataType<?> elementDataType) Unresolved data type of an array of elements with same subtype.static DataTypeData type of an array of elements with same subtype.static DataTypeBIGINT()Data type of an 8-byte signed integer with values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.static DataTypeBINARY(int n) Data type of a fixed-length binary string (=a sequence of bytes)BINARY(n)wherenis the number of bytes.static DataTypeBOOLEAN()Data type of a boolean with a (possibly) three-valued logic ofTRUE, FALSE, UNKNOWN.static DataTypeBYTES()Data type of a variable-length binary string (=a sequence of bytes) with defined maximum length.static DataTypeCHAR(int n) Data type of a fixed-length character stringCHAR(n)wherenis the number of code points.static DataTypeDATE()Data type of a date consisting ofyear-month-daywith values ranging from0000-01-01to9999-12-31.static DataTypes.ResolutionDAY()Resolution in days with 2 digits for the number of days by default.static DataTypes.ResolutionDAY(int precision) Resolution in days.static DataTypeDECIMAL(int precision, int scale) Data type of a decimal number with fixed precision and scaleDECIMAL(p, s)wherepis the number of digits in a number (=precision) andsis the number of digits to the right of the decimal point in a number (=scale).static DataTypeDOUBLE()Data type of an 8-byte double precision floating point number.static DataTypes.UnresolvedFieldFIELD(String name, AbstractDataType<?> fieldDataType) Unresolved field definition with field name and data type.static DataTypes.UnresolvedFieldFIELD(String name, AbstractDataType<?> fieldDataType, String description) Unresolved field definition with field name, unresolved data type, and a description.static DataTypes.FieldField definition with field name and data type.static DataTypes.FieldField definition with field name, data type, and a description.static DataTypeFLOAT()Data type of a 4-byte single precision floating point number.static DataTypes.ResolutionHOUR()Resolution in hours.static DataTypeINT()Data type of a 4-byte signed integer with values from -2,147,483,648 to 2,147,483,647.static DataTypeINTERVAL(DataTypes.Resolution resolution) Data type of a temporal interval.static DataTypeINTERVAL(DataTypes.Resolution upperResolution, DataTypes.Resolution lowerResolution) Data type of a temporal interval.static UnresolvedDataTypeMAP(AbstractDataType<?> keyDataType, AbstractDataType<?> valueDataType) Unresolved data type of an associative array that maps keys (includingNULL) to values (includingNULL).static DataTypeData type of an associative array that maps keys (includingNULL) to values (includingNULL).static DataTypes.ResolutionMINUTE()Resolution in minutes.static DataTypes.ResolutionMONTH()Resolution in months.static UnresolvedDataTypeMULTISET(AbstractDataType<?> elementDataType) Unresolved data type of a multiset (=bag).static DataTypeData type of a multiset (=bag).static DataTypeNULL()Data type for representing untypedNULLvalues.static UnresolvedDataTypeCreates an unresolved type that will be resolved to aDataTypeby analyzing the given class later.static UnresolvedDataTypeCreates an unresolved type that will be resolved to aDataTypeby using a fully or partially defined name.static UnresolvedDataTypeof(org.apache.flink.api.common.typeinfo.TypeInformation<?> typeInfo) Creates an unresolved type that will be resolved to aDataTypeby converting the givenTypeInformationlater.static DataTypeof(LogicalType logicalType) Creates aDataTypefrom aLogicalTypewith default conversion class.static <T> UnresolvedDataTypeUnresolved data type of an arbitrary serialized type.static <T> DataTypeData type of an arbitrary serialized type.static <T> UnresolvedDataTypeRAW(org.apache.flink.api.common.typeinfo.TypeInformation<T> typeInformation) Data type of an arbitrary serialized type backed byTypeInformation.static DataTypeROW()Data type of a row type with no fields.static DataTypeROW(List<DataTypes.Field> fields) static UnresolvedDataTypeROW(DataTypes.AbstractField... fields) Unresolved data type of a sequence of fields.static DataTypeROW(DataTypes.Field... fields) Data type of a sequence of fields.static UnresolvedDataTypeROW(AbstractDataType<?>... fieldDataTypes) Data type of a sequence of fields.static DataTypeData type of a sequence of fields.static DataTypes.ResolutionSECOND()Resolution in seconds with 6 digits for fractional seconds by default.static DataTypes.ResolutionSECOND(int precision) Resolution in seconds and (possibly) fractional seconds.static DataTypeSMALLINT()Data type of a 2-byte signed integer with values from -32,768 to 32,767.static DataTypeSTRING()Data type of a variable-length character string with defined maximum length.static <T> DataTypeSTRUCTURED(Class<T> implementationClass, DataTypes.Field... fields) Data type of a user-defined object structured type.static DataTypeTIME()Data type of a time WITHOUT time zoneTIMEwith no fractional seconds by default.static DataTypeTIME(int precision) Data type of a time WITHOUT time zoneTIME(p)wherepis the number of digits of fractional seconds (=precision).static DataTypeData type of a timestamp WITHOUT time zoneTIMESTAMPwith 6 digits of fractional seconds by default.static DataTypeTIMESTAMP(int precision) Data type of a timestamp WITHOUT time zoneTIMESTAMP(p)wherepis the number of digits of fractional seconds (=precision).static DataTypeData type of a timestamp WITH LOCAL time zone.static DataTypeTIMESTAMP_LTZ(int precision) Data type of a timestamp WITH LOCAL time zone.static DataTypeData type of a timestamp WITH LOCAL time zoneTIMESTAMP WITH LOCAL TIME ZONEwith 6 digits of fractional seconds by default.static DataTypeTIMESTAMP_WITH_LOCAL_TIME_ZONE(int precision) Data type of a timestamp WITH LOCAL time zoneTIMESTAMP(p) WITH LOCAL TIME ZONEwherepis the number of digits of fractional seconds (=precision).static DataTypeData type of a timestamp WITH time zoneTIMESTAMP WITH TIME ZONEwith 6 digits of fractional seconds by default.static DataTypeTIMESTAMP_WITH_TIME_ZONE(int precision) Data type of a timestamp WITH time zoneTIMESTAMP(p) WITH TIME ZONEwherepis the number of digits of fractional seconds (=precision).static DataTypeTINYINT()Data type of a 1-byte signed integer with values from -128 to 127.static DataTypeVARBINARY(int n) Data type of a variable-length binary string (=a sequence of bytes)VARBINARY(n)wherenis the maximum number of bytes.static DataTypeVARCHAR(int n) Data type of a variable-length character stringVARCHAR(n)wherenis the maximum number of code points.static DataTypes.ResolutionYEAR()Resolution in years with 2 digits for the number of years by default.static DataTypes.ResolutionYEAR(int precision) Resolution in years.
-
Method Details
-
of
Creates aDataTypefrom aLogicalTypewith default conversion class.- Returns:
- the
LogicalTypeconverted to aDataType. - See Also:
-
of
Creates an unresolved type that will be resolved to aDataTypeby analyzing the given class later.During the resolution, Java reflection is used which can be supported by
DataTypeHintannotations for nested, structured types.It will throw an
ValidationExceptionin cases where the reflective extraction needs more information or simply fails.The following examples show how to use and enrich the extraction process:
// returns INT of(Integer.class) // returns TIMESTAMP(9) of(java.time.LocalDateTime.class) // returns an anonymous, unregistered structured type // that is deeply integrated into the API compared to opaque RAW types class User { // extract fields automatically public String name; public int age; // enrich the extraction with precision information public @DataTypeHint("DECIMAL(10,2)") BigDecimal accountBalance; // enrich the extraction with forcing using RAW types public @DataTypeHint(forceRawPattern = "scala.") Address address; // enrich the extraction by specifying defaults public @DataTypeHint(defaultSecondPrecision = 3) Log log; } of(User.class)Note: In most of the cases, the
UnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided. -
of
Creates an unresolved type that will be resolved to aDataTypeby using a fully or partially defined name.It includes both built-in types (e.g. "INT") as well as user-defined types (e.g. "mycat.mydb.Money").
Note: In most of the cases, the
UnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided. -
of
public static UnresolvedDataType of(org.apache.flink.api.common.typeinfo.TypeInformation<?> typeInfo) Creates an unresolved type that will be resolved to aDataTypeby converting the givenTypeInformationlater.DataTypeis richer thanTypeInformationas 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 asRAW(TypeInformation).See
TypeInfoDataTypeConverterfor more information.Note: In most of the cases, the
UnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided. -
CHAR
Data type of a fixed-length character stringCHAR(n)wherenis the number of code points.nmust have a value between 1 andInteger.MAX_VALUE(both inclusive).- See Also:
-
VARCHAR
Data type of a variable-length character stringVARCHAR(n)wherenis the maximum number of code points.nmust have a value between 1 andInteger.MAX_VALUE(both inclusive).- See Also:
-
STRING
Data type of a variable-length character string with defined maximum length. This is a shortcut forVARCHAR(2147483647)for representing JVM strings.- See Also:
-
BOOLEAN
Data type of a boolean with a (possibly) three-valued logic ofTRUE, FALSE, UNKNOWN.- See Also:
-
BINARY
Data type of a fixed-length binary string (=a sequence of bytes)BINARY(n)wherenis the number of bytes.nmust have a value between 1 andInteger.MAX_VALUE(both inclusive).- See Also:
-
VARBINARY
Data type of a variable-length binary string (=a sequence of bytes)VARBINARY(n)wherenis the maximum number of bytes.nmust have a value between 1 andInteger.MAX_VALUE(both inclusive).- See Also:
-
BYTES
Data type of a variable-length binary string (=a sequence of bytes) with defined maximum length. This is a shortcut forVARBINARY(2147483647)for representing JVM byte arrays.- See Also:
-
DECIMAL
Data type of a decimal number with fixed precision and scaleDECIMAL(p, s)wherepis the number of digits in a number (=precision) andsis the number of digits to the right of the decimal point in a number (=scale).pmust have a value between 1 and 38 (both inclusive).smust have a value between 0 andp(both inclusive).- See Also:
-
TINYINT
Data type of a 1-byte signed integer with values from -128 to 127.- See Also:
-
SMALLINT
Data type of a 2-byte signed integer with values from -32,768 to 32,767.- See Also:
-
INT
Data type of a 4-byte signed integer with values from -2,147,483,648 to 2,147,483,647.- See Also:
-
BIGINT
Data type of an 8-byte signed integer with values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.- See Also:
-
FLOAT
Data type of a 4-byte single precision floating point number.- See Also:
-
DOUBLE
Data type of an 8-byte double precision floating point number.- See Also:
-
DATE
Data type of a date consisting ofyear-month-daywith values ranging from0000-01-01to9999-12-31.Compared to the SQL standard, the range starts at year
0000.- See Also:
-
TIME
Data type of a time WITHOUT time zoneTIME(p)wherepis the number of digits of fractional seconds (=precision).pmust have a value between 0 and 9 (both inclusive).An instance consists of
hour:minute:second[.fractional]with up to nanosecond precision and values ranging from00:00:00.000000000to23:59:59.999999999.Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to
LocalTime. A time WITH time zone is not provided. -
TIME
Data type of a time WITHOUT time zoneTIMEwith no fractional seconds by default.An instance consists of
hour:minute:secondwith up to second precision and values ranging from00:00:00to23:59:59.Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to
LocalTime. A time WITH time zone is not provided. -
TIMESTAMP
Data type of a timestamp WITHOUT time zoneTIMESTAMP(p)wherepis the number of digits of fractional seconds (=precision).pmust have a value between 0 and 9 (both inclusive).An instance consists of
year-month-day hour:minute:second[.fractional]with up to nanosecond precision and values ranging from0000-01-01 00:00:00.000000000to9999-12-31 23:59:59.999999999.Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to
LocalDateTime. -
TIMESTAMP
Data type of a timestamp WITHOUT time zoneTIMESTAMPwith 6 digits of fractional seconds by default.An instance consists of
year-month-day hour:minute:second[.fractional]with up to microsecond precision and values ranging from0000-01-01 00:00:00.000000to9999-12-31 23:59:59.999999.Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to
LocalDateTime. -
TIMESTAMP_WITH_TIME_ZONE
Data type of a timestamp WITH time zoneTIMESTAMP(p) WITH TIME ZONEwherepis the number of digits of fractional seconds (=precision).pmust have a value between 0 and 9 (both inclusive).An instance consists of
year-month-day hour:minute:second[.fractional] zonewith up to nanosecond precision and values ranging from0000-01-01 00:00:00.000000000 +14:59to9999-12-31 23:59:59.999999999 -14:59.Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to
OffsetDateTime. -
TIMESTAMP_WITH_TIME_ZONE
Data type of a timestamp WITH time zoneTIMESTAMP WITH TIME ZONEwith 6 digits of fractional seconds by default.An instance consists of
year-month-day hour:minute:second[.fractional] zonewith up to microsecond precision and values ranging from0000-01-01 00:00:00.000000 +14:59to9999-12-31 23:59:59.999999 -14:59.Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to
OffsetDateTime. -
TIMESTAMP_WITH_LOCAL_TIME_ZONE
Data type of a timestamp WITH LOCAL time zoneTIMESTAMP(p) WITH LOCAL TIME ZONEwherepis the number of digits of fractional seconds (=precision).pmust have a value between 0 and 9 (both inclusive).An instance consists of
year-month-day hour:minute:second[.fractional] zonewith up to nanosecond precision and values ranging from0000-01-01 00:00:00.000000000 +14:59to9999-12-31 23:59:59.999999999 -14:59. Leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer toOffsetDateTime.Compared to
ZonedTimestampType, the time zone offset information is not stored physically in every datum. Instead, the type assumesInstantsemantics in UTC time zone at the edges of the table ecosystem. Every datum is interpreted in the local time zone configured in the current session for computation and visualization.This type fills the gap between time zone free and time zone mandatory timestamp types by allowing the interpretation of UTC timestamps according to the configured session timezone.
-
TIMESTAMP_LTZ
Data type of a timestamp WITH LOCAL time zone. This is a synonym forTIMESTAMP_WITH_LOCAL_TIME_ZONE(int). -
TIMESTAMP_WITH_LOCAL_TIME_ZONE
Data type of a timestamp WITH LOCAL time zoneTIMESTAMP WITH LOCAL TIME ZONEwith 6 digits of fractional seconds by default.An instance consists of
year-month-day hour:minute:second[.fractional] zonewith up to microsecond precision and values ranging from0000-01-01 00:00:00.000000 +14:59to9999-12-31 23:59:59.999999 -14:59. Leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer toOffsetDateTime.Compared to
ZonedTimestampType, the time zone offset information is not stored physically in every datum. Instead, the type assumesInstantsemantics in UTC time zone at the edges of the table ecosystem. Every datum is interpreted in the local time zone configured in the current session for computation and visualization.This type fills the gap between time zone free and time zone mandatory timestamp types by allowing the interpretation of UTC timestamps according to the configured session timezone.
-
TIMESTAMP_LTZ
Data type of a timestamp WITH LOCAL time zone. This is a synonym forTIMESTAMP_WITH_LOCAL_TIME_ZONE(). -
INTERVAL
Data type of a temporal interval. There are two types of temporal intervals: day-time intervals with up to nanosecond granularity or year-month intervals with up to month granularity.An interval of day-time consists of
+days hours:months:seconds.fractionalwith values ranging from-999999 23:59:59.999999999to+999999 23:59:59.999999999. The type must be parameterized to one of the following resolutions: interval of days, interval of days to hours, interval of days to minutes, interval of days to seconds, interval of hours, interval of hours to minutes, interval of hours to seconds, interval of minutes, interval of minutes to seconds, or interval of seconds. The value representation is the same for all types of resolutions. For example, an interval of seconds of 70 is always represented in an interval-of-days-to-seconds format (with default precisions):+00 00:01:10.000000).An interval of year-month consists of
+years-monthswith values ranging from-9999-11to+9999-11. The type must be parameterized to one of the following resolutions: interval of years, interval of years to months, or interval of months. The value representation is the same for all types of resolutions. For example, an interval of months of 50 is always represented in an interval-of-years-to-months format (with default year precision):+04-02.Examples:
INTERVAL(DAY(2))for a day-time interval orINTERVAL(YEAR(4))for a year-month interval.- See Also:
-
INTERVAL
public static DataType INTERVAL(DataTypes.Resolution upperResolution, DataTypes.Resolution lowerResolution) Data type of a temporal interval. There are two types of temporal intervals: day-time intervals with up to nanosecond granularity or year-month intervals with up to month granularity.An interval of day-time consists of
+days hours:months:seconds.fractionalwith values ranging from-999999 23:59:59.999999999to+999999 23:59:59.999999999. The type must be parameterized to one of the following resolutions: interval of days, interval of days to hours, interval of days to minutes, interval of days to seconds, interval of hours, interval of hours to minutes, interval of hours to seconds, interval of minutes, interval of minutes to seconds, or interval of seconds. The value representation is the same for all types of resolutions. For example, an interval of seconds of 70 is always represented in an interval-of-days-to-seconds format (with default precisions):+00 00:01:10.000000.An interval of year-month consists of
+years-monthswith values ranging from-9999-11to+9999-11. The type must be parameterized to one of the following resolutions: interval of years, interval of years to months, or interval of months. The value representation is the same for all types of resolutions. For example, an interval of months of 50 is always represented in an interval-of-years-to-months format (with default year precision):+04-02.Examples:
INTERVAL(DAY(2), SECOND(9))for a day-time interval orINTERVAL(YEAR(4), MONTH())for a year-month interval.- See Also:
-
ARRAY
Data type of an array of elements with same subtype.Compared to the SQL standard, the maximum cardinality of an array cannot be specified but is fixed at
Integer.MAX_VALUE. Also, any valid type is supported as a subtype.- See Also:
-
ARRAY
Unresolved data type of an array of elements with same subtype.Compared to the SQL standard, the maximum cardinality of an array cannot be specified but is fixed at
Integer.MAX_VALUE. Also, any valid type is supported as a subtype.Note: Compared to
ARRAY(DataType), this method produces anUnresolvedDataType. In most of the cases, theUnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided.- See Also:
-
MULTISET
Data type of a multiset (=bag). Unlike a set, it allows for multiple instances for each of its elements with a common subtype. Each unique value (includingNULL) is mapped to some multiplicity.There is no restriction of element types; it is the responsibility of the user to ensure uniqueness.
- See Also:
-
MULTISET
Unresolved data type of a multiset (=bag). Unlike a set, it allows for multiple instances for each of its elements with a common subtype. Each unique value (includingNULL) is mapped to some multiplicity.There is no restriction of element types; it is the responsibility of the user to ensure uniqueness.
Note: Compared to
MULTISET(DataType), this method produces anUnresolvedDataType. In most of the cases, theUnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided.- See Also:
-
MAP
Data type of an associative array that maps keys (includingNULL) to values (includingNULL). A map cannot contain duplicate keys; each key can map to at most one value.There is no restriction of key types; it is the responsibility of the user to ensure uniqueness. The map type is an extension to the SQL standard.
- See Also:
-
MAP
public static UnresolvedDataType MAP(AbstractDataType<?> keyDataType, AbstractDataType<?> valueDataType) Unresolved data type of an associative array that maps keys (includingNULL) to values (includingNULL). A map cannot contain duplicate keys; each key can map to at most one value.There is no restriction of key types; it is the responsibility of the user to ensure uniqueness. The map type is an extension to the SQL standard.
Note: Compared to
MAP(DataType, DataType), this method produces anUnresolvedDataType. In most of the cases, theUnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided.- See Also:
-
ROW
Data type of a sequence of fields. A field consists of a field name, field type, and an optional description. The most specific type of a row of a table is a row type. In this case, each column of the row corresponds to the field of the row type that has the same ordinal position as the column.Compared to the SQL standard, an optional field description simplifies the handling with complex structures.
Use
FIELD(String, DataType)orFIELD(String, DataType, String)to construct fields.- See Also:
-
ROW
- See Also:
-
ROW
Data type of a sequence of fields.This is shortcut for
ROW(Field...)where the field names will be generated usingf0, f1, f2, .... -
ROW
Data type of a row type with no fields. It only exists for completeness.- See Also:
-
ROW
Unresolved data type of a sequence of fields. A field consists of a field name, field type, and an optional description. The most specific type of a row of a table is a row type. In this case, each column of the row corresponds to the field of the row type that has the same ordinal position as the column.Compared to the SQL standard, an optional field description simplifies the handling with complex structures.
Use
FIELD(String, AbstractDataType)orFIELD(String, AbstractDataType, String)to construct fields.Note: Compared to
ROW(Field...), this method produces anUnresolvedDataTypewithDataTypes.UnresolvedFields. In most of the cases, theUnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided.- See Also:
-
ROW
Data type of a sequence of fields.This is shortcut for
ROW(AbstractField...)where the field names will be generated usingf0, f1, f2, .... -
NULL
Data type for representing untypedNULLvalues. A null type has no other value exceptNULL, thus, it can be cast to any nullable type similar to JVM semantics.This type helps in representing unknown types in API calls that use a
NULLliteral as well as bridging to formats such as JSON or Avro that define such a type as well.The null type is an extension to the SQL standard.
Note: The runtime does not support this type. It is a pure helper type during translation and planning. Table columns cannot be declared with this type. Functions cannot declare return types of this type.
- See Also:
-
RAW
public static <T> DataType RAW(Class<T> clazz, org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer) Data type of an arbitrary serialized type. This type is a black box within the table ecosystem and is only deserialized at the edges.The raw type is an extension to the SQL standard.
This method assumes that a
TypeSerializerinstance is present. UseRAW(Class)for automatically generating a serializer.- Parameters:
clazz- originating value classserializer- type serializer- See Also:
-
RAW
Unresolved data type of an arbitrary serialized type. This type is a black box within the table ecosystem and is only deserialized at the edges.The raw type is an extension to the SQL standard.
Compared to
RAW(Class, TypeSerializer), this method produces anUnresolvedDataTypewhere no serializer is known and a generic serializer should be used. During the resolution, aRAW(Class, TypeSerializer)with Flink's default RAW serializer is created and automatically configured.Note: In most of the cases, the
UnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided.- See Also:
-
RAW
public static <T> UnresolvedDataType RAW(org.apache.flink.api.common.typeinfo.TypeInformation<T> typeInformation) Data type of an arbitrary serialized type backed byTypeInformation. This type is a black box within the table ecosystem and is only deserialized at the edges.The raw type is an extension to the SQL standard.
Compared to
RAW(Class, TypeSerializer), this method produces anUnresolvedDataTypewhere the serializer will be generated from the enclosedTypeInformationlater.Note: In most of the cases, the
UnresolvedDataTypewill be automatically resolved by the API. At other locations, aDataTypeFactoryis provided.- See Also:
-
STRUCTURED
Data type of a user-defined object structured type. Structured types contain zero, one or more attributes. Each attribute consists of a name and a type. A type cannot be defined so that one of its attribute types (transitively) uses itself.There are two kinds of structured types. Types that are stored in a catalog and are identified by an
ObjectIdentifieror anonymously defined, unregistered types (usually reflectively extracted) that are identified by an implementationClass.This method helps in manually constructing anonymous, unregistered types. This is useful in cases where the reflective extraction using
of(Class)is not applicable. However,of(Class)is the recommended way of creating inline structured types as it also considersDataTypeHints.Structured types are converted to internal data structures by the runtime. The given implementation class is only used at the edges of the table ecosystem (e.g. when bridging to a function or connector). Serialization and equality (
hashCode/equals) are handled by the runtime based on the logical type. An implementation class must offer a default constructor with zero arguments or a full constructor that assigns all attributes.Note: A caller of this method must make sure that the
DataType.getConversionClass()of the given fields matches with the attributes of the given implementation class, otherwise an exception might be thrown during runtime.- See Also:
-
SECOND
Resolution in seconds with 6 digits for fractional seconds by default.- See Also:
-
SECOND
Resolution in seconds and (possibly) fractional seconds. The precision is the number of digits of fractional seconds. It must have a value between 0 and 9 (both inclusive). If no fractional is specified, it is equal to 6 by default.- See Also:
-
MINUTE
Resolution in minutes. -
HOUR
Resolution in hours. -
DAY
Resolution in days. The precision is the number of digits of days. It must have a value between 1 and 6 (both inclusive). If no precision is specified, it is equal to 2 by default.- See Also:
-
DAY
Resolution in days with 2 digits for the number of days by default.- See Also:
-
MONTH
Resolution in months. -
YEAR
Resolution in years. The precision is the number of digits of years. It must have a value between 1 and 4 (both inclusive). If no precision is specified, it is equal to 2.- See Also:
-
YEAR
Resolution in years with 2 digits for the number of years by default.- See Also:
-
FIELD
Field definition with field name and data type. -
FIELD
Field definition with field name, data type, and a description. -
FIELD
Unresolved field definition with field name and data type.Note: Compared to
FIELD(String, DataType), this method produces anDataTypes.UnresolvedFieldthat can contain anUnresolvedDataType. -
FIELD
public static DataTypes.UnresolvedField FIELD(String name, AbstractDataType<?> fieldDataType, String description) Unresolved field definition with field name, unresolved data type, and a description.Note: Compared to
FIELD(String, DataType, String), this method produces anDataTypes.UnresolvedFieldthat can contain anUnresolvedDataType.
-