hive常用命令

1.启动服务器到后台
nohup bin/hiveserver2 1>/dev/null 2>&1 &
2.连接
bin/beeline -u jdbc:hive2://hadoop01:10000 -n root
3.建表
create table t_order(id string,o_time string,amount int,price float)
row format delimited fields terminated by ‘,’;
4.将数据导入hive表
load data local inpath ‘/root/order.dat’ into table t_access;
5.array数组类型建表
create table t_order(id string,o_time string,amount int,price float,use array)
row format delimited fields terminated by ‘,’
collection items terminated by ‘;’;
6.map类型建表
create table t_order(id string,o_time string,amount int,price float,use_level map<string,string>)
row format delimited fields terminated by ‘,’
collection items terminated by ‘#’
map keys terminated by ‘:’;
通过key获取value
select name,family_members[‘father’] from t_person;
获取所有的key
select name,map_keys(family_members) from t_person;
获取所有的value
select name,map_values(family_members) from t_person;
7.struct类型
create table t_order(id string,o_time string,o_items struct<i_name:string,i_amount:int,i_price:float>)
row format delimited fields terminated by ‘,’
collection items terminated by ‘:’;
8.使用本地模式进行运算
set hive.exec.mode.local.auto=true;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值