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

Expand predicates from disjunction for inputs of Join

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.39.0
    • 1.40.0
    • core
    • None

    Description

      Similar to Calcite-6914, we can expand redundant predicates from the disjunction and push them down. However, the predicates expanded by Calcite-6914 must belong to a single table, that is, if join_type does not restrict pushdown, the redundant predicates can be pushed directly on TableScan.

      However, pushing predicates down to the inputs of Join is also very useful (link), for example:

      select t1.id from t1, t2, t3
      where t1.id = t2.id
      and t1.id = t3.id
      and (
          (t1.age < 50 and t3.age > 20)
          or
          (t2.weight > 70 and t3.height < 180)
      ) 

      Because (t1.age < 50 and t3.age > 20) or (t2.weight > 70 and t3.height < 180) a is a disjunction and involves multiple tables, it cannot be pushed down.

      However, we can expand it to (t1.age < 50 or t2.weight > 70) , (t3.age > 20 or t3.height < 180), and push them down to both sides of Join.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            dongsl Silun Dong
            dongsl Silun Dong
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment