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

Create an optimization rule to eliminate UNION from the same source with different filters

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.39.0
    • 1.40.0
    • core

    Description

      The following query

      SELECT * FROM T WHERE p0
      UNION
      SELECT * FROM T WHERE p1
      

      can be rewritten as

      SELECT * FROM T WHERE p0 OR p1 
      

      This works if the the left and right filtered inputs are the same collection.

      This should work even when p0 and p1 return 'true' for the same rows, because UNION eliminates the duplicates.

      A similar rule should work for INTERSECT using AND
       

      Attachments

        Activity

          People

            jensen Zhen Chen
            mbudiu Mihai Budiu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: