When you import data from a database to MaxCompute or export data from MaxCompute to another database during data migration or integration, you must configure the data type mappings of table fields based on the data type mapping table provided in this topic. Correct data type mappings can ensure that data is correctly stored, processed, and queried in different databases. This prevents data loss or damage and improves work efficiency. This topic describes the data type mappings between MaxCompute and Hive, Oracle, and MySQL.
Data type mapping table
The following table describes the data type mappings between MaxCompute and Hive, Oracle, and MySQL.
Data type of MaxCompute | Data type of Hive | Data type of Oracle | Data type of MySQL |
BOOLEAN | BOOLEAN | None Note This data type is supported in Oracle Database 23c and later. | None Note
|
TINYINT | TINYINT | NUMBER(3,0) | TINYINT |
SMALLINT | SMALLINT | NUMBER(5,0) | SMALLINT |
INT | INT | NUMBER(7,0) | MEDIUMINT |
INT | INT | NUMBER(10,0) | INT |
BIGINT | BIGINT | NUMBER(20,0) | BIGINT |
FLOAT | FLOAT | BINARY_FLOAT Note This data type is supported in Oracle Database 10g and later. | FLOAT |
DOUBLE | DOUBLE | BINARY_DOUBLE Note This data type is supported in Oracle Database 10g and later. | DOUBLE |
DECIMAL | DECIMAL | NUMBER(P,S) |
|
STRING | STRING |
|
|
VARCHAR | VARCHAR |
| VARCHAR |
STRING | CHAR | CHAR | CHAR |
BINARY | BINARY | RAW |
|
TIMESTAMP | TIMESTAMP | TIMESTAMP WITH TIME ZONE | TIMESTAMP |
TIMESTAMP_NTZ | TIMESTAMP Note This data type is supported in Hive 3 and later. | DATETIME | TIMESTAMP |
DATE | DATE | DATE | DATE |
DATETIME | DATE | DATE | DATETIME |
ARRAY | ARRAY | Not supported | Not supported |
MAP |
| Not supported | Not supported |
STRUCT | STRUCT | Not supported | Not supported |
Not supported | UNION | Not supported | Not supported |
Not supported | Not supported | BLOB | BLOB |
References
For more information about the mappings between built-in functions of MaxCompute and built-in functions of Hive, MySQL, and Oracle, see Mappings between built-in functions of MaxCompute and built-in functions of Hive, MySQL, and Oracle.
For more information about the data type mappings between MaxCompute and Hologres, see Data types.