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

Extract common expressions for disjunctions in Join

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.37.0
    • None
    • core

    Description

      For SQL:

      select *
      from tbl_a
        join tbl_b on tbl_a.id = tbl_b.id
      where (tbl_a.x > 100 and tbl_b.y < 10)
         or (tbl_a.x > 100 and tbl_b.z > 20)

      we can rewrite it to

      select *
      from tbl_a
        join tbl_b on tbl_a.id = tbl_b.id
      where tbl_a.x > 100
        and (tbl_b.y < 10 or tbl_b.z > 20)

      And in this way tbl_a.x > 100 can be pushed down and it is likely that this will help reduce the amount of data involved in the join.

      Attachments

        Issue Links

        Activity

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

          People

            Unassigned Unassigned
            frostruan ruanhui

            Dates

              Created:
              Updated:

              Slack

                Issue deployment