[ https://issues.apache.org/jira/browse/HIVE-2812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phabricator updated HIVE-2812: ------------------------------ Attachment: HIVE-2812.D1821.1.patch kevinwilfong requested code review of "HIVE-2812 [jira] Hive multi group by single reducer optimization fails when aggregation with no keys followed by query with no aggregations". Reviewers: JIRA https://issues.apache.org/jira/browse/HIVE-2812 In multi insert queries, subqueries with aggregations but no group by keys were being grouped with subqueries without any aggregations. This meant if a subquery without aggregations came first, the subqueries without group by keys were not benefitting from the optimization. More imporantly, if a subquery without group by keys came first, the Semantic Analyzer tried to add group by operators for queries without group by clauses resulting in an error during semantic analysis. This patch fixes this by ensuring the two types of subqueries are grouped separately. In multi insert queries where one subquery involves an aggregation with no distinct or group by keys and is followed by a query without any aggregations, like the following, Hive will attempt to add a group by operator for the query without aggregations, causing semantic analysis to fail. FROM src INSERT OVERWRITE TABLE table1 SELECT count INSERT OVERWRITE TABLE table2 SELECT key; TEST PLAN EMPTY REVISION DETAIL https://reviews.facebook.net/D1821 AFFECTED FILES ql/src/test/results/clientpositive/groupby_multi_single_reducer3.q.out ql/src/test/queries/clientpositive/groupby_multi_single_reducer3.q ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java MANAGE HERALD DIFFERENTIAL RULES https://reviews.facebook.net/herald/view/differential/ WHY DID I GET THIS EMAIL? https://reviews.facebook.net/herald/transcript/3879/ Tip: use the X-Herald-Rules header to filter Herald messages in your client. > Hive multi group by single reducer optimization fails when aggregation with > no keys followed by query with no aggregations > -------------------------------------------------------------------------------------------------------------------------- > > Key: HIVE-2812 > URL: https://issues.apache.org/jira/browse/HIVE-2812 > Project: Hive > Issue Type: Bug > Affects Versions: 0.9.0 > Reporter: Kevin Wilfong > Assignee: Kevin Wilfong > Attachments: HIVE-2812.D1821.1.patch > > > In multi insert queries where one subquery involves an aggregation with no > distinct or group by keys and is followed by a query without any > aggregations, like the following, Hive will attempt to add a group by > operator for the query without aggregations, causing semantic analysis to > fail. > FROM src > INSERT OVERWRITE TABLE table1 SELECT count(*) > INSERT OVERWRITE TABLE table2 SELECT key; -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira