From 8531eaab9989ae17c84d20c6f791841c15c0dc5d Mon Sep 17 00:00:00 2001 From: Venkatesh Raghavan Date: Mon, 17 Apr 2017 13:56:55 -0700 Subject: [PATCH] Fix bfv_query_execution to avoid explain_format by atmsort --- .../regress/expected/qp_query_execution.out | 163 +++++------------- src/test/regress/sql/qp_query_execution.sql | 90 +++++----- 2 files changed, 86 insertions(+), 167 deletions(-) diff --git a/src/test/regress/expected/qp_query_execution.out b/src/test/regress/expected/qp_query_execution.out index 73453bfede..4f876d2423 100644 --- a/src/test/regress/expected/qp_query_execution.out +++ b/src/test/regress/expected/qp_query_execution.out @@ -5,9 +5,9 @@ create schema qp_query_execution; set search_path to qp_query_execution; -- count number of certain operators in a given plan create language plpythonu; -create or replace function qx_count_operator(explain_query text, planner_operator text, optimizer_operator text) returns int as +create or replace function qx_count_operator(query text, planner_operator text, optimizer_operator text) returns int as $$ -rv = plpy.execute(explain_query) +rv = plpy.execute('EXPLAIN '+ query) plan = '\n'.join([row['QUERY PLAN'] for row in rv]) optimizer = plan.find('PQO') @@ -175,7 +175,7 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from generate_series(1, 10000) i; analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -196,7 +196,7 @@ select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -343,7 +343,7 @@ insert into b select i % 7 || 'SOME NUMBER', i%6 || 'SN' , i % 9 || 'SOME NUMBER insert into b select i % 7 || 'SOME NUMBER', i%6 || 'SN' , i % 9 || 'SOME NUMBER', i % 9, i % 4 from generate_series(1, 1000)i; analyze abbp; analyze b; -select qx_count_operator('explain select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -364,7 +364,7 @@ select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t 186SN SN | 186 (10 rows) -select qx_count_operator('explain select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = E''6SOME NUMBER''', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = E''6SOME NUMBER''', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -444,7 +444,7 @@ insert into b select i%7, i%10, i , i || 'SOME NUMBER', i % 4 from generate_seri insert into b select i%7, i%10, i , i || 'SOME NUMBER', i % 4 from generate_series(1, 1000) i; analyze abbp; analyze b; -select qx_count_operator('explain select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -465,7 +465,7 @@ select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t i 36 | 36SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -498,7 +498,7 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from generate_series(1, 10000) i; analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -519,7 +519,7 @@ select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where 6.00 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -559,7 +559,7 @@ insert into b select i % 7 || 'SOME NUMBER', i%6, i % 9 || 'SOME NUMBER', i % 9, insert into b select i % 7 || 'SOME NUMBER', i%6, i % 9 || 'SOME NUMBER', i % 9, i % 4 from generate_series(1, 1000)i; analyze abbp; analyze b; -select qx_count_operator('explain select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -580,7 +580,7 @@ select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t 186SN SN | 186 (10 rows) -select qx_count_operator('explain select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = E''6SOME NUMBER''', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = E''6SOME NUMBER''', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -627,7 +627,7 @@ insert into bar_p select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gen insert into bar_p select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from generate_series(1, 10000) i; analyze foo_p; analyze bar_p; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p left outer join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p left outer join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -648,7 +648,7 @@ select foo_p.k, foo_p.t from foo_p left outer join bar_p on foo_p.k = bar_p.k w 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -669,7 +669,7 @@ select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k w 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -680,7 +680,7 @@ select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k an ---+--- (0 rows) -select qx_count_operator('explain select bar_p.a, foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select bar_p.a, foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -701,7 +701,7 @@ select bar_p.a, foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = b 0 | 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -722,7 +722,7 @@ select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k a 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -733,7 +733,7 @@ select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k a ---+--- (0 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -745,7 +745,7 @@ select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k a 6 | 6SOME NUMBER SOME NUMBER (1 row) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -785,7 +785,7 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from generate_series(1, 10000) i; analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1];', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1];', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -807,7 +807,7 @@ select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where (10 rows) create function mytest(integer) returns integer as 'select $1/100' language sql; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100);', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100);', 'Hash Left Join', 'Hash Left Join'); qx_count_operator ------------------- 1 @@ -849,7 +849,7 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from generate_series(1, 10000) i; analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -870,7 +870,7 @@ select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_ 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -918,7 +918,7 @@ ERROR: column "b" is of type integer but expression is of type text HINT: You will need to rewrite or cast the expression. analyze a_p; analyze b; -select qx_count_operator('explain select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -929,7 +929,7 @@ select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not nul ---+--- (0 rows) -select qx_count_operator('explain select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = E''6SOME NUMBER''', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = E''6SOME NUMBER''', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -969,7 +969,7 @@ insert into b select i%7, i%10, i , i || 'SOME NUMBER', i % 4 from generate_seri insert into b select i%7, i%10, i , i || 'SOME NUMBER', i % 4 from generate_series(1, 1000) i; analyze a_p; analyze b; -select qx_count_operator('explain select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -990,7 +990,7 @@ select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null 36 | 36SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = 6;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1024,7 +1024,7 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from generate_series(1, 10000) i; analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1045,7 +1045,7 @@ select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_ 6.00 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1085,7 +1085,7 @@ insert into b select i % 7 || 'SOME NUMBER', i%6, i % 9 || 'SOME NUMBER', i % 9, insert into b select i % 7 || 'SOME NUMBER', i%6, i % 9 || 'SOME NUMBER', i % 9, i % 4 from generate_series(1, 1000)i; analyze a_p; analyze b; -select qx_count_operator('explain select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1096,7 +1096,7 @@ select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not nul ---+--- (0 rows) -select qx_count_operator('explain select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = E''6SOME NUMBER''', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = E''6SOME NUMBER''', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1142,7 +1142,7 @@ insert into bar_p select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gen insert into bar_p select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from generate_series(1, 10000) i; analyze foo_p; analyze bar_p; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p inner join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p inner join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1163,7 +1163,7 @@ select foo_p.k, foo_p.t from foo_p inner join bar_p on foo_p.k = bar_p.k where 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1184,7 +1184,7 @@ select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k where 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1195,7 +1195,7 @@ select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo ---+--- (0 rows) -select qx_count_operator('explain select bar_p.a, foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select bar_p.a, foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1216,7 +1216,7 @@ select bar_p.a, foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p. 0 | 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1237,7 +1237,7 @@ select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and fo 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1248,7 +1248,7 @@ select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and fo ---+--- (0 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6;', 'Hash Join', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1259,7 +1259,7 @@ select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and fo ---+--- (0 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1280,7 +1280,7 @@ select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where 6 | 6SOME NUMBER SOME NUMBER (10 rows) -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1320,7 +1320,7 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from generate_series(1, 10000) i; analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1];', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1];', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1342,7 +1342,7 @@ select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_ (10 rows) create function mytest(integer) returns integer as 'select $1/100' language sql; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100);', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100);', 'Nested Loop', 'Hash Join'); qx_count_operator ------------------- 1 @@ -1364,80 +1364,3 @@ select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_ (10 rows) drop function if exists mytest(integer); --- start_ignore -drop schema qp_query_execution cascade; -NOTICE: drop cascades to table bar -NOTICE: drop cascades to table foo_p_1_prt_6 -NOTICE: drop cascades to constraint foo_p_1_prt_6_check on table foo_p_1_prt_6 -NOTICE: drop cascades to table foo_p_1_prt_5 -NOTICE: drop cascades to constraint foo_p_1_prt_5_check on table foo_p_1_prt_5 -NOTICE: drop cascades to table foo_p_1_prt_4 -NOTICE: drop cascades to constraint foo_p_1_prt_4_check on table foo_p_1_prt_4 -NOTICE: drop cascades to table foo_p_1_prt_3 -NOTICE: drop cascades to constraint foo_p_1_prt_3_check on table foo_p_1_prt_3 -NOTICE: drop cascades to table foo_p_1_prt_2 -NOTICE: drop cascades to constraint foo_p_1_prt_2_check on table foo_p_1_prt_2 -NOTICE: drop cascades to table foo_p_1_prt_other -NOTICE: drop cascades to table foo_p -NOTICE: drop cascades to table bar_p_1_prt_6 -NOTICE: drop cascades to constraint bar_p_1_prt_6_check on table bar_p_1_prt_6 -NOTICE: drop cascades to table bar_p_1_prt_5 -NOTICE: drop cascades to constraint bar_p_1_prt_5_check on table bar_p_1_prt_5 -NOTICE: drop cascades to table bar_p_1_prt_4 -NOTICE: drop cascades to constraint bar_p_1_prt_4_check on table bar_p_1_prt_4 -NOTICE: drop cascades to table bar_p_1_prt_3 -NOTICE: drop cascades to constraint bar_p_1_prt_3_check on table bar_p_1_prt_3 -NOTICE: drop cascades to table bar_p_1_prt_2 -NOTICE: drop cascades to constraint bar_p_1_prt_2_check on table bar_p_1_prt_2 -NOTICE: drop cascades to table bar_p_1_prt_other -NOTICE: drop cascades to table bar_p -NOTICE: drop cascades to table b -NOTICE: drop cascades to table a_p_1_prt_6 -NOTICE: drop cascades to constraint a_p_1_prt_6_check on table a_p_1_prt_6 -NOTICE: drop cascades to table a_p_1_prt_5 -NOTICE: drop cascades to constraint a_p_1_prt_5_check on table a_p_1_prt_5 -NOTICE: drop cascades to table a_p_1_prt_4 -NOTICE: drop cascades to constraint a_p_1_prt_4_check on table a_p_1_prt_4 -NOTICE: drop cascades to table a_p_1_prt_3 -NOTICE: drop cascades to constraint a_p_1_prt_3_check on table a_p_1_prt_3 -NOTICE: drop cascades to table a_p_1_prt_2 -NOTICE: drop cascades to constraint a_p_1_prt_2_check on table a_p_1_prt_2 -NOTICE: drop cascades to table a_p_1_prt_other -NOTICE: drop cascades to table a_p -NOTICE: drop cascades to table abbp_1_prt_6 -NOTICE: drop cascades to constraint abbp_1_prt_6_check on table abbp_1_prt_6 -NOTICE: drop cascades to table abbp_1_prt_5 -NOTICE: drop cascades to constraint abbp_1_prt_5_check on table abbp_1_prt_5 -NOTICE: drop cascades to table abbp_1_prt_4 -NOTICE: drop cascades to constraint abbp_1_prt_4_check on table abbp_1_prt_4 -NOTICE: drop cascades to table abbp_1_prt_3 -NOTICE: drop cascades to constraint abbp_1_prt_3_check on table abbp_1_prt_3 -NOTICE: drop cascades to table abbp_1_prt_2 -NOTICE: drop cascades to constraint abbp_1_prt_2_check on table abbp_1_prt_2 -NOTICE: drop cascades to table abbp_1_prt_other -NOTICE: drop cascades to table abbp -NOTICE: drop cascades to table address_he_unique -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_10 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_10_check on append only columnar table lossmithe_colstor_1_prt_10 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_9 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_9_check on append only columnar table lossmithe_colstor_1_prt_9 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_8 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_8_check on append only columnar table lossmithe_colstor_1_prt_8 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_7 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_7_check on append only columnar table lossmithe_colstor_1_prt_7 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_6 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_6_check on append only columnar table lossmithe_colstor_1_prt_6 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_5 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_5_check on append only columnar table lossmithe_colstor_1_prt_5 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_4 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_4_check on append only columnar table lossmithe_colstor_1_prt_4 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_3 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_3_check on append only columnar table lossmithe_colstor_1_prt_3 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_2 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_2_check on append only columnar table lossmithe_colstor_1_prt_2 -NOTICE: drop cascades to append only columnar table lossmithe_colstor_1_prt_1 -NOTICE: drop cascades to constraint lossmithe_colstor_1_prt_1_check on append only columnar table lossmithe_colstor_1_prt_1 -NOTICE: drop cascades to append only columnar table lossmithe_colstor -NOTICE: drop cascades to table bugtest -NOTICE: drop cascades to function qx_count_operator(text,text,text) --- end_ignore diff --git a/src/test/regress/sql/qp_query_execution.sql b/src/test/regress/sql/qp_query_execution.sql index 9288b4c96c..0463b5dbf6 100644 --- a/src/test/regress/sql/qp_query_execution.sql +++ b/src/test/regress/sql/qp_query_execution.sql @@ -5,9 +5,9 @@ set search_path to qp_query_execution; -- count number of certain operators in a given plan create language plpythonu; -create or replace function qx_count_operator(explain_query text, planner_operator text, optimizer_operator text) returns int as +create or replace function qx_count_operator(query text, planner_operator text, optimizer_operator text) returns int as $$ -rv = plpy.execute(explain_query) +rv = plpy.execute('EXPLAIN '+ query) plan = '\n'.join([row['QUERY PLAN'] for row in rv]) optimizer = plan.find('PQO') @@ -155,10 +155,10 @@ analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6 order by 1, 2 desc limit 10; -- Use all distribution keys in the select list @@ -208,10 +208,10 @@ insert into b select i % 7 || 'SOME NUMBER', i%6 || 'SN' , i % 9 || 'SOME NUMBER analyze abbp; analyze b; -select qx_count_operator('explain select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = E''6SOME NUMBER''', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = E''6SOME NUMBER''', 'Hash Left Join', 'Hash Left Join'); select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = '6SOME NUMBER' order by 1, 2 desc limit 10; -- Varchar in the select list with a broadcast on top of an append with flow node @@ -249,10 +249,10 @@ insert into b select i%7, i%10, i , i || 'SOME NUMBER', i % 4 from generate_seri analyze abbp; analyze b; -select qx_count_operator('explain select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = 6;', 'Hash Left Join', 'Hash Left Join'); select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = 6 order by 1, 2 asc limit 10; -- Partitioned tables with decimal type distribution keys @@ -273,10 +273,10 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); select foo_p.k, foo_p.t from foo_p left outer join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00;', 'Hash Left Join', 'Hash Left Join'); select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00 order by 1, 2 desc limit 10; -- Partitioned tables with character type distribution keys used in predicates @@ -297,10 +297,10 @@ insert into b select i % 7 || 'SOME NUMBER', i%6, i % 9 || 'SOME NUMBER', i % 9, analyze abbp; analyze b; -select qx_count_operator('explain select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6;', 'Hash Left Join', 'Hash Left Join'); select abbp.k, abbp.t from abbp left outer join b on abbp.k = b.k where abbp.t is not null and abbp.p = 6 order by 1, 2 asc limit 10; -select qx_count_operator('explain select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = E''6SOME NUMBER''', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = E''6SOME NUMBER''', 'Hash Left Join', 'Hash Left Join'); select abbp.b, abbp.t from abbp left outer join b on abbp.a = b.k where abbp.t is not null and abbp.a = '6SOME NUMBER' order by 1, 2 asc limit 10; -- Partitioned tables on both sides of a join @@ -321,28 +321,28 @@ insert into bar_p select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gen analyze foo_p; analyze bar_p; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p left outer join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p left outer join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Left Join', 'Hash Left Join'); select foo_p.k, foo_p.t from foo_p left outer join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6 order by 1, 2 asc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14 order by 1, 2 desc limit 10; -select qx_count_operator('explain select bar_p.a, foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select bar_p.a, foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); select bar_p.a, foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 order by 1, 2, 3 asc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4 order by 1, 2 asc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Hash Join', 'Hash Join'); select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4 order by 1, 2 asc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Hash Left Join', 'Hash Left Join'); select foo_p.b, foo_p.t from foo_p left outer join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6 order by 1, 2 asc limit 10; -- Queries where equality predicate is not an immediate constant @@ -362,11 +362,11 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1];', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1];', 'Hash Left Join', 'Hash Left Join'); select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1] order by 1, 2 desc limit 10; create function mytest(integer) returns integer as 'select $1/100' language sql; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100);', 'Hash Left Join', 'Hash Left Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100);', 'Hash Left Join', 'Hash Left Join'); select foo_p.b, foo_p.t from foo_p left outer join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100) order by 1, 2 asc limit 10; drop function if exists mytest(integer); @@ -392,10 +392,10 @@ analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6 order by 1, 2 desc limit 10; -- Varchar in the select list with redistribute on top of an append with flow node @@ -415,10 +415,10 @@ insert into b select i % 7 || 'SOME NUMBER', i%6 || 'SN' , i % 9 || 'SOME NUMBER analyze a_p; analyze b; -select qx_count_operator('explain select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = E''6SOME NUMBER''', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = E''6SOME NUMBER''', 'Nested Loop', 'Hash Join'); select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = '6SOME NUMBER' order by 1, 2 desc limit 10; -- Queries without motion node on the partitioned table @@ -439,10 +439,10 @@ insert into b select i%7, i%10, i , i || 'SOME NUMBER', i % 4 from generate_seri analyze a_p; analyze b; -select qx_count_operator('explain select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = 6;', 'Nested Loop', 'Hash Join'); select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = 6 order by 1, 2 desc limit 10; -- Partitioned tables with decimal type distribution keys @@ -463,10 +463,10 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); select foo_p.k, foo_p.t from foo_p inner join bar on foo_p.k = bar.k where foo_p.t is not null and foo_p.p = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = 6.00 order by 1, 2 desc limit 10; -- Partitioned tables with character type distribution keys used in predicates @@ -487,10 +487,10 @@ insert into b select i % 7 || 'SOME NUMBER', i%6, i % 9 || 'SOME NUMBER', i % 9, analyze a_p; analyze b; -select qx_count_operator('explain select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6;', 'Hash Join', 'Hash Join'); select a_p.k, a_p.t from a_p inner join b on a_p.k = b.k where a_p.t is not null and a_p.p = 6 order by 1, 2 asc limit 10; -select qx_count_operator('explain select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = E''6SOME NUMBER''', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = E''6SOME NUMBER''', 'Nested Loop', 'Hash Join'); select a_p.b, a_p.t from a_p inner join b on a_p.a = b.k where a_p.t is not null and a_p.a = '6SOME NUMBER' order by 1, 2 asc limit 10; -- Partitioned tables on both sides of a join @@ -511,31 +511,31 @@ insert into bar_p select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gen analyze foo_p; analyze bar_p; -select qx_count_operator('explain select foo_p.k, foo_p.t from foo_p inner join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.k, foo_p.t from foo_p inner join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6;', 'Hash Join', 'Hash Join'); select foo_p.k, foo_p.t from foo_p inner join bar_p on foo_p.k = bar_p.k where foo_p.t is not null and foo_p.p = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k where foo_p.t is not null and foo_p.a = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 14 order by 1, 2 asc limit 10; -select qx_count_operator('explain select bar_p.a, foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select bar_p.a, foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); select bar_p.a, foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 order by 1, 2, 3 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.k where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4 order by 1, 2 asc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4;', 'Hash Join', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.k = bar_p.b where foo_p.t is not null and foo_p.a = 6 and bar_p.a = 4 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6;', 'Hash Join', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6;', 'Hash Join', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.k and foo_p.b = bar_p.b where foo_p.t is not null and foo_p.a = 6 order by 1, 2 desc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6 order by 1, 2 asc limit 10; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6;', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar_p on foo_p.a = bar_p.a where foo_p.t is not null and foo_p.a = 6 order by 1, 2 desc limit 10; -- Queries where equality predicate is not an immediate constant @@ -555,15 +555,11 @@ insert into bar select i % 7, i % 6, i % 9, i || 'SOME NUMBER', i % 4 from gener analyze foo_p; analyze bar; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1];', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1];', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = (array[1])[1] order by 1, 2 asc limit 10; create function mytest(integer) returns integer as 'select $1/100' language sql; -select qx_count_operator('explain select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100);', 'Nested Loop', 'Hash Join'); +select qx_count_operator('select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100);', 'Nested Loop', 'Hash Join'); select foo_p.b, foo_p.t from foo_p inner join bar on foo_p.a = bar.k where foo_p.t is not null and foo_p.a = mytest(100) order by 1, 2 desc limit 10; drop function if exists mytest(integer); - --- start_ignore -drop schema qp_query_execution cascade; --- end_ignore -- GitLab