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

ReduceExpressionsRule$JoinReduceExpressionsRule(java.lang.IndexOutOfBoundsException: Index: 0, Size: 0)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Cannot Reproduce
    • 1.23.0
    • 1.24.0
    • core
    • None

    Description

      [DEBUG]  EXPLAIN select (select c.id from db1.company as c  where c.id = t.id limit 0 ,10000) from db1.travelrecord as t where t.id = 1 LIMIT 500 ,10000
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.sql.parser toTree at 641]-[DEBUG] Reduced `c`.`id` = `t`.`id`
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.sql.parser toTree at 641]-[DEBUG] Reduced `t`.`id` = 1
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.sql2rel convertQuery at 581]-[DEBUG] Plan after converting SqlNode to RelNode
      LogicalSort(offset=[500], fetch=[10000])
        LogicalProject(EXPR$0=[$6])
          LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])
            LogicalFilter(condition=[=($0, 1)])
              LogicalTableScan(table=[[db1, travelrecord]])
            LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])
              LogicalSort(offset=[0], fetch=[10000])
                LogicalProject(id=[$0])
                  LogicalFilter(condition=[=(CAST($0):BIGINT, $cor0.id)])
                    LogicalTableScan(table=[[db1, company]])15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.AbstractRelOptPlanner.rule_execution_summary dumpRuleAttemptsInfo at 295]-[DEBUG] Rule Attempts Info for HepPlanner
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.AbstractRelOptPlanner.rule_execution_summary dumpRuleAttemptsInfo at 296]-[DEBUG] 
      Rules                                                                   Attempts           Time (us)15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#266:LogicalSort.NONE.[](input=HepRelVertex#265,offset=500,fetch=10000)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#264:LogicalProject.NONE.[](input=HepRelVertex#263,exprs=[$6])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#262:LogicalCorrelate.NONE.[](left=HepRelVertex#252,right=HepRelVertex#261,correlation=$cor0,joinType=left,requiredColumns={0})
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#251:LogicalFilter.NONE.[](input=HepRelVertex#250,condition==(1, $0))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#238:LogicalTableScan.NONE.[](table=[db1, travelrecord])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#260:LogicalAggregate.NONE.[](input=HepRelVertex#259,group={},agg#0=SINGLE_VALUE($0))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#258:LogicalSort.NONE.[](input=HepRelVertex#257,offset=0,fetch=10000)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#256:LogicalProject.NONE.[](input=HepRelVertex#255,inputs=0)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#254:LogicalFilter.NONE.[](input=HepRelVertex#253,condition==($cor0.id, CAST($0):BIGINT))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#240:LogicalTableScan.NONE.[](table=[db1, company])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.sql2rel decorrelateQuery at 210]-[DEBUG] Plan after removing Correlator
      LogicalSort(offset=[500], fetch=[10000])
        LogicalProject(EXPR$0=[$6])
          LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])
            LogicalFilter(condition=[=($0, 1)])
              LogicalTableScan(table=[[db1, travelrecord]])
            LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])
              LogicalSort(offset=[0], fetch=[10000])
                LogicalProject(id=[$0])
                  LogicalFilter(condition=[=(CAST($0):BIGINT, $cor0.id)])
                    LogicalTableScan(table=[[db1, company]])15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner fireRule at 324]-[DEBUG] call#62: Apply rule [AdjustProjectForCountAggregateRule] to [rel#280:LogicalCorrelate.NONE.[](left=HepRelVertex#270,right=HepRelVertex#279,correlation=$cor0,joinType=left,requiredColumns={0}), rel#269:LogicalFilter.NONE.[](input=HepRelVertex#268,condition==(1, $0)), rel#278:LogicalAggregate.NONE.[](input=HepRelVertex#277,group={},agg#0=SINGLE_VALUE($0))]
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyTransformation at 364]-[DEBUG] call#62: Rule AdjustProjectForCountAggregateRule arguments [rel#280:LogicalCorrelate.NONE.[](left=HepRelVertex#270,right=HepRelVertex#279,correlation=$cor0,joinType=left,requiredColumns={0}), rel#269:LogicalFilter.NONE.[](input=HepRelVertex#268,condition==(1, $0)), rel#278:LogicalAggregate.NONE.[](input=HepRelVertex#277,group={},agg#0=SINGLE_VALUE($0))] produced rel#288:LogicalProject#288
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner fireRule at 324]-[DEBUG] call#63: Apply rule [AdjustProjectForCountAggregateRule] to [rel#291:LogicalCorrelate.NONE.[](left=HepRelVertex#289,right=HepRelVertex#290,correlation=$cor0,joinType=left,requiredColumns={0}), rel#269:LogicalFilter.NONE.[](input=HepRelVertex#268,condition==(1, $0)), rel#278:LogicalAggregate.NONE.[](input=HepRelVertex#277,group={},agg#0=SINGLE_VALUE($0))]
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner fireRule at 324]-[DEBUG] call#64: Apply rule [AdjustProjectForCountAggregateRule] to [rel#291:LogicalCorrelate.NONE.[](left=HepRelVertex#289,right=HepRelVertex#290,correlation=$cor0,joinType=left,requiredColumns={0}), rel#269:LogicalFilter.NONE.[](input=HepRelVertex#268,condition==(1, $0)), rel#278:LogicalAggregate.NONE.[](input=HepRelVertex#277,group={},agg#0=SINGLE_VALUE($0))]
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.AbstractRelOptPlanner.rule_execution_summary dumpRuleAttemptsInfo at 295]-[DEBUG] Rule Attempts Info for HepPlanner
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.AbstractRelOptPlanner.rule_execution_summary dumpRuleAttemptsInfo at 296]-[DEBUG] 
      Rules                                                                   Attempts           Time (us)
      AdjustProjectForCountAggregateRule                                             3               7,17715:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#284:LogicalSort.NONE.[](input=HepRelVertex#283,offset=500,fetch=10000)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#282:LogicalProject.NONE.[](input=HepRelVertex#281,exprs=[$6])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#293:LogicalProject.NONE.[](input=HepRelVertex#292,inputs=0..6)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#291:LogicalCorrelate.NONE.[](left=HepRelVertex#289,right=HepRelVertex#290,correlation=$cor0,joinType=left,requiredColumns={0})
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#269:LogicalFilter.NONE.[](input=HepRelVertex#268,condition==(1, $0))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#238:LogicalTableScan.NONE.[](table=[db1, travelrecord])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#278:LogicalAggregate.NONE.[](input=HepRelVertex#277,group={},agg#0=SINGLE_VALUE($0))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#276:LogicalSort.NONE.[](input=HepRelVertex#275,offset=0,fetch=10000)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#274:LogicalProject.NONE.[](input=HepRelVertex#273,inputs=0)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#272:LogicalFilter.NONE.[](input=HepRelVertex#271,condition==($cor0.id, CAST($0):BIGINT))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#240:LogicalTableScan.NONE.[](table=[db1, company])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner fireRule at 324]-[DEBUG] call#65: Apply rule [FilterJoinRule:FilterJoinRule:no-filter] to [rel#324:LogicalJoin.NONE.[](left=HepRelVertex#310,right=HepRelVertex#323,condition==($0, $6),joinType=left)]
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.AbstractRelOptPlanner.rule_execution_summary dumpRuleAttemptsInfo at 295]-[DEBUG] Rule Attempts Info for HepPlanner
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.AbstractRelOptPlanner.rule_execution_summary dumpRuleAttemptsInfo at 296]-[DEBUG] 
      Rules                                                                   Attempts           Time (us)
      FilterJoinRule:FilterJoinRule:no-filter                                        1               1,04315:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#328:LogicalSort.NONE.[](input=HepRelVertex#327,offset=500,fetch=10000)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#326:LogicalProject.NONE.[](input=HepRelVertex#325,exprs=[$7])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#324:LogicalJoin.NONE.[](left=HepRelVertex#310,right=HepRelVertex#323,condition==($0, $6),joinType=left)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#309:LogicalFilter.NONE.[](input=HepRelVertex#308,condition==(1, $0))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#238:LogicalTableScan.NONE.[](table=[db1, travelrecord])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#322:LogicalAggregate.NONE.[](input=HepRelVertex#321,group={0},agg#0=SINGLE_VALUE($1))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#320:LogicalProject.NONE.[](input=HepRelVertex#319,exprs=[$1, $0])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#318:LogicalSort.NONE.[](input=HepRelVertex#317,fetch=10000)
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#316:LogicalProject.NONE.[](input=HepRelVertex#315,inputs=0,exprs=[$3])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#314:LogicalFilter.NONE.[](input=HepRelVertex#313,condition==($3, CAST($0):BIGINT))
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#312:LogicalProject.NONE.[](input=HepRelVertex#311,inputs=0..2,exprs=[CAST($0):BIGINT])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner notifyChosen at 386]-[DEBUG] For final plan, using rel#240:LogicalTableScan.NONE.[](table=[db1, company])
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner fireRule at 324]-[DEBUG] call#66: Apply rule [ReduceExpressionsRule(Project)] to [rel#348:LogicalProject.NONE.[](input=HepRelVertex#347,exprs=[$7])]
      15:32:08 T=noBindingExecutor2 [org.apache.calcite.plan.RelOptPlanner fireRule at 324]-[DEBUG] call#67: Apply rule [ReduceExpressionsRule(Join)] to [rel#346:LogicalJoin.NONE.[](left=HepRelVertex#332,right=HepRelVertex#345,condition==($0, $6),joinType=left)]
      
      

       

      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:657) at java.util.ArrayList.get(ArrayList.java:433) at org.apache.calcite.rel.rules.ReduceExpressionsRule$RexReplacer.visit(ReduceExpressionsRule.java:858) at org.apache.calcite.rel.rules.ReduceExpressionsRule$RexReplacer.visitInputRef(ReduceExpressionsRule.java:837) at org.apache.calcite.rel.rules.ReduceExpressionsRule$RexReplacer.visitInputRef(ReduceExpressionsRule.java:816) at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) at org.apache.calcite.rex.RexShuttle.visitList(RexShuttle.java:159) at org.apache.calcite.rex.RexShuttle.visitCall(RexShuttle.java:111) at org.apache.calcite.rel.rules.ReduceExpressionsRule$RexReplacer.visitCall(ReduceExpressionsRule.java:849) at org.apache.calcite.rel.rules.ReduceExpressionsRule$RexReplacer.visitCall(ReduceExpressionsRule.java:816) at org.apache.calcite.rex.RexCall.accept(RexCall.java:288) at org.apache.calcite.rex.RexShuttle.apply(RexShuttle.java:287) at org.apache.calcite.rex.RexShuttle.mutate(RexShuttle.java:249) at org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressionsInternal(ReduceExpressionsRule.java:701) at org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressions(ReduceExpressionsRule.java:620) at org.apache.calcite.rel.rules.ReduceExpressionsRule$JoinReduceExpressionsRule.onMatch(ReduceExpressionsRule.java:347) at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:338) at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:540) at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:405) at org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:270) at org.apache.calcite.plan.hep.HepInstruction$RuleCollection.execute(HepInstruction.java:74) at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:201) at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:188)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            jamie12221 jamie12221
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: