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

Incorrect plan when WHERE and outer JOIN predicates share a column

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • Impala 2.0
    • Impala 2.0
    • None

    Description

      This may be the same as IMPALA-1102.

      The predicate "t2.date_string_col = t1.string_col" in the inline view effectively transforms the LEFT JOIN into a INNER JOIN. However the plan is a RIGHT JOIN without the WHERE predicate, which is incorrect.

      Query: explain select COUNT(1) FROM
      (SELECT t2.string_col AS string_col_1,
      t1.string_col AS string_col_2
      FROM alltypesagg t1
      LEFT JOIN alltypes t2 ON t2.date_string_col = t1.string_col
      WHERE t2.date_string_col = t1.string_col) t1
      LEFT JOIN alltypestiny t3 ON t3.string_col = t1.string_col_1
      AND t3.date_string_col = t1.string_col_2
      +---------------------------------------------------------------------------------------+
      | Explain String                                                                        |
      +---------------------------------------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=170.07MB VCores=3                             |
      |                                                                                       |
      | 10:AGGREGATE [FINALIZE]                                                               |
      | |  output: count:merge(1)                                                             |
      | |                                                                                     |
      | 09:EXCHANGE [UNPARTITIONED]                                                           |
      | |                                                                                     |
      | 05:AGGREGATE                                                                          |
      | |  output: count(1)                                                                   |
      | |                                                                                     |
      | 04:HASH JOIN [LEFT OUTER JOIN, BROADCAST]                                             |
      | |  hash predicates: t2.string_col = t3.string_col, t1.string_col = t3.date_string_col |
      | |                                                                                     |
      | |--08:EXCHANGE [BROADCAST]                                                            |
      | |  |                                                                                  |
      | |  03:SCAN HDFS [functional.alltypestiny t3]                                          |
      | |     partitions=4/4 size=460B                                                        |
      | |                                                                                     |
      | 02:HASH JOIN [RIGHT OUTER JOIN, PARTITIONED]                                          |
      | |  hash predicates: t2.date_string_col = t1.string_col                                |
      | |                                                                                     |
      | |--07:EXCHANGE [HASH(t1.string_col)]                                                  |
      | |  |                                                                                  |
      | |  00:SCAN HDFS [functional.alltypesagg t1]                                           |
      | |     partitions=11/11 size=814.73KB                                                  |
      | |                                                                                     |
      | 06:EXCHANGE [HASH(t2.date_string_col)]                                                |
      | |                                                                                     |
      | 01:SCAN HDFS [functional.alltypes t2]                                                 |
      |    partitions=24/24 size=478.45KB                                                     |
      +---------------------------------------------------------------------------------------+
      Fetched 30 row(s) in 0.03s
      

      Attachments

        Activity

          People

            alex.behm Alexander Behm
            caseyc casey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: