All Products
Search
Document Center

MaxCompute:Data type mappings between MaxCompute and Hive, MySQL, Oracle, and Hologres

Last Updated:Mar 26, 2026

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 typeHive typeOracle typeMySQL typeNotes
BOOLEANBOOLEANNoneNoneOracle supports the BOOLEAN data type starting from version 23C. In MySQL, use TINYINT(1) instead.
TINYINTTINYINTNUMBER(3,0)TINYINTSafe mapping in all three systems.
SMALLINTSMALLINTNUMBER(5,0)SMALLINTSafe mapping in all three systems.
INTINTNUMBER(7,0)MEDIUMINTMaxCompute INT (32-bit) maps to MySQL MEDIUMINT (24-bit). For the full 32-bit range, map to MySQL INT instead.
INTINTNUMBER(10,0)INTSafe mapping for the full 32-bit integer range.
BIGINTBIGINTNUMBER(20,0)BIGINTSafe mapping in all three systems.
FLOATFLOATBINARY_FLOATFLOATOracle BINARY_FLOAT is supported in Oracle Database 10g and later.
DOUBLEDOUBLEBINARY_DOUBLEDOUBLEOracle BINARY_DOUBLE is supported in Oracle Database 10g and later.
DECIMALDECIMALNUMBER(P,S)DECIMAL, NUMERICCheck that the precision (P) and scale (S) values are within the target system's limits before mapping.
STRINGSTRINGVARCHAR, VARCHAR2, CHAR, NCHAR, NVARCHAR3VARCHAR, CHARMaxCompute 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.
VARCHARVARCHARVARCHAR, VARCHAR2, CHAR, NCHAR, NVARCHAR3VARCHARSame Oracle and MySQL targets as STRING. Choose the target type based on the length constraint of the source VARCHAR column.
STRINGCHARCHARCHARHive and Oracle CHAR types are fixed-length and pad shorter values with spaces. Confirm that trailing spaces are acceptable in the target system.
BINARYBINARYRAWBINARY, VARBINARY
TIMESTAMPTIMESTAMPTIMESTAMP WITH TIME ZONETIMESTAMP
TIMESTAMP_NTZTIMESTAMPDATETIMETIMESTAMPHive TIMESTAMP without time zone is supported in Hive 3 and later.
DATEDATEDATEDATE
DATETIMEDATEDATEDATETIMEMaxCompute DATETIME is in UTC+8 and accurate to the millisecond.
ARRAYARRAYNot supportedNot supportedARRAY, 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.
MAPMAP<key,value>Not supportedNot supportedSee note for ARRAY.
STRUCTSTRUCTNot supportedNot supportedSee note for ARRAY.
Not supportedUNIONNot supportedNot supportedHive UNION has no equivalent in MaxCompute, Oracle, or MySQL.
Not supportedNot supportedBLOBBLOBBLOB 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 typeHologres typeSupported versionNotes
STRING, VARCHARTEXTAll Hologres versions
BIGINTINT8All Hologres versions
INTINT4, INTAll Hologres versions
FLOATFLOAT4, REALAll Hologres versions
DOUBLEFLOAT, FLOAT8All Hologres versions
BOOLEANBOOLAll Hologres versions
DATETIMETIMESTAMP WITH TIME ZONEAll Hologres versionsMaxCompute DATETIME is in UTC+8 with millisecond precision. The value range is 0000-01-01 to 9999-12-31.
DECIMALNUMERICAll Hologres versionsIf 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.
TIMESTAMPTIMESTAMP WITH TIME ZONEHologres V0.8 and laterMaxCompute 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 laterMaxCompute 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 laterMaxCompute 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.
DATEDATEHologres V0.8 and later
SMALLINTINT2 (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.
TINYINTINT2 (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.
CHARNot supportedNot 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
BINARYBYTEAHologres V0.9 and later
ARRAY\<TINYINT\>Not supportedNot supported
ARRAY\<SMALLINT\>Not supportedNot 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.