DataType#

The DataType class provides factory methods for creating data types used in schema definitions, UDF return types, and other type specifications in the DataFrame API.

Example:

>>> from pyflink.dataframe import DataType
>>> schema = {"id": DataType.int64(), "name": DataType.string(), "score": DataType.float64()}

DataType(_table_type)

DataType for DataFrame API.

DataType.not_null()

Return a non-nullable version of this type.

DataType.nullable()

Return a nullable version of this type.

DataType.int8()

8-bit signed integer type (TINYINT).

DataType.int16()

16-bit signed integer type (SMALLINT).

DataType.int32()

32-bit signed integer type (INT).

DataType.int64()

64-bit signed integer type (BIGINT).

DataType.float32()

32-bit floating point type (FLOAT).

DataType.float64()

64-bit floating point type (DOUBLE).

DataType.decimal(precision, scale)

Decimal type with specified precision and scale.

DataType.string()

Variable-length string type (VARCHAR).

DataType.fixed_size_string(length)

Fixed-length character type (CHAR(n)).

DataType.variant()

Variant type that can store a value of any type.

DataType.binary()

Binary type (BYTES).

DataType.fixed_size_binary(length)

Fixed-length binary type (BINARY(n)).

DataType.null()

Null type (NULL).

DataType.bool()

Boolean type.

DataType.date()

Date type (year, month, day).

DataType.time([precision])

Time type (hour, minute, second, fractional seconds).

DataType.timestamp([precision])

Timestamp type without time zone.

DataType.timestamp_ltz([precision])

Timestamp type with local time zone.

DataType.list(dtype)

List type with element type.

DataType.map(key_type, value_type)

Map type with key and value types.

DataType.struct(fields)

Struct/Row type with named fields.

DataType.tensor(dtype, shape)

Fixed-shape tensor type.