hive left outer join long running

2019-03-03 10:35发布

Hortonworks HDP 2.3.0 - Hive 0.14

Table T1 ( partition on col1, no bucket, ORC ) app 120 million rows & 6GB datasize Table T2 ( partition on col2, no bucket, ORC ) app 200 M rows & 6MB datasize

T1 left outer join on t2 ( t1.col3 = t2.col3 )

The above query is long running in the last reducer phase in both tez & mr mode. I also tried auto convert true / false & explicit mapjoin.

Still the query is running in the last reducer phase, never ending.

FYI - If data size of T2 is either 9k or 1GB, the query finishes.

标签: hive
2条回答
萌系小妹纸
2楼-- · 2019-03-03 11:18

But have you tried giving size to auto convert join, try giving size > than of small table that can be fit into memory.

set hive.auto.convert.join.noconditionaltask.size = 10000000;

查看更多
够拽才男人
3楼-- · 2019-03-03 11:24

The problem maybe is that there are too many bytes/rows per reducer. If the application execution is stuck in the last single reducer then it's most probably data skew. To check it, select top 5 col3 from both tables, skew is when there are a lot of records with the same key value(say 30%). If it's a skew then try to join separately skew key then UNION ALL with all other keys join. Something like this:

select * from
T1 left outer join on t2 on ( t1.col3 = t2.col3 ) and t1.col3=SKEW_VALUE
union all
select * from
T1 left outer join on t2 on ( t1.col3 = t2.col3 ) and t1.col3<>SKEW_VALUE 

If the application execution is stuck in the last reducer stage, not a single reducer or few reducers, then check bytes.per.reducer hive setting, maybe it's too high.

set hive.exec.reducers.bytes.per.reducer=67108864;
查看更多
登录 后发表回答