1.1,hive的表的动态分区:
动态的进行表的分区,能够节约我们的效率,分区的话根据分区字段的值,选好我们需要分区的字段,根据业务需求来分析。
动态分区有几个要点:
1,准备数据:1,zss,bj2
2,lss,bj
3,tg,sh
4,xg,bj
5,ln,sd
6,yg,sh
create table tb_text(
id string ,
name string ,
city string
)
row format delimited fields terminated by ',' ;
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrick;
create table tb_text(
id string ,
name string ,
city string //city值为:BJ SH ...
)
partitioned by (ct string) ;
1,insert into table tb_text partition(ct) select id , name ,city , city as ct from tb_t



