Data Types

This page describes the data types supported in PyFlink Table API.

Data Type

A data type describes the logical type of a value in the table ecosystem. It can be used to declare input and/or output types of Python user-defined functions. Users of the Python Table API work with instances of pyflink.table.types.DataType within the Python Table API or when defining user-defined functions.

A DataType instance declares the logical type which does not imply a concrete physical representation for transmission or storage. All pre-defined data types are available in pyflink.table.types and can be instantiated with the utility methods defined in pyflink.table.types.DataTypes.

A list of all pre-defined data types can be found below.

Data Type and Python Type Mapping

A data type can be used to declare input and/or output types of Python user-defined functions. The inputs will be converted to Python objects corresponding to the data type and the type of the user-defined functions result must also match the defined data type.

For vectorized Python UDF, the input types and output type are pandas.Series. The element type of the pandas.Series corresponds to the specified data type.

Data TypePython TypePandas Type
BOOLEANboolnumpy.bool_
TINYINTintnumpy.int8
SMALLINTintnumpy.int16
INTintnumpy.int32
BIGINTintnumpy.int64
FLOATfloatnumpy.float32
DOUBLEfloatnumpy.float64
VARCHARstrstr
VARBINARYbytesbytes
DECIMALdecimal.Decimaldecimal.Decimal
DATEdatetime.datedatetime.date
TIMEdatetime.timedatetime.time
TimestampTypedatetime.datetimedatetime.datetime
LocalZonedTimestampTypedatetime.datetimedatetime.datetime
INTERVAL YEAR TO MONTHintNot Supported Yet
INTERVAL DAY TO SECONDdatetime.timedeltaNot Supported Yet
ARRAYlistnumpy.ndarray
MULTISETlistNot Supported Yet
MAPdictNot Supported Yet
ROWRowdict