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)
二.联合类型

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值