mirror of
https://github.com/apache/druid.git
synced 2025-02-19 16:37:45 +00:00
Clarify how ORDER BY works with UNION ALL (#10561)
Hopefully a bit clearer.
This commit is contained in:
parent
6ccddedb7a
commit
3436297354
@ -167,9 +167,9 @@ together and appear one after the other.
|
|||||||
|
|
||||||
#### Table-level
|
#### Table-level
|
||||||
|
|
||||||
UNION ALL can be used to query multiple tables at the same time. In this case, it must appear in the FROM clause,
|
UNION ALL can be used to query multiple tables at the same time. In this case, it must appear in a subquery in the
|
||||||
and the subqueries that are inputs to the UNION ALL operator must be simple table SELECTs (no expressions, column
|
FROM clause, and the lower-level subqueries that are inputs to the UNION ALL operator must be simple table SELECTs
|
||||||
aliasing, etc). The query will run natively using a [union datasource](datasource.md#union).
|
(no expressions, column aliasing, etc). The query will run natively using a [union datasource](datasource.md#union).
|
||||||
|
|
||||||
The same columns must be selected from each table in the same order, and those columns must either have the same types,
|
The same columns must be selected from each table in the same order, and those columns must either have the same types,
|
||||||
or types that can be implicitly cast to each other (such as different numeric types). For this reason, it is generally
|
or types that can be implicitly cast to each other (such as different numeric types). For this reason, it is generally
|
||||||
@ -190,7 +190,7 @@ GROUP BY col1
|
|||||||
|
|
||||||
When UNION ALL occurs at the table level, the rows from the unioned tables are not guaranteed to be processed in
|
When UNION ALL occurs at the table level, the rows from the unioned tables are not guaranteed to be processed in
|
||||||
any particular order. They may be processed in an interleaved fashion. If you need a particular result ordering,
|
any particular order. They may be processed in an interleaved fashion. If you need a particular result ordering,
|
||||||
use [ORDER BY](#order-by).
|
use [ORDER BY](#order-by) on the outer query.
|
||||||
|
|
||||||
### EXPLAIN PLAN
|
### EXPLAIN PLAN
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user