mirror of
https://github.com/apache/impala.git
synced 2026-01-07 00:02:28 -05:00
IMPALA-5191: Standardize column alias behavior
We should not perform alias substitution in the subexpressions of GROUP BY, HAVING, and ORDER BY to be more standard conformant. === Allowed === SELECT int_col / 2 AS x FROM functional.alltypes GROUP BY x; SELECT int_col / 2 AS x FROM functional.alltypes ORDER BY x; SELECT NOT bool_col AS nb FROM functional.alltypes GROUP BY nb HAVING nb; === Not allowed === SELECT int_col / 2 AS x FROM functional.alltypes GROUP BY x / 2; SELECT int_col / 2 AS x FROM functional.alltypes ORDER BY -x; SELECT int_col / 2 AS x FROM functional.alltypes GROUP BY x HAVING x > 3; Some extra checks were added to AnalyzeExprsTest.java. I had to update other tests to make them pass since the new behavior is more restrictive. I added alias.test to the end-to-end tests. Cherry-picks: not for 2.x. Change-Id: I0f82483b486acf6953876cfa672b0d034f3709a8 Reviewed-on: http://gerrit.cloudera.org:8080/8801 Reviewed-by: Alex Behm <alex.behm@cloudera.com> Tested-by: Impala Public Jenkins
This commit is contained in:
committed by
Impala Public Jenkins
parent
92fd7e56eb
commit
545e60f832
@@ -295,7 +295,7 @@ DECIMAL,DECIMAL,DECIMAL
|
||||
# Test AVG() with DECIMAL_V1
|
||||
set decimal_v2=false;
|
||||
select avg(l_extendedprice) as a from tpch_parquet.lineitem
|
||||
group by l_tax having a > 38247.190 order by 1;
|
||||
group by l_tax having avg(l_extendedprice) > 38247.190 order by 1;
|
||||
---- RESULTS
|
||||
38250.48
|
||||
38251.62
|
||||
@@ -309,7 +309,7 @@ DECIMAL
|
||||
# Test AVG() with DECIMAL_V2
|
||||
set decimal_v2=true;
|
||||
select avg(l_extendedprice) as a from tpch_parquet.lineitem
|
||||
group by l_tax having a > 38247.190 order by 1;
|
||||
group by l_tax having avg(l_extendedprice) > 38247.190 order by 1;
|
||||
---- RESULTS
|
||||
38247.196745
|
||||
38250.487309
|
||||
|
||||
Reference in New Issue
Block a user