关于hive数据导入方式的总结

从本地导入数据到hive:
load data local inpath '/home/hive/tb_dw_cu_three_type_list_dtal/*.dat' overwrite into table csap.tb_dw_cu_three_type_list_dtal  partition(statis_date=20160121);

从HDFS直接导入数据到hive:
load data inpath '/hadoop/interface/renaData/AOL_OPEN_CALL_LOG_*_201602_20160215.dat' into table csap.tb_ods_ct_rena_open_call_log_all_day partition(statis_date=20160215);

请注意load data inpath ‘/home/wyp/add.txt’ into table wyp;里面是没有local这个单词的,这个是和本地的区别。

从一个表中导数据到另一张表:
insert into table test partition (age='25')
select id, name, tel from wyp;

hive支持多表插入:
from wyp
insert into table test partition(age)
select id, name, tel, age
insert into table test3
select id, name where age>25;


注意:传统数据块的形式insert into table values(字段1,字段2),这种形式hive是不支持的。

分区:在Hive中,表的每一个分区对应表下的相应目录,所有分区的数据都是存储在对应的目录中。
装载数据相当于把之前HDFS上的数据移动到hive对应的目录下。
       
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据社

码字不易,谢谢支持!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值