Hive之动态分区

原始表没有分区,将原始表根据某个字段分区

如图:有一张原始表business1表有三个字段,name,orderdate,cost 

create table business1 (

name string,

orderdate string,

cost int

)

创建需要分区的表(根据某个字段)

create table business2(

name string,

cost int

) partition by (orderdate string)

row format delimited fields terminated by ',';

insert into table business2 partition(orderdate) select name,cost,orderdate from business1;

猜你喜欢

转载自blog.csdn.net/qq_43193797/article/details/86548833
今日推荐