pyflink.dataframe.datatype.DataType#
- class DataType(_table_type: DataType)[source]#
DataType for DataFrame API.
This class provides a factory method style for creating data types. It wraps the underlying Flink Table API DataType for compatibility.
- Example::
>>> from pyflink.dataframe import DataType >>> DataType.int32() >>> DataType.int64() >>> DataType.string() >>> DataType.list(DataType.int32()) >>> DataType.struct({"name": DataType.string(), "age": DataType.int32()})
Methods
binary()Binary type (BYTES).
bool()Boolean type.
boolean()Boolean type.
date()Date type (year, month, day).
decimal(precision, scale)Decimal type with specified precision and scale.
fixed_size_binary(length)Fixed-length binary type (BINARY(n)).
fixed_size_string(length)Fixed-length character type (CHAR(n)).
float32()32-bit floating point type (FLOAT).
float64()64-bit floating point type (DOUBLE).
int16()16-bit signed integer type (SMALLINT).
int32()32-bit signed integer type (INT).
int64()64-bit signed integer type (BIGINT).
int8()8-bit signed integer type (TINYINT).
list(dtype)List type with element type.
map(key_type, value_type)Map type with key and value types.
not_null()Return a non-nullable version of this type.
null()Null type (NULL).
nullable()Return a nullable version of this type.
row(fields)Struct/Row type with named fields.
string()Variable-length string type (VARCHAR).
struct(fields)Struct/Row type with named fields.
tensor(dtype, shape)Fixed-shape tensor type.
time([precision])Time type (hour, minute, second, fractional seconds).
timestamp([precision])Timestamp type without time zone.
timestamp_ltz([precision])Timestamp type with local time zone.
variant()Variant type that can store a value of any type.