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

Kurt Young commented on CALCITE-1543:
-------------------------------------

[~julianhyde] I used this query to reproduce:
{code}
select sum(l_extendedprice)
from lineitem, part
where
     p_partkey = l_partkey
     and l_quantity > (
       select avg(l_quantity)
       from lineitem
       where l_partkey = p_partkey
    )
{code}

There are two Aggregates in the operator tree, one with avg(l_quantity) will be 
affected by the correlation, but the outer aggregation sum(l_extendedprice) is 
not. 

> Decorrelator assertion fail
> ---------------------------
>
>                 Key: CALCITE-1543
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1543
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Kurt Young
>            Assignee: Julian Hyde
>
> Caused by: java.lang.AssertionError at 
> org.apache.calcite.sql2rel.RelDecorrelator.decorrelateRel(RelDecorrelator.java:456)
> The code is:
> {code}
>     final Frame frame = getInvoke(oldInput, rel);
>     if (frame == null) {
>       // If input has not been rewritten, do not rewrite this rel.
>       return null;
>     }
>     assert !frame.corVarOutputPos.isEmpty();
> {code}
> Seems like it's no need to assert the corVarOutputPos because in some cases, 
> the correlate has been fully rewritten. 



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

Reply via email to