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

Introduce a Rule to infer predicates from equi join conditions.

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.0-incubating
    • Component/s: None
    • Labels:
      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

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: