前言
本文隶属于专栏《1000个问题搞定大数据技术体系》,该专栏为笔者原创,引用请注明来源,不足和错误之处请在评论区帮忙指出,谢谢!
本专栏目录结构和参考文献请见1000个问题搞定大数据技术体系
正文
hive 分区表的概念
在文件系统上建立文件夹,把表的数据放在不同文件夹下面,加快查询速度。
hive 分区表的构建
创建一个分区字段的分区表
hive> create table student_partition1(
id int,
name string,
age int)
partitioned by (dt string)
row format delimited fields terminated by '\t';
创建二级分区表
hive> create table student_partition2(
id int,
name string,
age int)
partitioned by (month string, day string)
row format delimited fields terminated by '\t';