Hive创建动态分区
程序员文章站
2022-07-06 10:40:03
...
==================================dynamic.partition. =====================================
QQ438509676
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 =====================================
Drop table table_name; --先删除表 没有则直接建表了
CREATE TABLE table_name --创建表
(col1 string, col2 date, col3 double)
partitioned by (datekey date) --可以多个字段的组合分区
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' Stored AS TEXTFILE;
================================== insert table partition=====================================
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
================================== delete table partition=====================================
ALTER TABLE table_Name DROP PARTITION (Datekey='2016-05-05');
上一篇: kibana 查询语法
下一篇: Hive的动态分区