Hive--动态分区
程序员文章站
2022-07-06 10:51:13
...
set hive.exec.dynamic.partition=true;(可通过这个语句查看:set hive.exec.dynamic.partition;)
set hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions=100000;(如果自动分区数大于这个参数,将会报错)
SET hive.exec.max.dynamic.partitions.pernode=100000;
建立分区表时动态分区的语法.
CREATE TABLE table_name -
partitioned by (datekey) --可以多个字段的组合分区
Stored AS PARQUET
as
SELECT col1,col2,col3,DateKey FROM otherTable
插入数据时动态分区
INSERT INTO TABLE table_Name
PARTITION (DateKey)
SELECT col1,col2,col3,DateKey FROM otherTable
WHERE DATEKEY IN ('2017-02-26','2013-06-12','2013-09-24')
GROUP BY col1,col2,col3,DateKey
DISTRIBUTE BY DateKey
上一篇: 202. 线段树的查询
下一篇: hive动态分区