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

Extra logic to derive additional filters in the FilterJoinRule

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.16.0
    • None
    • core
    • None

    Description

      There is necessary to add logic to derive additional filters from for FilterJoinRule in the case of using disjunction of expressions:
      https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/FilterJoinRule.java#L155

      The example query is:

       
      select * from sales.emp e join 
      sales.dept d on e.job = d.name
      where (e.deptno = 5 AND d.deptno = 2)
      OR (e.deptno = 7 AND d.deptno = 3)
      

      The filrer condition in DNF
      LogicalFilter(condition=[OR(AND(=($7, 5), =($9, 2)), AND(=($7, 7), =($9, 3)))])
      can be transformed into CNF and then the ncessary filters can be pushed down:
      LogicalFilter(condition=[OR(=($7, 5), =($7, 7))]) and LogicalFilter(condition=[OR(=($9, 2), =($9, 3))])
      Additional filter still will be present on top of join.

      Finally deriving additional filters can allow to scan less information.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vitalii Vitalii Diravka
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: