Skip to content

Data Type Mapping

MySQL/TiDB Type Mapping

MySQL/TiDB TypePaimon/Flink Type
BOOLEAN
TINYINTTINYINT
TINYINT UNSIGNED
SMALLINT
SMALLINT
SMALLINT UNSIGNED
MEDIUMINT
INT
INT
INT UNSIGNED
BIGINT
BIGINT
DECIMAL(20, 0)
FLOAT
FLOAT UNSIGNED
FLOAT
REAL
DOUBLE
DOUBLE PRECISION
DOUBLE
NUMERIC(p, s)
DECIMAL(p, s)
FIXED(p, s)
DECIMAL(p, s)
DATEDATE
TIME [(p)]TIME [(p)]
TIMESTAMP [(p)]
DATETIME [(p)]
TIMESTAMP [(p)]
CHAR(n)
VARCHAR(n)
TEXT
ENUM
JSON
STRING
BINARY
VARBINARY
BLOB
BYTES

TINYINT(1) is mapped to the BOOLEAN type.
For TINYINT(1), the number 0 is converted to false, and other numbers are converted to true. This behavior follows the MySQL JDBC driver specification.
BIGINT UNSIGNED is mapped to DECIMAL(20, 0).

References:

Paimon Data Types

CategoryTypeDescription
NumericTINYINTA 1-byte signed integer with a range from -128 to 127.
NumericSMALLINTA 2-byte signed integer with a range from -32,768 to 32,767.
NumericINTA 4-byte signed integer with a range from -2,147,483,648 to 2,147,483,647.
NumericBIGINTAn 8-byte signed integer with a range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
NumericFLOATA 4-byte single-precision floating-point number.
NumericDOUBLEAn 8-byte double-precision floating-point number.
NumericDECIMAL(p, s)A fixed-precision decimal number.
p is the total number of digits (precision), and s is the number of digits after the decimal point (scale).
For example, DECIMAL(10, 2).
StringCHAR(n)A fixed-length string with a length of n.
StringVARCHAR(n)A variable-length string with a maximum length of n.
StringSTRINGA variable-length string with virtually unlimited length.
(Equivalent to VARCHAR(2147483647) in Flink).
This is the most commonly used string type.
BinaryBINARY(n)Fixed-length binary data with a length of n.
BinaryVARBINARY(n)Variable-length binary data with a maximum length of n.
BinaryBYTESVariable-length binary data.
(Equivalent to VARBINARY(2147483647) in Flink).
BooleanBOOLEANTRUE, FALSE, or NULL.
DateDATEA date type, containing only year, month, and day. For example, 2023-10-27.
TimeTIME(p)A time type, containing only hour, minute, second, and fractional seconds.
p is the precision of the fractional seconds, with a range from 0 to 9.
DateTimeTIMESTAMP(p)
or TIMESTAMP WITHOUT TIME ZONE
A timestamp without a time zone. It represents the literal time value regardless of the session's time zone.
DateTimeTIMESTAMP_LTZ(p)
or TIMESTAMP(p) WITH LOCAL TIME ZONE
A timestamp with a local time zone.
When writing or reading, it is converted based on the Flink session's local time zone and stored as a UTC value in Paimon.
For example, '2023-10-27 10:00:00' is written in a Flink session with the UTC+8 time zone.
If the Flink session time zone is changed to UTC and the data is read, the result will be '2023-10-27 02:00:00'.
CollectionARRAY<T>An array of elements with type T. For example, ARRAY<STRING>.
CollectionMAP<K, V>A map with key type K and value type V. For example, MAP<STRING, INT>.
CollectionROW<f1 T1, f2 T2, ...>
or STRUCT<...>
A struct type, containing multiple named fields. For example, ROW<name STRING, age INT>.

Yaoqing AI Big Data