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

WHERE condition ignored in simple query with RIGHT JOIN

    XMLWordPrintableJSON

Details

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

    Description

      This seems to be specific to RIGHT JOIN. If the query is rewritten to use a LEFT JOIN the results are correct.

      [localhost:21000] > select 1 FROM alltypes AS t1 RIGHT JOIN alltypestiny AS t2 ON t2.int_col = t1.int_col WHERE false limit 1;
      Query: select 1 FROM alltypes AS t1 RIGHT JOIN alltypestiny AS t2 ON t2.int_col = t1.int_col WHERE false limit 1
      +---+
      | 1 |
      +---+
      | 1 |
      +---+
      Returned 1 row(s) in 0.14s
      
      
      [localhost:21000] > explain select 1 FROM alltypes AS t1 RIGHT JOIN alltypestiny AS t2 ON t2.int_col = t1.int_col WHERE false limit 1;
      Query: explain select 1 FROM alltypes AS t1 RIGHT JOIN alltypestiny AS t2 ON t2.int_col = t1.int_col WHERE false limit 1
      +----------------------------------------------------------+
      | Explain String                                           |
      +----------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=32.00MB VCores=2 |
      |                                                          |
      | 05:EXCHANGE [UNPARTITIONED]                              |
      | |  limit: 1                                              |
      | |                                                        |
      | 02:HASH JOIN [RIGHT OUTER JOIN, PARTITIONED]             |
      | |  hash predicates: t1.int_col = t2.int_col              |
      | |  limit: 1                                              |
      | |                                                        |
      | |--04:EXCHANGE [HASH(t2.int_col)]                        |
      | |  |                                                     |
      | |  01:SCAN HDFS [functional.alltypestiny t2]             |
      | |     partitions=4/4 size=460B                           |
      | |                                                        |
      | 03:EXCHANGE [HASH(t1.int_col)]                           |
      | |                                                        |
      | 00:SCAN HDFS [functional.alltypes t1]                    |
      |    partitions=0/24 size=0B                               |
      +----------------------------------------------------------+
      Returned 18 row(s) in 0.02s
      
      
      [localhost:21000] > select 1 FROM alltypestiny AS t1 LEFT JOIN alltypes AS t2 ON t2.int_col = t1.int_col WHERE false limit 1;
      Query: select 1 FROM alltypestiny AS t1 LEFT JOIN alltypes AS t2 ON t2.int_col = t1.int_col WHERE false limit 1
      
      Returned 0 row(s) in 0.13s
      
      
      [localhost:21000] > explain select 1 FROM alltypestiny AS t1 LEFT JOIN alltypes AS t2 ON t2.int_col = t1.int_col WHERE false limit 1;
      Query: explain select 1 FROM alltypestiny AS t1 LEFT JOIN alltypes AS t2 ON t2.int_col = t1.int_col WHERE false limit 1
      +-----------------------------------------------------------+
      | Explain String                                            |
      +-----------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=160.03MB VCores=2 |
      |                                                           |
      | 04:EXCHANGE [UNPARTITIONED]                               |
      | |  limit: 1                                               |
      | |                                                         |
      | 02:HASH JOIN [LEFT OUTER JOIN, BROADCAST]                 |
      | |  hash predicates: t1.int_col = t2.int_col               |
      | |  limit: 1                                               |
      | |                                                         |
      | |--03:EXCHANGE [BROADCAST]                                |
      | |  |                                                      |
      | |  01:SCAN HDFS [functional.alltypes t2]                  |
      | |     partitions=24/24 size=478.45KB                      |
      | |                                                         |
      | 00:SCAN HDFS [functional.alltypestiny t1]                 |
      |    partitions=0/4 size=0B                                 |
      +-----------------------------------------------------------+
      Returned 16 row(s) in 0.01s
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: