hive中的两列表分区

时间:2016-09-20 05:20:07

标签: hive subquery hiveql

我有一个有两列的表

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

我必须使用" value"对此表进行分区。通过hive或sql查询。

2 个答案:

答案 0 :(得分:0)

在探索之后我得到了ans。

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;

答案 1 :(得分:0)

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;