配置单元中的两列 table 分区

two column table partition in hive

我有一个有两列的 table

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

我必须通过配置单元或 sql 查询将此 table 与 "value" 分区。

探索之后我得到了答案。

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;
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;