[ 
https://issues.apache.org/jira/browse/CALCITE-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16996553#comment-16996553
 ] 

Rui Wang commented on CALCITE-3568:
-----------------------------------

I also verified Spark SQL does not support nested aggregations


{code:sql}
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

{code}

I don't have access to Hive so that's the left part to be verified.

> BigQuery, Hive, Spark SQL dialect don't support nested aggregates
> -----------------------------------------------------------------
>
>                 Key: CALCITE-3568
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3568
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Divyanshu Srivastava
>            Assignee: Divyanshu Srivastava
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.22.0
>
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> The BigQuerySqlDialect, HiveSqlDialect, SparkSqlDialect do not support nested 
> aggregates, hence overriding theĀ supportsNestedAggregations() method in them.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to