IMPALA-4739: ExprRewriter fails on HAVING clauses

The bug was that expr rewrite rules such as ExtractCommonConjunctRule
analyzed their own output, which doesn't work for syntactic elements
that allow column aliases, such as the HAVING clause.
The fix was to remove the analysis step (the re-analysis happens anyway
in AnalysisCtx).

Change-Id: Ife74c61f549f620c42f74928f6474e8a5a7b7f00
Reviewed-on: http://gerrit.cloudera.org:8080/5662
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: Impala Public Jenkins
This commit is contained in:
Marcel Kornacker
2017-01-09 18:13:59 -08:00
committed by Impala Public Jenkins
parent 6a2c9049ff
commit 70ae2e38eb
7 changed files with 28 additions and 10 deletions

View File

@@ -2547,7 +2547,7 @@ order by c, cast('2016-11-22 16:40:00.00' as timestamp)
BIGINT, TIMESTAMP, TIMESTAMP
====
---- QUERY
# Constant timestamp expresisons in a join condition / runtime filter as well
# Constant timestamp expressions in a join condition / runtime filter as well
# as a select node.
select count(*) from (
select a.timestamp_col from
@@ -2564,6 +2564,18 @@ where timestamp_col < cast('2013-02-18 20:46:00.01' as timestamp)
BIGINT
====
---- QUERY
# IMPALA-4739: rewrites in HAVING clause
select tinyint_col, count(*) cnt
from functional_parquet.alltypesagg
group by 1
having cnt > 1000 or cnt > 1000
and cnt between 1500 and 2500
---- TYPES
TINYINT, BIGINT
---- RESULTS
NULL,2000
====
---- QUERY
# IMPALA-4550: Regression test for proper cast analysis after slot substitution within a
# no-op explicit cast.
select /* +straight_join */ a.id