mustafasrepo commented on PR #4691:
URL: 
https://github.com/apache/arrow-datafusion/pull/4691#issuecomment-1363884619

   > select * from (select * from foo order by column1
   
   Regarding your second example the plan of the query below
   ```sql
   SELECT * FROM (SELECT c1 FROM aggregate_test_100 ORDER BY c9)
   ```
   is that
   ```sql
       "ProjectionExec: expr=[c1@0 as c1]",
       "  SortExec: [c9@1 ASC NULLS LAST]",
   ```
   which in principle doesn't require `SortExec`. Consider another query below
   ```sql
   SELECT c1 FROM aggregate_test_100 ORDER BY c9
   ```
   its physical plan is that
   ```sql
       "ProjectionExec: expr=[c1@0 as c1]",
       "  SortExec: [c9@1 ASC NULLS LAST]",
   ```
   In the physical plan level, I think there is no way to be sure whether 
`SortExec` below `ProjectionExec` is enforced or not.


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

Reply via email to