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

Introduce a Rule to infer predicates from equi join conditions.

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.0-incubating
    • None
    • None

    Description

      This is along the lines of the TransitivePredicate inference Rule in Hive.
      For e.g. for

      select 1 from sales.emp d inner join sales.emp e 
      on d.deptno = e.deptno where e.deptno > 7
      

      we can infer

      ProjectRel(EXPR$0=[1])
        JoinRel(condition=[=($7, $16)], joinType=[inner])
          FilterRel(condition=[>($7, 7)])
            TableAccessRel(table=[[CATALOG, SALES, EMP]])
          FilterRel(condition=[>($7, 7)])
            TableAccessRel(table=[[CATALOG, SALES, EMP]])
      

      More egs in the patch. We can do better than Hive: by pulling up Predicates that are effective above every RelNode and inferring new Predicates for the other side of a Join.

      Attachments

        1. OPTIQ-360.1.patch
          61 kB
          Harish Butani

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              rhbutani Harish Butani
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: