leoyvens opened a new issue, #16171:
URL: https://github.com/apache/datafusion/issues/16171
### Describe the bug
A query that should run successfully fails during planning.
### To Reproduce
This can easily be reproduced in `datafusion-cli` by running:
```sql
CREATE TABLE t (x INTEGER);
(SELECT x, x as __x FROM t) UNION ALL (SELECT x, x as __x FROM t) ORDER BY
__x;
```
The query seems perfectly valid, but it currently errors during planning
with:
```
SortExec: expr=[__x@1 ASC NULLS LAST], preserve_partitioning=[false]
ProjectionExec: expr=[x@0 as x, x@0 as __x]
DataSourceExec: partitions=1, partition_sizes=[0]
SortExec: expr=[__x@1 ASC NULLS LAST], preserve_partitioning=[false]
ProjectionExec: expr=[x@0 as x, x@0 as __x]
DataSourceExec: partitions=1, partition_sizes=[0]
Error: Execution plan does not satisfy required ordering: [__x@1 ASC NULLS
LAST].
Child-0 order: [[x@0 ASC NULLS LAST]]
```
### Expected behavior
The query runs without errors.
### Additional context
We encountered this when attempting to inject projections into user queries.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]