Mihir Kulkarni created HIVE-4429: ------------------------------------ Summary: Nested ORDER BY produces incorrect result Key: HIVE-4429 URL: https://issues.apache.org/jira/browse/HIVE-4429 Project: Hive Issue Type: Bug Components: Query Processor, SQL, UDF Affects Versions: 0.9.0 Environment: Red Hat Linux VM with Hive 0.9 and Hadoop 2.0 Reporter: Mihir Kulkarni Priority: Critical
Nested ORDER BY clause doesn't honor the outer one in specific case. The below query produces result which honors only the inner ORDER BY clause. (it produces only 1 MapRed job) SELECT alias.b0 as d0, alias.b1 as d1 FROM (SELECT test.a0 as b0, test.a1 as b1 FROM test ORDER BY b1 ASC, b0 DESC) alias ORDER BY d0 ASC, d1 DESC; --------------------------------------------------------------------------- On the other hand the query below honors the outer ORDER BY clause which produces the correct result. (it produces 2 MapRed jobs) SELECT alias.b0 as d0, alias.b1 as d1 FROM (SELECT test.a0 as b0, test.a1 as b1 FROM test ORDER BY b1 ASC, b0 DESC) alias ORDER BY d0 DESC, d1 DESC; --------------------------------------------------------------------------- Any other combination of nested ORDER BY clauses does produce the correct result. Please see attachments for query, schema and Hive Commands for reprocase. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira