MySQL type mapping
The tables below list every MySQL column type (MySQL 8.0 Data Types) and the Kotlin type produced when the column is read into a DataFrame. Aliases are canonicalised by MySQL at CREATE TABLE time, so DataFrame only ever sees the canonical type; they are listed in the same row as the canonical type for reference.
Column nullability is determined from the metadata provided by the JDBC driver. If the driver does not explicitly report a column as non-nullable, it is mapped to a nullable Kotlin type (Int? instead of Int).
Numeric types
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
|
|
| 1-byte signed integer ( |
|
|
| 1-byte unsigned integer ( |
| (alias only) |
| Stored as |
|
|
| 2-byte signed integer. |
|
|
| 2-byte unsigned integer. |
|
|
| 3-byte signed integer. |
|
|
| 3-byte unsigned integer. |
|
|
| 4-byte signed integer. |
|
|
| MySQL override: fits in |
|
|
| 8-byte signed integer. |
|
|
| MySQL override: exceeds |
|
|
| Fixed-point. |
|
|
| 4-byte float. Becomes |
|
|
| 8-byte float. |
| (alias only) |
| By default |
| none |
| Reported as |
Date and time types
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
| none |
| |
| none |
|
|
| none |
| Preprocessed from |
| none |
| Preprocessed from |
| none |
| 1-byte year ( |
String types
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
|
|
| Fixed-length text. Max |
|
|
| Variable-length text. |
| none |
| Fixed-length binary. |
|
|
| Variable-length binary. |
| none |
| Up to 255 bytes. |
| none |
| Up to 255 bytes. |
| none |
| Up to 64 KiB. |
| none |
| Up to 64 KiB. |
|
|
| Up to 16 MiB. |
|
|
| Up to 16 MiB. |
| none |
| Up to 4 GiB. |
| none |
| Up to 4 GiB. |
| none |
| Enumeration; values read as their string form. |
| none |
| Comma-separated set of values, as a single string. |
JSON
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
| none |
| Validated JSON text. Physically distinct from |
Spatial types
All spatial types are read as ByteArray (WKB / EWKB binary as reported by the driver).
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
| none |
| |
| none |
| |
| none |
| |
| none |
| |
| none |
| |
| none |
| |
| none |
| |
| none |
|
MySQL specifics
INT UNSIGNEDandBIGINT UNSIGNEDare the only types that need MySQL-specific handling.INT UNSIGNEDis widened toLong;BIGINT UNSIGNEDbecomesBigIntegerbecause its range exceedsLong.The value of
REALdepends on theREAL_AS_FLOATSQL mode: defaultREALisDOUBLE; withREAL_AS_FLOATset, it'sFLOAT.Display width (
INT(11)) andZEROFILLare server-side metadata and are not surfaced by MySQL Connector/J ingetColumnTypeName(); DataFrame only ever sees the canonical name. Both attributes are deprecated for numeric types as of MySQL 8.0.17 — see Numeric Type Attributes.TINYINT(1)is a special case: MySQL Connector/J reports it asTypes.BIT(→Boolean) by default because of the driver'stinyInt1isBitproperty. SettinyInt1isBit=falsein the JDBC URL to read it asIntinstead.
Unsupported types
Spatial types have no native Kotlin representation — read as raw WKB
ByteArray.VECTOR(MySQL 9.0+); the driver reports it as a binary type, so DataFrame reads it asByteArray.