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

FilterJoinRule cannot simplify left join to inner join for `WHERE RHS.C1 IS NOT NULL OR RHS.C2 IS NOT NULL`

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.25.0, 1.31.0
    • 1.32.0
    • core

    Description

      For the following query:

      SELECT 
        * 
      FROM 
        (
          SELECT 
            A.C0 AS L, 
            B.C1 AS R1, 
            B.C2 AS R2 
          FROM 
            A 
            LEFT JOIN B
        ) 
      WHERE 
        (R1 IS NOT NULL) 
        OR (R2 IS NOT NULL)
      

      it should be optimized to

         SELECT 
            A.C0 AS L, 
            B.C1 AS R1, 
            B.C2 AS R2 
          FROM 
            A 
            INNER JOIN B
      

       but it didn't.

      The FilterJoinRule fails to simplify this specific case, however if we have only 1 IS_NOT_NULL in the filter condition, it is able to do so.
      I think the problem is in the Strong class.

      Attachments

        Activity

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

          People

            Unassigned Unassigned
            alimans3 Ali Mansour
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 40m
                1h 40m

                Slack

                  Issue deployment