rednaxelafx commented on issue #23701: [SPARK-26741][SQL] Allow using aggregate 
expressions in ORDER BY clause
URL: https://github.com/apache/spark/pull/23701#issuecomment-459240165
 
 
   Indeed, we should probably fail that query instead of throwing a weird error 
in codegen.
   
   This is an equivalent example in PG10:
   ```sql
   create table t1 as select unnest(array[0, 1, 2]) as v;
   create table t2 as select unnest(array[10, 11, 12]) as v;
   
   select * from
     ((select v, max(v) from t1 group by v)
     union all
     (select v, max(v) from t2 group by v)) tt
   order by max(tt.v)
   ```
   which fails with:
   ```
   Query Error: error: column "tt.v" must appear in the GROUP BY clause or be 
used in an aggregate function
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to