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

Julian Hyde commented on CALCITE-802:
-------------------------------------

Why? Does the SQL standard forbid it? The following query is equivalent to your 
query, well-defined, and allowed by the SQL standard, so it seems that your 
query should be allowed also:

{code}
select empno, r from (
  select empno,
    rank() over(partition by deptno order by empno) as r,
    row_number() over(partition by deptno order by empno) as rn
  from emp)
order by rn
{code}

> OVER clause in Order-By should be blocked at validation
> -------------------------------------------------------
>
>                 Key: CALCITE-802
>                 URL: https://issues.apache.org/jira/browse/CALCITE-802
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Sean Hsuan-Yi Chu
>            Assignee: Sean Hsuan-Yi Chu
>
> We found a similar issue to Calcite-800. An example is as below:
> select empno, rank() over(partition by deptno order by empno)
> from emp
> order by row_number() over(partition by deptno order by empno)
> Order by should not contain OVER.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to