==== ---- QUERY # Test a union inside a subplan with some constant operands. select c_custkey, o_orderkey from tpch_nested_parquet.customer c, (select o_orderkey from c.c_orders union all values(100), (200), (300)) v where c_custkey in (1, 2, 3) ---- TYPES BIGINT, BIGINT ---- RESULTS: VERIFY_IS_EQUAL_SORTED 1,100 1,200 1,300 1,454791 1,579908 1,3868359 1,4273923 1,4808192 1,5133509 2,100 2,200 2,300 2,430243 2,1071617 2,1374019 2,1763205 2,1842406 2,2992930 2,3986496 3,100 3,200 3,300 ==== ---- QUERY # Test an order by + limit (topn node) inside a subplan. select c_custkey, o_orderkey from tpch_nested_parquet.customer c, (select o_orderkey from c.c_orders order by o_orderkey desc limit 2) v where c_custkey in (1, 2, 3) ---- TYPES BIGINT, BIGINT ---- RESULTS: VERIFY_IS_EQUAL_SORTED 1,5133509 1,4808192 2,3986496 2,2992930 ==== ---- QUERY # Test a select node inside a subplan. select c_custkey, o_orderkey from tpch_nested_parquet.customer c, (select o_orderkey from c.c_orders order by o_orderkey desc limit 2) v where c_custkey in (1, 2, 3) and o_orderkey % 2 = 0 ---- TYPES BIGINT, BIGINT ---- RESULTS: VERIFY_IS_EQUAL_SORTED 1,4808192 2,3986496 2,2992930 ==== ---- QUERY # Test an analytic function that requires a sort inside a subplan. select c_custkey, o_orderstatus, o_orderdate, o_orderkey, r from tpch_nested_parquet.customer c, (select o_orderstatus, o_orderdate, o_orderkey, row_number() over (partition by o_orderstatus order by o_orderdate) r from c.c_orders) v where c_custkey in (1, 2, 3) ---- TYPES BIGINT, STRING, BIGINT, BIGINT ---- RESULTS: VERIFY_IS_EQUAL_SORTED 1,F,1992-04-19,454791,1 1,F,1992-08-22,3868359,2 1,O,1996-06-29,4808192,1 1,O,1996-07-01,5133509,2 1,O,1996-12-09,579908,3 1,O,1997-03-23,4273923,4 2,F,1992-04-05,1374019,1 2,F,1994-05-21,2992930,2 2,F,1994-08-28,1763205,3 2,F,1994-12-24,430243,4 2,O,1996-08-05,1842406,1 2,O,1997-02-22,3986496,2 2,P,1995-03-10,1071617,1 ==== ---- QUERY # Test an analytic function that does not require a sort inside a subplan. select c_custkey, mp from tpch_nested_parquet.customer c, (select max(o_totalprice) over () mp from c.c_orders) v where c_custkey in (1, 2, 3) ---- TYPES BIGINT, DECIMAL ---- RESULTS: VERIFY_IS_EQUAL_SORTED 1,174645.94 1,174645.94 1,174645.94 1,174645.94 1,174645.94 1,174645.94 2,312692.22 2,312692.22 2,312692.22 2,312692.22 2,312692.22 2,312692.22 2,312692.22 ==== ---- QUERY # Test a non-grouping aggregation inside a subplan. select c_custkey, cnt, avp from tpch_nested_parquet.customer c, (select count(o_orderkey) cnt, avg(o_totalprice) avp from c.c_orders) v where c_custkey < 3 ---- TYPES BIGINT, BIGINT, DECIMAL ---- RESULTS: VERIFY_IS_EQUAL_SORTED 1,6,97960.48 2,7,146896.20 ==== ---- QUERY SELECT c_custkey, avg(maxp) FROM tpch_nested_parquet.customer c, (SELECT MAX(o_totalprice) maxp FROM c.c_orders GROUP BY o_orderpriority) v WHERE c_custkey < 3 GROUP BY c_custkey ---- TYPES BIGINT, DECIMAL ---- RESULTS: VERIFY_IS_EQUAL_SORTED 1,114777.96 2,212462.41 ==== ---- QUERY # Test a grouping aggregation inside a subplan. select c_custkey, o_orderpriority, cnt, avp from tpch_nested_parquet.customer c, (select count(o_orderkey) cnt, avg(o_totalprice) avp, o_orderpriority from c.c_orders group by o_orderpriority) v where c_custkey < 3 ---- TYPES BIGINT, STRING, BIGINT, DECIMAL ---- RESULTS: VERIFY_IS_EQUAL_SORTED 1,1-URGENT,2,124624.37 1,2-HIGH,1,65478.05 1,3-MEDIUM,1,95911.01 1,5-LOW,2,88562.55 2,1-URGENT,4,167623.89 2,2-HIGH,1,221397.35 2,4-NOT SPECIFIED,2,68190.25 ==== ---- QUERY # Test a join inside a subplan. SELECT count(okey), opriority FROM tpch_nested_parquet.customer c, (SELECT ca.o_orderkey okey, ca.o_orderpriority opriority FROM c.c_orders ca, c.c_orders cb WHERE ca.o_orderkey = cb.o_orderkey AND ca.o_totalprice + cb.o_totalprice < 2) v GROUP BY opriority ---- TYPES BIGINT, STRING ---- RESULTS: VERIFY_IS_EQUAL_SORTED ==== ---- QUERY # Test a self-join inside a subplan. SELECT count(okey), opriority FROM tpch_nested_parquet.customer c, (SELECT ca.o_orderkey okey, ca.o_orderpriority opriority FROM c.c_orders ca, c.c_orders cb WHERE ca.o_orderkey = cb.o_orderkey) v GROUP BY opriority ---- TYPES BIGINT, STRING ---- RESULTS: VERIFY_IS_EQUAL_SORTED 300091,2-HIGH 300254,4-NOT SPECIFIED 300589,5-LOW 300343,1-URGENT 298723,3-MEDIUM ==== ---- QUERY # Test a left outer join inside a subplan. SELECT count(okey), opriority FROM tpch_nested_parquet.customer c, (SELECT ca.o_orderkey okey, ca.o_orderpriority opriority FROM c.c_orders ca LEFT OUTER JOIN c.c_orders cb ON ca.o_orderkey = cb.o_orderkey) v GROUP BY opriority ---- TYPES BIGINT, STRING ---- RESULTS: VERIFY_IS_EQUAL_SORTED 300091,2-HIGH 300254,4-NOT SPECIFIED 300589,5-LOW 300343,1-URGENT 298723,3-MEDIUM ==== ---- QUERY # Test a right outer join inside a subplan. SELECT count(okey), opriority FROM tpch_nested_parquet.customer c, (SELECT ca.o_orderkey okey, ca.o_orderpriority opriority FROM c.c_orders ca RIGHT OUTER JOIN c.c_orders cb ON ca.o_orderkey = cb.o_orderkey WHERE ca.o_totalprice + cb.o_totalprice < 2 AND cb.o_orderpriority = '5-LOW') v GROUP BY opriority ---- TYPES BIGINT, STRING ---- RESULTS: VERIFY_IS_EQUAL_SORTED ==== ---- QUERY # IMPALA-2368: Test nested subplans with a non-trivial plan tree. SELECT count(*) FROM tpch_nested_parquet.customer c INNER JOIN c.c_orders o WHERE c_custkey < 10 AND o.pos IN (SELECT LEAD(l.l_linenumber) OVER (ORDER BY l.pos) FROM o.o_lineitems l) ---- TYPES BIGINT ---- RESULTS 14 ====