Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-10382

Predicate with coalesce on both sides of LOJ isn't NULL filtering

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • Impala 4.0.0
    • Frontend

    Description

      A query like the below will have the outer join simplified to an inner join when the predicate with coalesce isn't always NULL filtering.

      select t1.int_col from alltypestiny t1 left outer join alltypesagg t2 on t1.tinyint_col = t2.tinyint_col left outer join alltypes t3 on t1.int_col = t3.int_col where t2.tinyint_col >= coalesce(t1.int_col, t2.int_col);
      
      functional> set ENABLE_OUTER_JOIN_TO_INNER_TRANSFORMATION=true;
      functional> explain select t1.int_col from alltypestiny t1 left outer join alltypesagg t2 on t1.tinyint_col = t2.tinyint_col left outer join alltypes t3 on t1.int_col = t3.int_col where t2.tinyint_col >= coalesce(t1.int_col, t2.int_col);
      Query: explain select t1.int_col from alltypestiny t1 left outer join alltypesagg t2 on t1.tinyint_col = t2.tinyint_col left outer join alltypes t3 on t1.int_col = t3.int_col where t2.tinyint_col >= coalesce(t1.int_col, t2.int_col)
      +------------------------------------------------------------+
      | Explain String                                             |
      +------------------------------------------------------------+
      | Max Per-Host Resource Reservation: Memory=5.04MB Threads=8 |
      | Per-Host Resource Estimates: Memory=287MB                  |
      |                                                            |
      | PLAN-ROOT SINK                                             |
      | 08:EXCHANGE [UNPARTITIONED]                                |
      | 04:HASH JOIN [LEFT OUTER JOIN, PARTITIONED]                |
      | |--07:EXCHANGE [HASH(t3.int_col)]                          |
      | |  02:SCAN HDFS [functional.alltypes t3]                   |
      | 06:EXCHANGE [HASH(t1.int_col)]                             |
      | 03:HASH JOIN [INNER JOIN, BROADCAST]                       |
      | |--05:EXCHANGE [BROADCAST]                                 |
      | |  00:SCAN HDFS [functional.alltypestiny t1]               |
      | 01:SCAN HDFS [functional.alltypesagg t2]                   |
      +------------------------------------------------------------+
      Fetched 13 row(s) in 0.02s
      

      Attachments

        Issue Links

          Activity

            People

              xqhe Xianqing He
              superdupershant Shant Hovsepian
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: