You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Ruben Q L (Jira)" <ji...@apache.org> on 2020/09/17 15:35:00 UTC

[jira] [Created] (CALCITE-4261) Join with three tables causes IllegalArgumentException in EnumerableBatchNestedLoopJoinRule

Ruben Q L created CALCITE-4261:
----------------------------------

             Summary: Join with three tables causes IllegalArgumentException in EnumerableBatchNestedLoopJoinRule
                 Key: CALCITE-4261
                 URL: https://issues.apache.org/jira/browse/CALCITE-4261
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.25.0
            Reporter: Ruben Q L
             Fix For: 1.26.0


Issue can be reproduced with the following test (to be added in {{EnumerableBatchNestedLoopJoinTest}}):
{code}
  @Test void doubleInnerBatchJoinTestSQL() {
    tester(false, new JdbcTest.HrSchema())
        .query("select e.name, d.name as dept, l.name as location "
            + "from emps e join depts d on d.deptno <> e.salary "
            + "join locations l on e.empid <> l.empid and d.deptno = l.empid")
        .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> {
          planner.removeRule(EnumerableRules.ENUMERABLE_CORRELATE_RULE);
          planner.addRule(EnumerableRules.ENUMERABLE_BATCH_NESTED_LOOP_JOIN_RULE);
        })
        .explainContains("EnumerableBatchNestedLoopJoin")
        .returnsUnordered("name=Bill; dept=Sales; location=San Francisco",
            "name=Eric; dept=Sales; location=San Francisco",
            "name=Sebastian; dept=Sales; location=San Francisco",
            "name=Theodore; dept=Sales; location=San Francisco");
  }
{code}

Which causes:
{code}
Error while executing SQL "explain plan for select e.name, d.name as dept, l.name as location from emps e join depts d on d.deptno <> e.salary join locations l on e.empid <> l.empid and d.deptno = l.empid"
...
Caused by: java.lang.RuntimeException: Error while applying rule EnumerableBatchNestedLoopJoinRule,
...
Caused by: java.lang.IllegalArgumentException: Field #0: empid JavaType(int) does not exist for expression $cor1801
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
...
	at org.apache.calcite.adapter.enumerable.EnumerableBatchNestedLoopJoinRule.onMatch(EnumerableBatchNestedLoopJoinRule.java:127)
	at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:229)
...
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)