amaliujia commented on issue #1636: [CALCITE-3568] BigQuery, Hive, Spark SQL 
dialects do not explicitly support nested aggregates
URL: https://github.com/apache/calcite/pull/1636#issuecomment-565749188
 
 
   I verified Spark SQL does not support nested aggregations
   ```
   spark-sql> SELECT sum(count(key) FROM (select 1 AS key);
   Error in query: 
   mismatched input 'FROM' expecting {')', ','}(line 1, pos 22)
   
   == SQL ==
   SELECT sum(count(key) FROM (select 1 AS key)
   ----------------------^^^
   
   spark-sql> SELECT sum(count(key)) FROM (select 1 AS key);
   Error in query: It is not allowed to use an aggregate function in the 
argument of another aggregate function. Please use the inner aggregate function 
in a sub-query.;;
   Aggregate [sum(count(key#0)) AS sum(count(key))#3L]
   +- SubqueryAlias `__auto_generated_subquery_name`
      +- Project [1 AS key#0]
         +- OneRowRelation
   ```
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to