hive------数据类型

本文介绍了Hive中的数据类型,包括基础数据类型和复杂数据类型,如数组array、集合map以及结构体struct,详细阐述了它们的使用示例。
摘要由CSDN通过智能技术生成

基础数据类型

tinyint 	1
smallint	 2
int 	4
bigint	8
String    可变
boolean  1
double	8
float	4
timestamp	时间格式2019-8-8 12:11:00
binary	字节数组
java中有的数据类型在hive中没有:
long、byte、char、short

复杂数据类型

array:字段名 Array<double>
map:字段名 map<String,double>
struct:封装对象的

数组array举例:

//创建表
create table if not exists arr1(
name string,
score Array<int>
)
row format delimited fields terminated by '\t'
collection items terminated by ','
;
//加入数据
zhangsan 90,80,99
lisi     80,99,85
//查询
select a.name,a.score[0],a.score[2] where a.score[1]>80
//结果
zhangsan 80 99
//数组越界不报错
a.score[3] = null

集合map:

//创建表
create table if not exists map1(
name string,
scor
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值