Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-1115

Impala should not ignore ORDER BY when using UNION

    XMLWordPrintableJSON

    Details

      Description

      Impala doesnt apply ORDER BY to queries that contain a UNION. (A warning with that info is shown to the user.) On postgres, mysql, and oracle, the ORDER BY is applied. It would be great if impala would also apply the ordering to be consistent.

      Impala:

      [localhost:21000] > select smallint_col_3 from table_1 union select bigint_col_2 from table_2 order by 1;
      ...
      | 295            |
      | -151           |
      | 462            |
      | -896           |
      +----------------+
      Returned 2002 row(s) in 1.27s
      WARNINGS: Ignoring ORDER BY clause without LIMIT or OFFSET: ORDER BY 1 ASC
      .An ORDER BY without a LIMIT or OFFSET appearing in an (inline) view, union operand or an INSERT/CTAS statement has no effect on the query result.
      

      Oracle:

      SQL> select 1 from dual union select 2 from dual order by 1 desc;
      
      	 1
      ----------
      	 2
      	 1
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                caseyc casey
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: