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

Incorrect result in aggregate query with "where" based on inline view

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • Impala 1.3
    • Impala 1.3
    • None
    • None

    Description

      This happens on 1.2.4, 1.3.0, and master.

      The result of the first query below should be 1. Somehow including the "where" clause causes a problem.

      [localhost:21000] > select count(*) FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1 WHERE c > 1;
      Query: select count(*) FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1 WHERE c > 1
      +----------+
      | count(*) |
      +----------+
      | 0        |
      +----------+
      Returned 1 row(s) in 0.12s
      
      [localhost:21000] > explain select count(*) FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1 WHERE c > 1;
      Query: explain select count(*) FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1 WHERE c > 1
      +----------------------------------------------------------+
      | Explain String                                           |
      +----------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=74.00MB VCores=1 |
      |                                                          |
      | 02:AGGREGATE [FINALIZE]                                  |
      | |  output: count(*)                                      |
      | |                                                        |
      | 04:AGGREGATE [MERGE FINALIZE]                            |
      | |  output: sum(count(*))                                 |
      | |  having: count(*) > 1                                  |
      | |                                                        |
      | 03:EXCHANGE [PARTITION=UNPARTITIONED]                    |
      | |                                                        |
      | 01:AGGREGATE                                             |
      | |  output: count(*)                                      |
      | |                                                        |
      | 00:SCAN HDFS [functional.alltypesagg]                    |
      |    partitions=10/10 size=743.67KB                        |
      +----------------------------------------------------------+
      Returned 16 row(s) in 0.02s
      
      
      [localhost:21000] > select * FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1 WHERE c > 1;
      Query: select * FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1 WHERE c > 1
      +-------+
      | c     |
      +-------+
      | 10000 |
      +-------+
      Returned 1 row(s) in 0.13s
      
      
      [localhost:21000] > select count(*) FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1;
      Query: select count(*) FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1
      +----------+
      | count(*) |
      +----------+
      | 1        |
      +----------+
      Returned 1 row(s) in 0.12s
      
      [localhost:21000] > explain select count(*) FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1;
      Query: explain select count(*) FROM ( SELECT count(*) AS c FROM alltypesagg) AS t1
      +----------------------------------------------------------+
      | Explain String                                           |
      +----------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=74.00MB VCores=1 |
      |                                                          |
      | 02:AGGREGATE [FINALIZE]                                  |
      | |  output: count(*)                                      |
      | |                                                        |
      | 04:AGGREGATE [MERGE FINALIZE]                            |
      | |  output: sum(count(*))                                 |
      | |                                                        |
      | 03:EXCHANGE [PARTITION=UNPARTITIONED]                    |
      | |                                                        |
      | 01:AGGREGATE                                             |
      | |  output: count(*)                                      |
      | |                                                        |
      | 00:SCAN HDFS [functional.alltypesagg]                    |
      |    partitions=10/10 size=743.67KB                        |
      +----------------------------------------------------------+
      Returned 15 row(s) in 0.02s
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            caseyc casey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: