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.
[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.
SQL> select 1 from dual union select 2 from dual order by 1 desc;