[
https://issues.apache.org/jira/browse/CALCITE-1327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15391360#comment-15391360
]
Julian Hyde commented on CALCITE-1327:
--------------------------------------
Looks basically good. You have missed a couple of use cases.
1. Remember that a query can be aggregating even if it doesn't have a GROUP BY
clause: it could have a HAVING clause or an aggregate in the SELECT clause.
Need tests for these cases, and use {{!SqlValidator.isAggregate(select)}}
rather than {{select.getGroupBy() == null}}.
2. You are allowed to use an expression based on group by columns. For example,
{{select avg(sum(sal)) over (partition by empno) from emp group by deptno + 1}}
is legal.
Also, remove carets from valid SQL queries in test cases, and please remember
to use continuation indent 4, not 8.
> Nested aggregate windowed query fails
> -------------------------------------
>
> Key: CALCITE-1327
> URL: https://issues.apache.org/jira/browse/CALCITE-1327
> Project: Calcite
> Issue Type: Bug
> Reporter: Gautam Kumar Parai
> Assignee: Gautam Kumar Parai
>
> Regression from Calcite-750 Allow nested window aggregates.
> Calcite allows illegal queries instead of raising an appropriate error. When
> executing the following query calcite does not raise the following error.
> {code}
> select avg(sum(b)) over (partition by b) from t1;
> ERROR: Expression 'b' is not being grouped
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)