[
https://issues.apache.org/jira/browse/CALCITE-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15406858#comment-15406858
]
Julian Hyde commented on CALCITE-1340:
--------------------------------------
Regarding how you fix Q3. Obviously you need to validate that RANK has a
window, but you don't need to do it as the first step in validation. It would
be acceptable if you skipped the RANK function and did not regard the query as
an aggregate query. Then the "OVER clause is necessary for window functions"
error will happen in due course. (It should be a validation error, not an
AssertionError.)
> Window aggregates invalid error/error messages in some cases
> ------------------------------------------------------------
>
> Key: CALCITE-1340
> URL: https://issues.apache.org/jira/browse/CALCITE-1340
> Project: Calcite
> Issue Type: Bug
> Reporter: Gautam Kumar Parai
> Assignee: Gautam Kumar Parai
>
> Queries which fail (or fail with inconsistent errors)
> Q1:
> {code}select count( * ) over () from emp group by deptno
> AssertionError: star should have been expanded.
> {code}
> Q2:
> {code}
> SELECT sum(empno), max(empno) OVER (order by deptno)
> FROM emp
> GROUP BY empno
> gives error: Expression 'DEPTNO' is not being grouped
> SELECT sum(empno), max(empno) OVER w
> FROM emp
> GROUP BY empno
> WINDOW w as (order by deptno)
> gives no error:
> {code}
> Q3:
> {code}
> select cume_dist() over w , rank()
> from emp
> window w as (partition by deptno order by deptno)
> Assertion Error: Expression 'DEPTNO' is not being grouped
> instead of
> Assertion Error: OVER clause is necessary for window functions
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)