Description
test:
@Test public void testCorrelationScalarAggAndFilter() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" + "and e1.sal > (select avg(sal) from emp e2 where e1.empno = e2.empno)"; HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE) .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(ReduceExpressionsRule.JOIN_INSTANCE) .build(); sql(sql) .withDecorrelation(true) .withTrim(true) .expand(true) .withPre(program) .with(program) .check(); }
excption:
java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.elementData(ArrayList.java:422) at java.util.ArrayList.set(ArrayList.java:450) at org.apache.calcite.rex.RexSimplify.processRange(RexSimplify.java:1018) at org.apache.calcite.rex.RexSimplify.simplifyAnd2ForUnknownAsFalse(RexSimplify.java:613) at org.apache.calcite.rex.RexSimplify.simplifyAnd2ForUnknownAsFalse(RexSimplify.java:579) at org.apache.calcite.rex.RexSimplify.simplifyAnd(RexSimplify.java:538) at org.apache.calcite.rex.RexSimplify.simplify(RexSimplify.java:136) at org.apache.calcite.rex.RexUtil$ExprSimplifier.visitCall(RexUtil.java:2625) at org.apache.calcite.rex.RexUtil$ExprSimplifier.visitCall(RexUtil.java:2585) at org.apache.calcite.rex.RexCall.accept(RexCall.java:107) at org.apache.calcite.rex.RexShuttle.apply(RexShuttle.java:284) at org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressions(ReduceExpressionsRule.java:547) at org.apache.calcite.rel.rules.ReduceExpressionsRule$JoinReduceExpressionsRule.onMatch(ReduceExpressionsRule.java:331) at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:317) at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:508) at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:387) at org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:252) at org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127) at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:211) at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:198) at org.apache.calcite.test.RelOptTestBase.checkPlanning(RelOptTestBase.java:155) at org.apache.calcite.test.RelOptTestBase$Sql.check(RelOptTestBase.java:300) at org.apache.calcite.test.RelOptTestBase$Sql.check(RelOptTestBase.java:284) at org.apache.calcite.test.RelOptRulesTest.testCorrelationScalarAggAndFilter(RelOptRulesTest.java:1634)
Attachments
Issue Links
- is duplicated by
-
CALCITE-2149 RexSimplify throws indexOutOfBoundException
- Closed