hive数据类型

官网介绍:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types
本章将介绍hive不同的数据类型,用于创建表,hive数据类型分为四种类型,如下:
- 数值类型(Numeric Type)
- 时间类型(Date/Time Type)
- 字符串类型(string Type)
- misc Type
- 复杂类型(complex Type)
1.numericType

类型后缀示例数据范围存储说明
tinyintY10Y-128 to 1271 byte
smallintS10S-32768-327672 byte
integer-10-2,147,483,648 to 2,147,483,648 to 2,147,483,6474 byte
int-10-2,147,483,648 to 2,147,483,648 to 2,147,483,6474 byte2.2.0integer的同义词引入
bigintL10L-9,223,372,036,854,775,808 to 9,223,372,036,854,775,8078 byte
float4 byte
double8 byte
double precisiondouble的别名 avaliable starting with 2.2.0
decimal0.11.0引入,精度38位,0.13.0引入用户可定义精度和规模
numericsame as decimal ,starting with 3.0.0

2.Date/Time Type

类型说明
timestampstarting with 0.8.0
datestarting with 0.12.0
intervalstarting with 1.2.0

3.字符串类型
可以使用单引号(”)或双引号(“”)来指定

数据类型长度版本说明
string
varchar1-653550.12.0
char2550.13.0

4.misc Type

类型版本
boolean
binary0.8.0

5.复杂类型

类型实例版本
arraysarray<data_type>
mapsmap<primitive_type,data_type>
structsstruct<col_name:data_type[comment col_comment],…>
unionuniontype<data_type,data_type,…>0.7.0

3.时间戳
支持传统的UNIX时间戳可选的纳秒精度。他支持java.sql.timestamp格式”yyyy-MM-dd HH:MM:SS.fffffffff”和”yyyy-MM-dd HH:MM:ss.ffffffff”
4.日期
yyyy-MM-dd
5.小数点
DECIMAL(precision,scale)
decimal(10,0)
二.联合类型


版权声明:本文为tpyqwe原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。