Use these mapping tables when migrating or integrating data between MaxCompute and Hive, MySQL, Oracle, or Hologres. Mapping fields to the correct target type prevents data loss, precision loss, and query errors.
Data type mappings between MaxCompute and Hive, MySQL, and Oracle
The following table lists data type mappings between MaxCompute and Hive, Oracle, and MySQL. The Notes column highlights precision differences, version constraints, and behavioral caveats to check before mapping.
| MaxCompute type | Hive type | Oracle type | MySQL type | Notes |
|---|---|---|---|---|
| BOOLEAN | BOOLEAN | None | None | Oracle supports the BOOLEAN data type starting from version 23C. In MySQL, use TINYINT(1) instead. |
| TINYINT | TINYINT | NUMBER(3,0) | TINYINT | Safe mapping in all three systems. |
| SMALLINT | SMALLINT | NUMBER(5,0) | SMALLINT | Safe mapping in all three systems. |
| INT | INT | NUMBER(7,0) | MEDIUMINT | MaxCompute INT (32-bit) maps to MySQL MEDIUMINT (24-bit). For the full 32-bit range, map to MySQL INT instead. |
| INT | INT | NUMBER(10,0) | INT | Safe mapping for the full 32-bit integer range. |
| BIGINT | BIGINT | NUMBER(20,0) | BIGINT | Safe mapping in all three systems. |
| FLOAT | FLOAT | BINARY_FLOAT | FLOAT | Oracle BINARY_FLOAT is supported in Oracle Database 10g and later. |
| DOUBLE | DOUBLE | BINARY_DOUBLE | DOUBLE | Oracle BINARY_DOUBLE is supported in Oracle Database 10g and later. |
| DECIMAL | DECIMAL | NUMBER(P,S) | DECIMAL, NUMERIC | Check that the precision (P) and scale (S) values are within the target system's limits before mapping. |
| STRING | STRING | VARCHAR, VARCHAR2, CHAR, NCHAR, NVARCHAR3 | VARCHAR, CHAR | MaxCompute STRING is an unbounded type. Map to the Oracle or MySQL string type that best fits the expected maximum length. All listed Oracle types are character-based, so character-set differences are generally not a concern. |
| VARCHAR | VARCHAR | VARCHAR, VARCHAR2, CHAR, NCHAR, NVARCHAR3 | VARCHAR | Same Oracle and MySQL targets as STRING. Choose the target type based on the length constraint of the source VARCHAR column. |
| STRING | CHAR | CHAR | CHAR | Hive and Oracle CHAR types are fixed-length and pad shorter values with spaces. Confirm that trailing spaces are acceptable in the target system. |
| BINARY | BINARY | RAW | BINARY, VARBINARY | — |
| TIMESTAMP | TIMESTAMP | TIMESTAMP WITH TIME ZONE | TIMESTAMP | — |
| TIMESTAMP_NTZ | TIMESTAMP | DATETIME | TIMESTAMP | Hive TIMESTAMP without time zone is supported in Hive 3 and later. |
| DATE | DATE | DATE | DATE | — |
| DATETIME | DATE | DATE | DATETIME | MaxCompute DATETIME is in UTC+8 and accurate to the millisecond. |
| ARRAY | ARRAY | Not supported | Not supported | ARRAY, MAP, and STRUCT are MaxCompute complex types with no direct equivalent in Oracle or MySQL. Redesign the schema or serialize these fields to a string or BLOB column before migrating. |
| MAP | MAP<key,value> | Not supported | Not supported | See note for ARRAY. |
| STRUCT | STRUCT | Not supported | Not supported | See note for ARRAY. |
| Not supported | UNION | Not supported | Not supported | Hive UNION has no equivalent in MaxCompute, Oracle, or MySQL. |
| Not supported | Not supported | BLOB | BLOB | BLOB has no direct equivalent in MaxCompute. Store binary data in a BINARY or STRING column, or keep BLOB data in the source system. |
Data type mappings between MaxCompute and Hologres
The following table lists data type mappings when creating a foreign table in Hologres sourced from a MaxCompute table.
| MaxCompute type | Hologres type | Supported version | Notes |
|---|---|---|---|
| STRING, VARCHAR | TEXT | All Hologres versions | — |
| BIGINT | INT8 | All Hologres versions | — |
| INT | INT4, INT | All Hologres versions | — |
| FLOAT | FLOAT4, REAL | All Hologres versions | — |
| DOUBLE | FLOAT, FLOAT8 | All Hologres versions | — |
| BOOLEAN | BOOL | All Hologres versions | — |
| DATETIME | TIMESTAMP WITH TIME ZONE | All Hologres versions | MaxCompute DATETIME is in UTC+8 with millisecond precision. The value range is 0000-01-01 to 9999-12-31. |
| DECIMAL | NUMERIC | All Hologres versions | If precision is not specified for the MaxCompute DECIMAL type, the default is (38, 18). When creating a table with IMPORT FOREIGN SCHEMA, the system automatically converts the precision. |
| TIMESTAMP | TIMESTAMP WITH TIME ZONE | Hologres V0.8 and later | MaxCompute TIMESTAMP values range from 0000-01-01 00:00:00.000000000 to 9999-12-31 23:59:59.999999999 (nanosecond precision). Hologres TIMESTAMPTZ is accurate to the millisecond; Hologres automatically converts the precision to the millisecond when Hologres reads data. |
| CHAR(n) | CHAR(n) (default); TEXT (optional) | Hologres V0.8 and later | MaxCompute CHAR(n) is a fixed-length string with a maximum n of 255. Shorter strings are padded with spaces. To map to TEXT instead, run set hg_enable_convert_type_for_foreign_table = true and modify the field type to TEXT when creating the table. |
| VARCHAR(n) | VARCHAR(n) (default); TEXT (optional) | Hologres V0.8 and later | MaxCompute VARCHAR(n) is a variable-length string. Valid values of n: 1 to 65535. To map to TEXT instead, run set hg_enable_convert_type_for_foreign_table = true and modify the field type to TEXT when creating the table. |
| DATE | DATE | Hologres V0.8 and later | — |
| SMALLINT | INT2 (default); INT8 (optional) | All Hologres versions (V0.8 uses INT4; V0.9 and later use INT2) | To map to INT8 instead, run set hg_enable_convert_type_for_foreign_table = true and modify the field type to INT8 when creating the table. |
| TINYINT | INT2 (default); INT8 (optional) | All Hologres versions (V0.8 uses INT4; V0.9 and later use INT2) | To map to INT8 instead, run set hg_enable_convert_type_for_foreign_table = true and modify the field type to INT8 when creating the table. |
| CHAR | Not supported | Not supported | — |
| ARRAY\<INT\> | INT4[] | Hologres V0.8 and later | — |
| ARRAY\<BIGINT\> | INT8[] | Hologres V0.8 and later | — |
| ARRAY\<FLOAT\> | FLOAT4[] | Hologres V0.8 and later | — |
| ARRAY\<DOUBLE\> | FLOAT8[] | Hologres V0.8 and later | — |
| ARRAY\<BOOLEAN\> | BOOLEAN[] | Hologres V0.8 and later | — |
| ARRAY\<STRING\> | TEXT[] | Hologres V0.8 and later | — |
| BINARY | BYTEA | Hologres V0.9 and later | — |
| ARRAY\<TINYINT\> | Not supported | Not supported | — |
| ARRAY\<SMALLINT\> | Not supported | Not supported | — |
If a MaxCompute table has a field whose type is not supported by Hologres, queries that do not select that field still return results for all other fields.
What's next
For 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.