alamb commented on issue #4854: URL: https://github.com/apache/arrow-datafusion/issues/4854#issuecomment-1377972610
cc @jackwener who may have some ideas FWIW the logical order of operations is like this (from https://learnsql.com/blog/sql-order-of-operation)  So as you are describing yes the columns which are available to ORDER are the output of the GROUP BY -- so that means either `GROUP BY` columns or aggregates (or some expression of them) For example, this is valid: ```sql SELECT a,b, sum(c) FROM foo GROUP BY a, b ORDER BY a + b; -- note it is order by a+b (an expression of the group columns) -- also note the ORDER BY can not contain `c` -- 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]
