hive-- 请不要用动态分区(如果分区可以确定)
来源:互联网 发布:网络零点旗舰店 编辑:程序博客网 时间:2024/06/06 04:33
如果分区是可以确定的话,千万不要用动态分区,动态分区的值是在reduce运行阶段确定的.也就是会把所有的记录distribute by。 可想而知表记录非常大的话,只有一个reduce 去处理,那简直是疯狂的。如果这个值唯一或者事先已经知道,比如按天分区(i_date=20140819) 那就用静态分区吧。静态分区在编译阶段已经确定,不需要reduce处理。 例如以下两个insert 表分区:
1.插入动态分区:
set hive.exec.dynamic.partition.mode=strict;
insert overwrite table a_test partition (i_date)
select id, page, extract, label_count,weight,'20140817'
from b.test_b where request_date_i = '20140817';
insert overwrite table a_test partition (i_date)
select id, page, extract, label_count,weight,'20140817'
from b.test_b where request_date_i = '20140817';
2. 插入静态分区:
insert overwrite table a_test partition (i_date='20140817')
select id, page, extract, label_count,weight
from b.test_b where request_date_i = '20140817';
from b.test_b where request_date_i = '20140817';
当然选静态分区insert:如果schedule的话,可以动态把i_date传进去:比如:
insert overwrite table a_test partition (i_date='${hiveconf:i_date}')
select id, page, extract, label_count,weight
from b.test_b where request_date_i = '20140817';
from b.test_b where request_date_i = '20140817';
关于为什么这样,请理解hive运行原理,参考:
http://tech.meituan.com/hive-sql-to-mapreduce.html
http://www.slideshare.net/coderplay/hive-16171301#
https://cwiki.apache.org/confluence/display/Hive/DynamicPartitions
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.dynamic.partitions.pernode=50000;
set hive.exec.dynamic.partitions.partitions=50000;
set hive.exec.max.created.files=500000;
set mapred.reduce.tasks =137;
set hive.merge.mapfiles=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.dynamic.partitions.pernode=50000;
set hive.exec.dynamic.partitions.partitions=50000;
set hive.exec.max.created.files=500000;
set mapred.reduce.tasks =137;
set hive.merge.mapfiles=true;
阅读全文
0 0
- hive-- 请不要用动态分区(如果分区可以确定)
- hive-- 请不要用动态分区(如果分区可以确定)
- hive-- 请不要用动态分区(如果分区可以确定)
- Hive 动态分区 & 静态分区
- Hive 分区,静态分区,动态分区
- [Hive]Hive静态分区与动态分区
- hive动态分区
- Hive动态分区
- Hive动态分区
- HIVE动态分区实战
- Hive动态分区
- Hive动态分区
- hive 动态分区
- 05-Hive动态分区
- hive动态分区
- Hive动态分区
- hive动态分区
- Hive动态分区
- Kubernetes 1.5集成heapster
- iOS 中的 armv7,armv7s,arm64,i386,x86_64 都是什么
- 高德基本地图的实现继承
- 阿里巴巴java规范检测值得注意的项总结
- Base64的3种实现方式
- hive-- 请不要用动态分区(如果分区可以确定)
- 《Source Code》——不可错过的高质量Science Fiction Film!
- SSL 安全套接层
- 警告: No mapping found for HTTP request with URI [/web002/list.do] in DispatcherServlet 的解决方法
- 【UVA11354】Bond
- unity 影子效果
- 品玩科技嘉年华2017·无限奇境等你来玩!
- openshift 学习笔记-6 secret and quota
- http协议详解