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

Julian Hyde commented on CALCITE-827:
-------------------------------------

Also, the fact that "shuttle" (declared at line 197 
https://github.com/apache/incubator-calcite/blob/3e50232b681e8dadb921580ee6f3e0376dd0f664/core/src/main/java/org/apache/calcite/rel/logical/LogicalWindow.java#L197)
 is not used seems to be worrying. If the code used a shuttle to replace 
RexOvers inside the project expressions then the permutation would probably 
happen automatically.

> ProjectToWindowRule leads to Assertion Error when multiple windows are used 
> in a specific way
> ---------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-827
>                 URL: https://issues.apache.org/jira/browse/CALCITE-827
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Sean Hsuan-Yi Chu
>            Assignee: Sean Hsuan-Yi Chu
>
> To reproduce this issue, add ProjectToWindowRule to the Hep Planner.
> Then, a query below would fail with an Assertion Error (type mis-match)
> {code}
> select count(*) over(partition by empno order by sal) as count1,
>       count(*) over(partition by deptno order by sal) as count2, 
>       sum(deptno)  over(partition by empno order by sal) as sum1
> from emp
> {code}
> However, if the second and third columns are swapped, then it works:
> {code}
> select count(*) over(partition by empno order by sal) as count1,
>       sum(deptno)  over(partition by empno order by sal) as sum1,
>       count(*) over(partition by deptno order by sal) as count2
> from emp
> {code}
> Essentially, the window functions which "share the same window definition" 
> should be placed consecutively in the select-list; Otherwise, the current 
> linking mechanism seems having some difficulty. 



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

Reply via email to