You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Csaba Ringhofer (Jira)" <ji...@apache.org> on 2023/06/07 16:10:00 UTC

[jira] [Created] (HIVE-27418) UNION ALL + ORDER BY ordinal works incorrectly for all const queries

Csaba Ringhofer created HIVE-27418:
--------------------------------------

             Summary: 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


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)