[ https://issues.apache.org/jira/browse/HIVE-13727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15282492#comment-15282492 ]
Rajat Khandelwal commented on HIVE-13727: ----------------------------------------- [~ashutoshc] I've only been following hive master for a few months now. I haven't tested this thing on hive master prior to HIVE-9039. Though I've used hive 0.13 releases and it used to work there. > Getting error Failed rule: 'orderByClause clusterByClause distributeByClause > sortByClause limitClause can only be applied to the whole union.' in subquery > ----------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: HIVE-13727 > URL: https://issues.apache.org/jira/browse/HIVE-13727 > Project: Hive > Issue Type: Bug > Reporter: Rajat Khandelwal > Fix For: 2.1.0 > > > The error comes in the following query: > {noformat} > SELECT * > FROM > (SELECT * > FROM srcpart a > WHERE a.ds = '2008-04-08' > AND a.hr = '11' > ORDER BY a.key LIMIT 5 > UNION ALL > SELECT * > FROM srcpart b > WHERE b.ds = '2008-04-08' > AND b.hr = '14' > ORDER BY b.key LIMIT 5) subq > ORDER BY KEY LIMIT 5 > {noformat} > But the following query works: > {noformat} > SELECT * > FROM > (SELECT * > FROM > (SELECT * > FROM srcpart a > WHERE a.ds = '2008-04-08' > AND a.hr = '11' > ORDER BY a.key LIMIT 5) pa > UNION ALL SELECT * > FROM > (SELECT * > FROM srcpart b > WHERE b.ds = '2008-04-08' > AND b.hr = '14' > ORDER BY b.key LIMIT 5) pb) subq > ORDER BY KEY LIMIT 5 > {noformat} > The queries are logically identical, the query that's rejected has dummy > select * clauses around the sub-queries. -- This message was sent by Atlassian JIRA (v6.3.4#6332)