cxzl25 commented on PR #36265:
URL: https://github.com/apache/spark/pull/36265#issuecomment-1157660228

   > Have you run this query with other databases like postgres?
   
   Use the following SQL, on the website, select postgres, mysql, sqlserver, 
sqllite to pass the test.
   https://dbfiddle.uk/
   ```sql
   SELECT SUM(id) AS id
   FROM (
       SELECT 1 AS id
       UNION ALL
       SELECT 2 AS id
   ) a
   GROUP BY id
   ORDER BY SUM(id);
   ```
   
   If it is SQL like this, Spark can run successfully.
   ```sql
   SELECT id, SUM(id) AS id
   FROM (
       SELECT 1 AS id
       UNION ALL
       SELECT 2 AS id
   ) a
   GROUP BY id
   ORDER BY SUM(id);
   ```
   
   >  I think the SQL semantic is `order by` col should resolve to columns in 
SELECT list first, not the table columns. Or I misunderstand it?
   
   Yes, it should be like this, `order by` col should resolve to columns in 
SELECT list first.
   


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