askalt opened a new issue, #14368:
URL: https://github.com/apache/datafusion/issues/14368

   ### Describe the bug
   
   ```
   DataFusion CLI v44.0.0
   > create table pairs(x int, y int) as values (2, 2), (1, 1), (3, 3);
   0 row(s) fetched. 
   Elapsed 0.025 seconds.
   
   > with subquery as (select * from pairs order by x)
     select * from subquery;
   +---+---+
   | x | y |
   +---+---+
   | 2 | 2 |
   | 1 | 1 |
   | 3 | 3 |
   +---+---+
   
   > explain select * from (select * from pairs order by x);
   +---------------+-----------------------------------------------+
   | plan_type     | plan                                          |
   +---------------+-----------------------------------------------+
   | logical_plan  | TableScan: pairs projection=[x, y]            |
   | physical_plan | MemoryExec: partitions=1, partition_sizes=[1] |
   |               |                                               |
   +---------------+-----------------------------------------------+
   2 row(s) fetched. 
   Elapsed 0.008 seconds.
   ```
   
   `x` is not ordered and the logical plan does not contain sort.
   
   ### To Reproduce
   
   Steps are described above.
   
   ### Expected behavior
   
   Ordered key is ordered in the output, a logical plan tells about it. 
   
   ### Additional context
   
   _No response_


-- 
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]

Reply via email to