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

Prune the null-generating side of an outer join if it is empty

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.33.0
    • core

    Description

      If a Join generates null on the right and the right branch of the join known never produces any rows the join can be replaced with the left branch and a project on top of it which contains the expressions come from the left branch and null constants from the right branch. Example:

      select * from emp e
      left outer join (select * from dept where false) as d on e.deptno = d.deptno
      
      select 
        e.*, 
        cast(null as <dept_col0_type>) as <dept_col0_name>
        ... 
        cast(null as <dept_coln_type>) as <dept_coln_name> 
      from emp
      

      Attachments

        Issue Links

          Activity

            People

              kkasa Krisztian Kasa
              kkasa Krisztian Kasa
              Votes:
              0 Vote for this issue
              Watchers:
              6 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 - 4h 10m
                  4h 10m