You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Roman Kondakov (Jira)" <ji...@apache.org> on 2023/04/23 11:33:00 UTC

[jira] [Created] (CALCITE-5670) Assertion error in SemiJoinJoinTransposeRule

Roman Kondakov created CALCITE-5670:
---------------------------------------

             Summary: Assertion error in SemiJoinJoinTransposeRule
                 Key: CALCITE-5670
                 URL: https://issues.apache.org/jira/browse/CALCITE-5670
             Project: Calcite
          Issue Type: Bug
    Affects Versions: 1.34.0
            Reporter: Roman Kondakov
            Assignee: Roman Kondakov
             Fix For: 1.35.0


The following test will raise the assertion error:

{code:java}
  @Test void testPushSemiJoinPastJoinRuleNotHappensJoinKeysDifferentOrigin() {
    // tests the case where the semijoin is pushed to the right
    final String sql = "select e.ename from emp e, dept d, bonus b\n"
        + "where e.deptno = d.deptno and e.ename = b.ename and d.name = b.job";
    sql(sql)
        .withRule(CoreRules.FILTER_INTO_JOIN,
            CoreRules.JOIN_ADD_REDUNDANT_SEMI_JOIN,
            CoreRules.SEMI_JOIN_JOIN_TRANSPOSE)
        .check();
  }
{code}


{noformat}
java.lang.AssertionError
	at org.apache.calcite.rel.rules.SemiJoinJoinTransposeRule.onMatch(SemiJoinJoinTransposeRule.java:112)
	at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:337)
	at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
	at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:420)
	at org.apache.calcite.plan.hep.HepPlanner.executeRuleInstance(HepPlanner.java:243)
	at org.apache.calcite.plan.hep.HepInstruction$RuleInstance$State.execute(HepInstruction.java:178)
	at org.apache.calcite.plan.hep.HepPlanner.lambda$executeProgram$0(HepPlanner.java:211)
	at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:422)
	at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:210)
	at org.apache.calcite.plan.hep.HepProgram$State.execute(HepProgram.java:118)
	at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:205)
	at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:191)
	at org.apache.calcite.test.RelOptFixture.checkPlanning(RelOptFixture.java:379)
	at org.apache.calcite.test.RelOptFixture.check(RelOptFixture.java:330)
	at org.apache.calcite.test.RelOptFixture.check(RelOptFixture.java:314)
	at org.apache.calcite.test.RelOptRulesTest.testPushSemiJoinPastJoinRuleNotHappensJoinKeysDifferentOrigin(RelOptRulesTest.java:2650)
{noformat}

The problem here is that the case when top-most Semi-Join has join keys from both tables of the bottom Join is considered impossible, though it happens in practice.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)