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

JoinPushTransitivePredicatesRule should not create a Filter on top of an equivalent Filter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.15.0
    • 1.17.0
    • core
    • None

    Description

      CALCITE-2200 resolves some cases of infinite loop via stopping of recursion in HepPlanner#applyRules, when newVertex is the same as vertex.

      In this jira one more case of infinite loop is described:
      JoinPushTransitivePredicatesRule#onMatch generates new right or left inputs via using RelBuilder#filter method on top of LogicalFilter RelNode with the same condition.
      In this case a new RelNode shouldn't be created. Possible fix to change logic of RelBuilder#filter method.

      TestCase for reproduce:

        @Test public void testJoinPushTransitivePredicatesRule2() {
          HepProgramBuilder builder = new HepProgramBuilder();
          builder.addRuleInstance(JoinPushTransitivePredicatesRule.INSTANCE);
          HepProgram build = builder.build();
          HepPlanner hepPlanner = new HepPlanner(build);
      
          final String sql = "select n1.SAL from EMPNULLABLES_20 n1 where n1.SAL\n"
              + "IN (select n2.SAL from EMPNULLABLES_20 n2 "
              + "where n1.SAL = n2.SAL or n1.SAL = 4)";
      
          sql(sql)
              .withDecorrelation(true)
              .with(hepPlanner)
              .check();
        }
      

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              vitalii Vitalii Diravka
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: