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

hive分区表

日期:2018-07-03点击:449

Partition 对应于数据库的 Partition 列的密集索引

在 Hive 中,表中的一个 Partition 对应于表下的一个目录,所有的 Partition 的数据都存储在对应的目录中

例如:
test表中包含 date 和 city 两个 Partition
则对应于date=20130201, city = bj 的 HDFS 子目录为:
/warehouse/test/date=20130201/city=bj
对应于date=20130202, city=sh 的HDFS 子目录为;
/warehouse/test/date=20130202/city=sh

创建表

create table partition_table(id int,name string) partitioned by(age int,high int); alter table partition_table add partition (age=20,high=180); insert into hive_test.partition_table PARTITION (age,high) values (1,'xubin',20,180); insert overwrite table partition_table partition (age=20,high=180) select id,name from external_table where age =20 and high = 180; insert overwrite table partition_table partition (age=21,high=180) select id,name from external_table where age =21 and high = 180;
原文链接:https://yq.aliyun.com/articles/625485
关注公众号

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

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

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

文章评论

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

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章