Basic type
< p align="center">Type name |
Size |
Minimum value |
Maximum value |
Example |
TINYINT |
1byte |
-128 |
127 |
100Y |
SMALLINT |
2byte |
– 32768 |
32767 |
|
INT |
4byte |
< p align="center">-2,147,483,648 |
2,147,483,647< /p> |
100 |
BIGINT |
8byte |
-9,223,372,036,854,770,000 |
9,223,372,036,854,770,000 |
100L |
FLOAT |
4byte |
4 words Section precision |
3.1415926 | |
DOUBLE |
8byte |
8-byte double precision |
3.1415926< /p> |
|
DECIMAL |
— |
High precision floating point numbers |
DECIMAL(9, 8) |
|
BOOLEAN |
— |
Boolean type, TRUE/FALSE |
TRUE |
|
BINARY |
— |
Binary type< /p> |
— |
Integer type, default use bigint, int.
Floating point type, default use double, float.
String type
For hive string type, string is used by default.
equivalent to the varchar type of the mysql database, this type is a variable string, but it cannot declare the maximum number of characters that can be stored in it, theoretically it Can store 2GB of characters.
complex type
MAP
MAP is a combination of a set of key-value pairs, and VALUE can be accessed through KEY, and the separator between key-values must also be specified when creating the table. Such as: {“opt_obj”:”11111″,”type_name”:”mkt”}
ARRAY
ARRAY represents a set of the same data type. The subscript starts from zero and can be accessed by subscript, such as: [“cn”,”jp”,”us”]
STRUCT
Not commonly used, similar to C, C# language, Hive The defined struct type can also be accessed using dots. When loading data from a file, the data separator in the file must be the same as that specified in the table creation.
Such as: {“column1″:”aaa”,”column2″:”bbb”}