hive数据倾斜解决方案
map阶段
主要考虑合并小文件,尽量让输入源的文件大小差不多,可以通过splitsize等参数来调节。
join阶段
对空值做随机值。
on case when a.user_id is null then concat(‘xxxx’,rand() ) else a.user_id end = b.user_id;
reduce阶段
可以增加reduce的个数,分担压力。
热点key
加盐处理。
把热点数据单独拿出来处理完再union all其他
sql优化
distinct可以用两次group by