配置单元中的两列表分区

oxalkeyp  于 2021-06-28  发布在  Hive
关注(0)|答案(2)|浏览(213)

我有一张有两列的table

id   value
 abc    11
 xyz    12
 pqr    11
 mno    13 
 pqr    12
 stu    13
 wxy    11

我必须通过配置单元或sql查询用“value”对这个表进行分区。

htrmnn0y

htrmnn0y1#

探索之后我得到了答案。

create table table (id string) partitioned by (value string) stored as ORC tblproperties ("orc.compress" = "SNAPPY");

SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.dynamic.partition=true;

SET hive.exec.max.dynamic.partitions=2048;
SET hive.exec.max.dynamic.partitions.pernode=256;

INSERT INTO table1 PARTITION (value)
select * from table where value is not NULL;
hc2pp10m

hc2pp10m2#

SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.dynamic.partition=true;

create table table (id string) partitioned by (value string) stored as ORC tblproperties ("orc.compress" = "SNAPPY");

INSERT INTO table1 PARTITION (value)
select * from table where value is not NULL;

相关问题