I am having a Hive query like the one below:
select a.x as column from table1 a where a.y in (<long comma-separated list of parameters>)
union all
select b.x as column from table2 b where b.y in (<long comma-separated list of parameters>)
I have set hive.exec.parallel
as true
which is helping me achieve parallelism between the two queries between union all.
But, my IN
clause has many comma separated values and each value is taken once in 1 job and then the next value. This is actually getting executed sequentially.
Is there any hive parameter which if enabled can help me fetch data parallelly for the parameters in the IN
clause?
Currently, the solution I am having is fire the select query with =
multiple times instead of one IN
clause.
There is no need to read the same data many times in separate queries to achieve better parallelism. Tune proper mapper and reducer parallelism for the same.
First of all, enable PPD with vectorizing, use CBO and Tez:
Example settings for Mappers on Tez:
Example settings for Mappers if you decide to run on MR instead of Tez:
--example settings for reducers:
Play with these settings. Success criteria is more mappers/reducers and your map and reduce stages are running faster.
Read this article for better understanding of how to tune Tez: https://community.hortonworks.com/articles/14309/demystify-tez-tuning-step-by-step.html