HULING created CALCITE-2136:
-------------------------------

             Summary: SubQueryRemoveRule.Project generated error plan
                 Key: CALCITE-2136
                 URL: https://issues.apache.org/jira/browse/CALCITE-2136
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.4.0-incubating
            Reporter: HULING
            Assignee: Julian Hyde


SQL:

SELECT name, (select count(1) from EMPS t2 where t2.name = t1.name) 
FROM EMPS t1

config:

SqlToRelConverter.Config.isExpand()  : false

PLAN | 
-----------------------
EnumerableJoin(condition=[true], joinType=[left])
       TextTableScan(table=[[EMPS]], fields=[[1]])
       EnumerableAggregate(group=[{}], EXPR$0=[COUNT()])
                EnumerableCalc(expr#0=[\{inputs}], 
{color:#FF0000}expr#1=[$cor0]{color}, expr#2=[$t1.NAME], expr#3=[=($t0, $t2)], 
NAME=[$t0], $condition=[$t3])
                         TextTableScan(table=[[EMPS]], fields=[[1]])

Execution Error:

Correlation variable $cor0 should be defined
 at 
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.getCorrelVariableGetter(EnumerableRelImplementor.java:480)
 at 
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor$1.apply(EnumerableRelImplementor.java:85)
 at 
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor$1.apply(EnumerableRelImplementor.java:1)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate0(RexToLixTranslator.java:682)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:221)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate0(RexToLixTranslator.java:651)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:221)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:210)
 at 
org.apache.calcite.adapter.enumerable.RexImpTable.implementNullSemantics(RexImpTable.java:892)
 at 
org.apache.calcite.adapter.enumerable.RexImpTable.implementNullSemantics0(RexImpTable.java:845)
 at 
org.apache.calcite.adapter.enumerable.RexImpTable.access$0(RexImpTable.java:814)
 at 
org.apache.calcite.adapter.enumerable.RexImpTable$6.implement(RexImpTable.java:491)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translateCall(RexToLixTranslator.java:714)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate0(RexToLixTranslator.java:686)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:221)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate0(RexToLixTranslator.java:651)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:221)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:210)
 at 
org.apache.calcite.adapter.enumerable.RexImpTable$IsXxxImplementor.implement(RexImpTable.java:2118)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translateCall(RexToLixTranslator.java:714)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate0(RexToLixTranslator.java:686)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:221)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate0(RexToLixTranslator.java:651)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:221)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:210)
 at 
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translateCondition(RexToLixTranslator.java:909)
 at 
org.apache.calcite.adapter.enumerable.EnumerableCalc.implement(EnumerableCalc.java:167)
 at 
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:103)
 at 
org.apache.calcite.adapter.enumerable.EnumerableAggregate.implement(EnumerableAggregate.java:106)
 at 
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:103)
 at 
org.apache.calcite.adapter.enumerable.EnumerableJoin.implement(EnumerableJoin.java:191)
 at 
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:103)
 at 
org.apache.calcite.adapter.enumerable.EnumerableLimit.implement(EnumerableLimit.java:106)
 at 
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:108)
 at 
org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
 at 
org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1262)
 at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:333)

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to