网站建设哪家效益快,东莞万江网站制作,宽城区网站建设,企业网站免费源码文章中关于分区表常用操作目录#xff1a;
一、概念
二、创建分区表语法
三、创建一个表带多个分区
四、加载数据到分区表中
五、加载数据到一个多分区的表中去
六、查看分区
七、添加一个分区…文章中关于分区表常用操作目录
一、概念
二、创建分区表语法
三、创建一个表带多个分区
四、加载数据到分区表中
五、加载数据到一个多分区的表中去
六、查看分区
七、添加一个分区
八、同时添加多个分区
九、删除分区 分区表
一、概念
在大数据中最常用的一种思想就是分治我们可以把大的文件切割划分成一个个的小的文件这样每次操作一个小的文件就会很容易了同样的道理在hive当中也是支持这种思想的就是我们可以把大的数据按照每天或者每小时进行切分成一个个的小的文件这样去操作小的文件就会容易得多了。 二、创建分区表语法 create table score(s_id string,c_id string, s_score int) partitioned by (month string) row format delimited fields terminated by \t;
三、创建一个表带多个分区 create table score2 (s_id string,c_id string, s_score int) partitioned by (year string,month string,day string) row format delimited fields terminated by \t;
四、加载数据到分区表中 load data local inpath /export/data/hive_data/score.txt into table score partition (month202006);
五、加载数据到一个多分区的表中去 load data local inpath /export/data/hive_data/score.txt into table score2 partition(year2020,month06,day01);
六、查看分区 show partitions score;
七、添加一个分区 alter table score add partition(month202005);
八、同时添加多个分区 alter table score add partition(month202004) partition(month 202003);
注意添加分区之后就可以在hdfs文件系统当中看到表下面多了一个文件夹
九、删除分区 alter table score drop partition(month 202006);