You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/06/16 08:25:46 UTC

[GitHub] [spark] bart-samwel commented on pull request #28836: [SPARK-31561][SQL] Add QUALIFY Clause

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


   I'm not a huge fan of this. For one thing, it is not in ANSI SQL 2016. AFAICT it's a Teradata extension that Snowflake adopted as well because they get a lot of Teradata workloads. To be honest, I find it confusing. There's already WHERE and HAVING, and QUALIFY follows HAVING but the evaluation order is different:
   
   Syntax: SELECT -> FROM -> WHERE -> GROUP BY -> **HAVING -> QUALIFY**
   Semantics: FROM -> WHERE -> GROUP BY -> **HAVING -> SELECT -> QUALIFY**
   
   And all it does is basically (SELECT * FROM (SELECT -> FROM -> WHERE -> GROUP BY -> HAVING) WHERE ...). To make this work they've invented a third synonym that basically means "filter", but the meaning is less clear than any of the other synonyms because the order in the syntax is right next to HAVING.
   


----------------------------------------------------------------
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:
users@infra.apache.org



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