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

Aggregate and predicate ignored on very simple query without group by clause or aggergate expressions in select clause

    XMLWordPrintableJSON

Details

    Description

      MySQL and Postgresql agree that the result of

      SELECT 1 FROM non_empty_table HAVING COUNT > 0

      should be a single row with the value 1. However impala returns a 1 for each row in the table.

      The explain plan shows the aggregate and predicate are not considered.

      [localhost:21000] > explain select 1 from tinytable having count(*) > 0;
      Query: explain select 1 from tinytable having count(*) > 0
      +----------------------------------------------------------+
      | Explain String                                           |
      +----------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=32.00MB VCores=1 |
      |                                                          |
      | 01:EXCHANGE [PARTITION=UNPARTITIONED]                    |
      | |                                                        |
      | 00:SCAN HDFS [functional.tinytable]                      |
      |    partitions=1/1 size=76B                               |
      +----------------------------------------------------------+
      Returned 6 row(s) in 0.02s
      
      
      mysql> select 1 from table_1 having count(*) > 0;
      +---+
      | 1 |
      +---+
      | 1 |
      +---+
      1 row in set (0.00 sec)
      
      
      randomness=# select 1 from table_1 having count(*) > 0;
       ?column? 
      ----------
              1
      (1 row)
      

      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: