You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Haisheng Yuan (Jira)" <ji...@apache.org> on 2020/07/16 03:20:00 UTC

[jira] [Created] (CALCITE-4126) Stackoverflow error when applying JoinCommuteRule

Haisheng Yuan created CALCITE-4126:
--------------------------------------

             Summary: Stackoverflow error when applying JoinCommuteRule
                 Key: CALCITE-4126
                 URL: https://issues.apache.org/jira/browse/CALCITE-4126
             Project: Calcite
          Issue Type: Improvement
          Components: core
            Reporter: Haisheng Yuan


Add the test case to RelOptRulesTest.java

{code:java}
  @Test void testJoinCommute() {
    final HepProgram program = HepProgram.builder()
        .addRuleInstance(JoinCommuteRule.INSTANCE)
        .build();
    final String sql = "select * \n"
        + "from sales.emp e join sales.dept d on e.empno > d.deptno";
    sql(sql).with(program).check();
  }
{code}

Stacktrace:

{code:java}
java.lang.StackOverflowError
	at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112)
	at org.apache.calcite.rel.core.Project.isValid(Project.java:210)
	at org.apache.calcite.rel.core.Project.<init>(Project.java:90)
	at org.apache.calcite.rel.logical.LogicalProject.<init>(LogicalProject.java:67)
	at org.apache.calcite.rel.logical.LogicalProject.copy(LogicalProject.java:128)
	at org.apache.calcite.rel.logical.LogicalProject.copy(LogicalProject.java:45)
	at org.apache.calcite.rel.core.Project.copy(Project.java:122)
	at org.apache.calcite.plan.hep.HepPlanner.addRelToGraph(HepPlanner.java:803)
	at org.apache.calcite.plan.hep.HepPlanner.applyTransformationResults(HepPlanner.java:732)
	at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:543)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:360)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:372)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:372)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:372)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:372)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:372)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:372)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:372)
	at org.apache.calcite.plan.hep.HepPlanner.depthFirstApply(HepPlanner.java:372)
{code}

I check master branch and 1.23.0, both throw StackOverflowError.



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