Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.12.0
-
None
-
This optimizer exploits the intra-query correlations and merge multiple correlated MapReduce jobs into one jobs.
Description
This issue proposes a new logical optimizer called Correlation Optimizer, which is used to merge correlated MapReduce jobs (MR jobs) into a single MR job. The idea is based on YSmart (http://ysmart.cse.ohio-state.edu/). The paper and slides of YSmart are linked at the bottom.
Since Hive translates queries in a sentence by sentence fashion, for every operation which may need to shuffle the data (e.g. join and aggregation operations), Hive will generate a MapReduce job for that operation. However, for those operations which may need to shuffle the data, they may involve correlations explained below and thus can be executed in a single MR job.
- Input Correlation: Multiple MR jobs have input correlation (IC) if their input relation sets are not disjoint;
- Transit Correlation: Multiple MR jobs have transit correlation (TC) if they have not only input correlation, but also the same partition key;
- Job Flow Correlation: An MR has job flow correlation (JFC) with one of its child nodes if it has the same partition key as that child node.
The current implementation of correlation optimizer only detect correlations among MR jobs for reduce-side join operators and reduce-side aggregation operators (not map only aggregation). A query will be optimized if it satisfies following conditions.
- There exists a MR job for reduce-side join operator or reduce side aggregation operator which have JFC with all of its parents MR jobs (TCs will be also exploited if JFC exists);
- All input tables of those correlated MR job are original input tables (not intermediate tables generated by sub-queries); and
- No self join is involved in those correlated MR jobs.
Correlation optimizer is implemented as a logical optimizer. The main reasons are that it only needs to manipulate the query plan tree and it can leverage the existing component on generating MR jobs.
Current implementation can serve as a framework for correlation related optimizations. I think that it is better than adding individual optimizers.
There are several work that can be done in future to improve this optimizer. Here are three examples.
- Support queries only involve TC;
- Support queries in which input tables of correlated MR jobs involves intermediate tables; and
- Optimize queries involving self join.
References:
Paper and presentation of YSmart.
Paper: http://www.cse.ohio-state.edu/hpcs/WWW/HTML/publications/papers/TR-11-7.pdf
Slides: http://sdrv.ms/UpwJJc
Attachments
Attachments
Issue Links
- blocks
-
HIVE-3668 Merge MapReduce jobs which share input tables and the same partitioning keys into a single MapReduce job
- Open
-
HIVE-3669 Support queries in which input tables of correlated MR jobs involves intermediate tables
- Open
-
HIVE-3670 Optimize queries involving self join
- Resolved
-
HIVE-3671 If a query has been optimized by correlation optimizer, join auto convert cannot optimize it
- Resolved
- is blocked by
-
HIVE-4572 ColumnPruner cannot preserve RS key columns corresponding to un-selected join keys in columnExprMap
- Closed
- is related to
-
HIVE-1772 optimize join followed by a groupby
- Resolved
-
HIVE-3430 group by followed by join with the same key should be optimized
- Resolved
-
HIVE-4827 Merge a Map-only task to its child task
- Closed
-
HIVE-7362 Enabling Correlation Optimizer by default.
- Open
- is required by
-
HIVE-3667 Umbrella jira for Correlation Optimizer
- Open
- relates to
-
HIVE-2340 optimize orderby followed by a groupby
- Closed
-
HIVE-3773 Share input scan by unions across multiple queries
- In Progress