Data Types#

Describes the data type of a value in the table ecosystem. Instances of this class can be used to declare input and/or output types of operations.

DataType has two responsibilities: declaring a logical type and giving hints about the physical representation of data to the optimizer. While the logical type is mandatory, hints are optional but useful at the edges to other APIs.

The logical type is independent of any physical representation and is close to the “data type” terminology of the SQL standard.

Physical hints are required at the edges of the table ecosystem. Hints indicate the data format that an implementation expects.

DataTypes.NULL()

Data type for representing untyped null (None) values.

DataTypes.CHAR(length[, nullable])

Data type of a fixed-length character string.

DataTypes.VARCHAR(length[, nullable])

Data type of a variable-length character string.

DataTypes.STRING([nullable])

Data type of a variable-length character string with defined maximum length.

DataTypes.BOOLEAN([nullable])

Data type of a boolean with a (possibly) three-valued logic of TRUE, FALSE, UNKNOWN.

DataTypes.BINARY(length[, nullable])

Data type of a fixed-length binary string (=a sequence of bytes).

DataTypes.VARBINARY(length[, nullable])

Data type of a variable-length binary string (=a sequence of bytes)

DataTypes.BYTES([nullable])

Data type of a variable-length binary string (=a sequence of bytes) with defined maximum length.

DataTypes.DECIMAL(precision, scale[, nullable])

Data type of a decimal number with fixed precision and scale.

DataTypes.TINYINT([nullable])

Data type of a 1-byte signed integer with values from -128 to 127.

DataTypes.SMALLINT([nullable])

Data type of a 2-byte signed integer with values from -32,768 to 32,767.

DataTypes.INT([nullable])

Data type of a 2-byte signed integer with values from -2,147,483,648 to 2,147,483,647.

DataTypes.BIGINT([nullable])

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.

DataTypes.FLOAT([nullable])

Data type of a 4-byte single precision floating point number.

DataTypes.DOUBLE([nullable])

Data type of an 8-byte double precision floating point number.

DataTypes.DATE([nullable])

Data type of a date consisting of year-month-day with values ranging from 0000-01-01 to 9999-12-31.

DataTypes.TIME([precision, nullable])

Data type of a time WITHOUT time zone.

DataTypes.TIMESTAMP([precision, nullable])

Data type of a timestamp WITHOUT time zone.

DataTypes.TIMESTAMP_WITH_LOCAL_TIME_ZONE([...])

Data type of a timestamp WITH LOCAL time zone.

DataTypes.TIMESTAMP_LTZ([precision, nullable])

Data type of a timestamp WITH LOCAL time zone.

DataTypes.ARRAY(element_type[, nullable])

Data type of an array of elements with same subtype.

DataTypes.LIST_VIEW(element_type)

Data type of a pyflink.table.data_view.ListView.

DataTypes.MAP(key_type, value_type[, nullable])

Data type of an associative array that maps keys to values.

DataTypes.MAP_VIEW(key_type, value_type)

Data type of a pyflink.table.data_view.ListView.

DataTypes.MULTISET(element_type[, nullable])

Data type of a multiset (=bag).

DataTypes.ROW([row_fields, nullable])

Data type of a sequence of fields.

DataTypes.FIELD(name, data_type[, description])

Field definition with field name, data type, and a description.

DataTypes.SECOND([precision])

Resolution in seconds and (possibly) fractional seconds.

DataTypes.MINUTE()

Resolution in minutes.

DataTypes.HOUR()

Resolution in hours.

DataTypes.DAY([precision])

Resolution in days.

DataTypes.MONTH()

Resolution in months.

DataTypes.YEAR([precision])

Resolution in years with 2 digits for the number of years by default.

DataTypes.INTERVAL(upper_resolution[, ...])

Data type of a temporal interval.