IMPALA-5438: Always eval union const exprs in subplan.

The bug was that the constant exprs of a union were only
evaluated for the first fragment instance. However, for
a union inside a subplan, we should always evaluate the
constant exprs.

Testing:
- Added a regression test.
- Locally ran test_nested_types.py and the union tests in
  test_queries.py

Change-Id: Icd2f21f0213188e2304f8e9536019c7940c07768
Reviewed-on: http://gerrit.cloudera.org:8080/7091
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: Impala Public Jenkins
This commit is contained in:
Alex Behm
2017-06-05 16:41:53 -07:00
committed by Impala Public Jenkins
parent fda539a1dc
commit edf9f2ffb6
3 changed files with 18 additions and 3 deletions

View File

@@ -577,7 +577,7 @@ where c_custkey = 1
BIGINT,BIGINT
====
---- QUERY
# IMPALA-3678: union in a subplan - passthrough should be disabled.
# IMPALA-3678: Union in a subplan - passthrough should be disabled.
select count(c.c_custkey), count(v.tot_price)
from tpch_nested_parquet.customer c, (
select sum(o_totalprice) tot_price from c.c_orders
@@ -611,3 +611,18 @@ WHERE ca.o_orderkey < cb.o_orderkey limit 2) v limit 51
---- TYPES
BIGINT
====
---- QUERY
# IMPALA-5438: Union with constant exprs in a subplan. The 'c_custkey % 100' was chosen
# to have all impalads produce results to make sure the constant exprs in the union are
# evaluated regardless of which fragment instance they are in.
select c_custkey, order_cnt, union_cnt from tpch_nested_parquet.customer c,
(select count(o_orderkey) order_cnt from c.c_orders) v,
(select count(o_orderkey) union_cnt from (
select o_orderkey from c.c_orders
union all
values(11),(22),(33)) v) v2
where c_custkey % 100 = 0 and order_cnt != union_cnt - 3;
---- RESULTS
---- TYPES
bigint,bigint,bigint
====