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

Incorrect results due to incorrect plan (Nested Types)

    XMLWordPrintableJSON

Details

    Description

      The query should return 0 rows, but this is not the case.

      Query:

      SELECT 1
      FROM table_1 t1
      LEFT JOIN table_2 t2 ON (t2.field_34.field_40) = (t1.field_17)
      INNER JOIN t2.field_32 t3
      

      Plan:

      +------------------------------------------------------------------------------------+
      | Explain String                                                                     |
      +------------------------------------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=2.06GB VCores=2                            |
      | WARNING: The following tables are missing relevant table and/or column statistics. |
      | random_nested_db_0.table_1, random_nested_db_0.table_2                             |
      |                                                                                    |
      | 08:EXCHANGE [UNPARTITIONED]                                                        |
      | |                                                                                  |
      | 06:HASH JOIN [LEFT OUTER JOIN, BROADCAST]                                          |
      | |  hash predicates: (t1.field_17) = (t2.field_34.field_40)                         |
      | |                                                                                  |
      | |--07:EXCHANGE [BROADCAST]                                                         |
      | |  |                                                                               |
      | |  02:SUBPLAN                                                                      |
      | |  |                                                                               |
      | |  |--05:NESTED LOOP JOIN [CROSS JOIN]                                             |
      | |  |  |                                                                            |
      | |  |  |--03:SINGULAR ROW SRC                                                       |
      | |  |  |                                                                            |
      | |  |  04:UNNEST [t2.field_32 t3]                                                   |
      | |  |                                                                               |
      | |  01:SCAN HDFS [random_nested_db_0.table_2 t2]                                    |
      | |     partitions=1/1 files=1 size=18.09MB                                          |
      | |                                                                                  |
      | 00:SCAN HDFS [random_nested_db_0.table_1 t1]                                       |
      |    partitions=1/1 files=1 size=4.15MB                                              |
      +------------------------------------------------------------------------------------+
      

      Equivalent query for flattened data:

      SELECT 1
      FROM table_1 t1
      LEFT JOIN  table_2 t2 ON (t2.field_34_field_40) = (t1.field_17)
      INNER JOIN LATERAL (
      SELECT *
      FROM table_2_field_32 t3
      WHERE
      (t2.id) = (t3.table_2_id)
      ) t3 ON True
      

      Attachments

        Activity

          People

            alex.behm Alexander Behm
            tarasbob Taras Bobrovytsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: