美文网首页
hive 数据倾斜优化

hive 数据倾斜优化

作者: 大闪电啊 | 来源:发表于2019-06-14 20:09 被阅读0次

    在一个大表关联小表中遇到数据倾斜的问题,优化方法如下

    mapjoin

    类似写MR时,将小数据直接放入map缓存,通过mapjoin可以加快执行速度,hive2默认开启此功能,不过小表的阈值需要自己修改

    set hive.auto.convert.join=true;
    set hive.mapjoin.smalltable.filesize=100000000;
    

    null值处理

    执行中发现一个reduce需要2个小时,按照关联的key统计了下,发现主要是null值,可以通过将null转为随机数处理

    on case when extra['appid'] is null then concat('pv-appid',rand()) else null end  = app.app_id
    

    相关文章

      网友评论

          本文标题:hive 数据倾斜优化

          本文链接:https://www.haomeiwen.com/subject/inkmfctx.html