Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Impala 1.2.3
-
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