diff --git a/testdata/workloads/functional-query/queries/QueryTest/nested-types-subplan.test b/testdata/workloads/functional-query/queries/QueryTest/nested-types-subplan.test index 45116e62b..e18f25e6d 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/nested-types-subplan.test +++ b/testdata/workloads/functional-query/queries/QueryTest/nested-types-subplan.test @@ -253,6 +253,23 @@ where c_custkey < 4 bigint,string,bigint,decimal,decimal,string,string ==== ---- 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 left outer join of a relative table ref. select c_custkey, c_mktsegment, o_orderkey, o_orderdate from customer c left outer join c.c_orders @@ -300,6 +317,20 @@ where c_custkey < 4 bigint,string,bigint,string ==== ---- 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: +==== +---- QUERY # Test left semi join of a relative table ref. select c_custkey, c_mktsegment from customer c left semi join c.c_orders @@ -574,7 +605,7 @@ where c_custkey = 1 1,4808192 1,5133509 ---- TYPES -BIGINT,BIGINT +bigint, bigint ==== ---- QUERY # IMPALA-3678: Union in a subplan - passthrough should be disabled. @@ -598,7 +629,7 @@ WHERE ca.o_orderkey = cb.o_orderkey limit 2) v limit 51 ---- RESULTS 1500000 ---- TYPES -BIGINT +bigint ==== ---- QUERY # IMPALA-5363: Reset probe_batch_ after reaching limit. @@ -609,7 +640,7 @@ WHERE ca.o_orderkey < cb.o_orderkey limit 2) v limit 51 ---- RESULTS 199835 ---- TYPES -BIGINT +bigint ==== ---- QUERY # IMPALA-5438: Union with constant exprs in a subplan. The 'c_custkey % 100' was chosen diff --git a/testdata/workloads/functional-query/queries/QueryTest/subplans.test b/testdata/workloads/functional-query/queries/QueryTest/subplans.test deleted file mode 100644 index 1cf904758..000000000 --- a/testdata/workloads/functional-query/queries/QueryTest/subplans.test +++ /dev/null @@ -1,230 +0,0 @@ -==== ----- 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 -==== diff --git a/tests/query_test/test_queries.py b/tests/query_test/test_queries.py index 109933095..40ca7f35d 100644 --- a/tests/query_test/test_queries.py +++ b/tests/query_test/test_queries.py @@ -109,12 +109,6 @@ class TestQueries(ImpalaTestSuite): def test_subquery(self, vector): self.run_test_case('QueryTest/subquery', vector) - def test_subplans(self, vector): - pytest.xfail("Disabled due to missing nested types functionality.") - if vector.get_value('table_format').file_format != 'parquet': - pytest.xfail("Nested TPCH only available in parquet.") - self.run_test_case('QueryTest/subplannull_data', vector) - def test_empty(self, vector): self.run_test_case('QueryTest/empty', vector)