[
https://issues.apache.org/jira/browse/CALCITE-800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14625678#comment-14625678
]
Julian Hyde commented on CALCITE-800:
-------------------------------------
"window w as (order by rank() over (order by sal))" is invalid. Can you please
keep the test case, but convert it to a negative case.
The "syntax rule 7" referred to in the comment is as follows:
{noformat}
Section 6.10 <window function>
7) If <ntile function>, <lead or lag function>, <rank function type> or
ROW_NUMBER is specified, then:
a) If <ntile function>, <lead or lag function>, RANK or DENSE_RANK is
specified, then the window
ordering clause WOC of WDX shall be present.
b) The window framing clause of WDX shall not be present.
...
{noformat}
Since you're modifying a test case, can you make sure there are test cases that:
(1) it's an error if RANK does not have ORDER BY,
(2) it's an error if RANK has RANGE or ROWS,
(3) it's ok if ROW_NUMBER does not have ORDER BY,
(4) it's ok if ROW_NUMBER does have ORDER BY,
(5) it's an error if ROW_NUMBER has RANGE or ROWS.
> Window function defined within another window function should be blocked at
> validation
> --------------------------------------------------------------------------------------
>
> Key: CALCITE-800
> URL: https://issues.apache.org/jira/browse/CALCITE-800
> Project: Calcite
> Issue Type: Bug
> Reporter: Sean Hsuan-Yi Chu
> Assignee: Sean Hsuan-Yi Chu
>
> For instance,
> {code}
> select sum(deptno) over (order by
> sum(deptno) over(order by deptno))
> from emp
> {code}
> This is an invalid query. However, it passes the validation.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)