bart-samwel commented on pull request #28836:
URL: https://github.com/apache/spark/pull/28836#issuecomment-645871329


   @AngersZhuuuu This is problematic because the `WHERE` clause comes *before* 
the `GROUP BY` clause, but window functions (and the `SELECT`) are evaluated 
*after* the GROUP BY clause.
   
   If anything, we could allow this in the HAVING clause, which goes just 
before SELECT. The trouble with that is that:
   
   (a) the HAVING clause can't reference SELECT list aliases, so this would 
only be useful if you want to e.g. filter by row_number / rank without actually 
selecting it in the output. This will inevitably lead to feature requests to 
allow SELECT list aliases referenced from HAVING, which is not great because it 
can lead to ambiguous references.
   
   (b) The ANSI SQL standard expressly says that it's not allowed.


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to