Background
The MaxCompute V1.0 data type edition is one of three data type editions in MaxCompute.
This edition is intended for early MaxCompute projects whose dependent components do not support the V2.0 data type edition.
Project configuration
A MaxCompute project uses the V1.0 data type edition when all three of the following project properties are set:
setproject odps.sql.type.system.odps2=false; -- Disable MaxCompute V2.0 data types.
setproject odps.sql.decimal.odps2=false; -- Disable the DECIMAL type in MaxCompute V2.0.
setproject odps.sql.hive.compatible=false; -- Disable Hive-compatible data types.Supported data types
Basic data types
All basic data types support NULL values.
Data type | Constant example | Description |
BIGINT |
|
|
DOUBLE |
| 64-bit binary floating point. |
DECIMAL |
| Exact numeric type. Default precision: |
STRING |
|
|
DATETIME |
|
|
BOOLEAN |
|
|
Usage notes
constants
Integer constants: Processed as BIGINT by default. If a constant exceeds the BIGINT range (for example,
1,000,000,000,000,000,000,000,000), it is processed as DOUBLE. For example,1inSELECT 1 + a;is BIGINT.DECIMAL constants: When inserting a DECIMAL constant into a field, use the
BDsuffix format. Example:INSERT INTO test_tb(a) VALUES (3.5BD);STRING concatenation: STRING constants can be concatenated. For example,
abcandxyzconcatenate toabcxyz.
Partition key columns: Partition key columns of partitioned tables must be of the STRING type.
Built-in functions: Built-in functions that include parameters of MaxCompute V2.0 data types cannot be used under the V1.0 data type edition.
Differences from the MaxCompute V2.0 data type edition
The LIMIT, ORDER BY, DISTRIBUTE BY, SORT BY, and CLUSTER BY operations behave differently between the MaxCompute V1.0 data type edition and the MaxCompute V2.0 data type edition.
The following example uses
SELECT * FROM t1 UNION ALL SELECT * FROM t2 LIMIT 10;.Edition
Equivalent statement
MaxCompute V1.0
SELECT * FROM t1 UNION ALL SELECT * FROM (SELECT * FROM t2 LIMIT 10) t2;MaxCompute V2.0
SELECT * FROM (SELECT * FROM t1 UNION ALL SELECT * FROM t2) t LIMIT 10;The IN expression behaves differently between the V1.0 and V2.0 data type editions.
The following example uses
a IN (1, 2, 3).Edition
Behavior
MaxCompute V1.0
All values in the parentheses must be of the same type.
MaxCompute V2.0
Values in the parentheses can be implicitly converted to the same type.
Complex data types
Complex data types can be nested within each other. For built-in functions related to complex types, see ARRAY, MAP, and STRUCT.
Data type | Definition | Constructor |
ARRAY |
|
|
MAP |
|
|
STRUCT |
|
|