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

Missed pushdown opportunity when HAVING predicates refer to non-aggregates

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 1.2.3
    • Impala 1.2.4
    • None
    • None

    Description

      If a HAVING predicate refers only to a column in the grouped table (rather than an aggregate), it can be pushed down past the aggregation:

      [localhost:21000] > explain select bool_col from functional.alltypes group by bool_col having bool_col = false;
      Query: explain select bool_col from functional.alltypes group by bool_col having bool_col = false
      +-----------------------------------------------------------+
      | Explain String                                            |
      +-----------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=170.00MB VCores=2 |
      |                                                           |
      | 04:EXCHANGE [PARTITION=UNPARTITIONED]                     |
      | |                                                         |
      | 03:AGGREGATE [MERGE FINALIZE]                             |
      | |  group by: bool_col                                     |
      | |  having: bool_col = FALSE                               |
      | |                                                         |
      | 02:EXCHANGE [PARTITION=HASH(bool_col)]                    |
      | |                                                         |
      | 01:AGGREGATE                                              |
      | |  group by: bool_col                                     |
      | |                                                         |
      | 00:SCAN HDFS [functional.alltypes]                        |
      |    partitions=24/24 size=478.45KB                         | <-- Predicate could be attached to the scan
      +-----------------------------------------------------------+
      Returned 15 row(s) in 0.04s
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            henryr Henry Robinson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: