[ https://issues.apache.org/jira/browse/HIVE-27418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17730898#comment-17730898 ]
zhangbutao commented on HIVE-27418: ----------------------------------- Hi [~csringhofer] , could you provide more info about your hive cluster env? e.g. Hive & Hadoop &Tez version. And what execution engine did you use for the test? Tez? or MR? > UNION ALL + ORDER BY ordinal works incorrectly for all const queries > -------------------------------------------------------------------- > > Key: HIVE-27418 > URL: https://issues.apache.org/jira/browse/HIVE-27418 > Project: Hive > Issue Type: Bug > Reporter: Csaba Ringhofer > Priority: Major > > For the following query I get results in wrong order: > SELECT '1', 'b' UNION ALL SELECT '2', 'a' ORDER BY 2; > +------+------+ > | _c0 | _c1 | > +------+------+ > | 1 | b | > | 2 | a | > +------+------+ > I get correct results if: > - the column has an alias > - the same rows come from tables > - the UNION ALL part of the query is in a sub-query and ORDER BY is run on > the sub*query > Checked with postgres and Apache Impala and they apply ORDER BY correctly. > (also noted the the ordinal after ORDER BY is not checked, so it could be 20 > and Hive doesn't complain) -- This message was sent by Atlassian Jira (v8.20.10#820010)