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

Weihua Zhang commented on CALCITE-7887:
---------------------------------------

nice catch

> SubQueryRemoveRule fails for a sub-query inside a window function
> -----------------------------------------------------------------
>
>                 Key: CALCITE-7887
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7887
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> The following quidem test fails:
> {code:java}
>  SELECT empno,
>   SUM(CASE WHEN deptno IN (SELECT deptno FROM dept WHERE deptno < 30) THEN 1 
> ELSE 0 END)
>     OVER (ORDER BY empno) AS s
> FROM emp
> WHERE empno < 7600;{code}
> The stack trace is:
> {code:java}
>  java.lang.IllegalArgumentException: not found: IN($1, {
> LogicalProject(DEPTNO=[$0])
>   LogicalFilter(condition=[<(CAST($0):INTEGER NOT NULL, 30)])
>     LogicalTableScan(table=[[scott, DEPT]])
> })
>       at org.apache.calcite.rex.LogicVisitor.find(LogicVisitor.java:84)
>       at 
> org.apache.calcite.rel.rules.SubQueryRemoveRule.matchProject(SubQueryRemoveRule.java:973)
> {code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to