Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2136

SubQueryRemoveRule.Project generated error plan

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0-incubating
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None

      Description

      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}], expr#1=[$cor0], 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)

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                wakeup HULING
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: