您现在的位置是:首页 > 文章详情

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

日期:2016-02-15点击:437
从本地导入数据到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对应的目录下。
       
原文链接:https://yq.aliyun.com/articles/66062
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章