diff --git a/src/test/regress/expected/transient_types.out b/src/test/regress/expected/transient_types.out new file mode 100644 index 0000000000000000000000000000000000000000..18e4fd95fbd1f5d915f972fa4df7bffd00ecc110 --- /dev/null +++ b/src/test/regress/expected/transient_types.out @@ -0,0 +1,300 @@ +create schema transient_types; +set search_path='transient_types'; +-- prepare a distributed table +create table t as select i as id from generate_series(1,8) i; +-- test row +select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; + row | row | row +-----+-------+--------------- + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) +(8 rows) + +-- test function +create or replace function foo(in int, out int, out int) as +$$ +select $1, $1; +$$ language sql; +select row(id, 1), foo(id) from t; + row | foo +-------+------- + (1,1) | (1,1) + (2,1) | (2,2) + (3,1) | (3,3) + (4,1) | (4,4) + (5,1) | (5,5) + (6,1) | (6,6) + (7,1) | (7,7) + (8,1) | (8,8) +(8 rows) + +-- cleanup +drop table t; +drop function foo(int); +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; +-- create type +drop type if exists myudt; +create type myudt as (i int, c char); +-- test row +select row((1,'a')::myudt), row((2,'b')::myudt, 2) from t; + row | row +-----------+------------- + ("(1,a)") | ("(2,b)",2) + ("(1,a)") | ("(2,b)",2) + ("(1,a)") | ("(2,b)",2) + ("(1,a)") | ("(2,b)",2) + ("(1,a)") | ("(2,b)",2) + ("(1,a)") | ("(2,b)",2) + ("(1,a)") | ("(2,b)",2) + ("(1,a)") | ("(2,b)",2) +(8 rows) + +-- test function +create or replace function foo(in int, out int, out myudt) as +$$ +select $1, ($1, 't')::myudt; +$$ language sql; +select row(id, 1), foo(id) from t; + row | foo +-------+------------- + (1,1) | (1,"(1,t)") + (2,1) | (2,"(2,t)") + (3,1) | (3,"(3,t)") + (4,1) | (4,"(4,t)") + (5,1) | (5,"(5,t)") + (6,1) | (6,"(6,t)") + (7,1) | (7,"(7,t)") + (8,1) | (8,"(8,t)") +(8 rows) + +--cleanup +drop function foo(int); +drop type myudt; +drop table t; +-- Test when old QE got released, all types will be dispatched to new QE. +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; +-- set QE release timeout 10ms +set gp_vmem_idle_resource_timeout=10; +-- query 1 +select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; + row | row | row +-----+-------+--------------- + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) +(8 rows) + +-- sleep 1000ms +select pg_sleep(1); + pg_sleep +---------- + +(1 row) + +-- query 2 +select row(1, 2, 3, 4, 5, 6), row(), row(1, 2, 3, 4, 5), row(1, 2), row(1, 2, 3, 4), row(1, 'a', 'abc', 1.5) from t; + row | row | row | row | row | row +---------------+-----+-------------+-------+-----------+--------------- + (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) + (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) + (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) + (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) + (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) + (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) + (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) + (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) +(8 rows) + +-- start_ignore +-- end_ignore +-- Utility statement won't need to dispatch transient types. So QE may have transient type which is not mapped to QD. +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; +-- 2 types on QD, but not on QE. +select row(1, row(1,2), 3), row(1, 2, 3, 4); + row | row +---------------+----------- + (1,"(1,2)",3) | (1,2,3,4) +(1 row) + +-- 1 another type on both QD and QE, but not mapped since it's not dispatched. +create or replace function foo(in int, out int, out int) as +$$ +select $1, $1; +$$ language sql; +-- dispatch 3 types to QE. +select foo(id) from t; + foo +------- + (1,1) + (2,2) + (3,3) + (4,4) + (5,5) + (6,6) + (7,7) + (8,8) +(8 rows) + +--cleanup +drop function foo(int); +drop table t; +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; +-- commit +begin; +select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; + row | row | row +-----+-------+--------------- + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) + () | (1,2) | (1,a,abc,1.5) +(8 rows) + +commit; +-- abort +begin; +select row(), row(1, row(1, 2)), row(1, 2, 3) from t; + row | row | row +-----+-------------+--------- + () | (1,"(1,2)") | (1,2,3) + () | (1,"(1,2)") | (1,2,3) + () | (1,"(1,2)") | (1,2,3) + () | (1,"(1,2)") | (1,2,3) + () | (1,"(1,2)") | (1,2,3) + () | (1,"(1,2)") | (1,2,3) + () | (1,"(1,2)") | (1,2,3) + () | (1,"(1,2)") | (1,2,3) +(8 rows) + +abort; +-- subtrans +begin; +select row(1, 2) from t; + row +------- + (1,2) + (1,2) + (1,2) + (1,2) + (1,2) + (1,2) + (1,2) + (1,2) +(8 rows) + +savepoint s1; +select row(1, 2, 3, 'a'), row(1, 2), row(1, 2, 3); + row | row | row +-----------+-------+--------- + (1,2,3,a) | (1,2) | (1,2,3) +(1 row) + +select row(1, 'b', 3, 'a'), row(1, 2, 3, 4, 5, 6), row(1, 2, 3, 4) from t; + row | row | row +-----------+---------------+----------- + (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) + (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) + (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) + (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) + (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) + (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) + (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) + (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) +(8 rows) + +rollback to savepoint s1; +savepoint s2; +select row(), row(1), row(1, 'a'), row(1, 2, 3); + row | row | row | row +-----+-----+-------+--------- + () | (1) | (1,a) | (1,2,3) +(1 row) + +rollback to savepoint s2; +select row(), row(1), row('a', 'b'), row(1, 2, 3, 4) from t; + row | row | row | row +-----+-----+-------+----------- + () | (1) | (a,b) | (1,2,3,4) + () | (1) | (a,b) | (1,2,3,4) + () | (1) | (a,b) | (1,2,3,4) + () | (1) | (a,b) | (1,2,3,4) + () | (1) | (a,b) | (1,2,3,4) + () | (1) | (a,b) | (1,2,3,4) + () | (1) | (a,b) | (1,2,3,4) + () | (1) | (a,b) | (1,2,3,4) +(8 rows) + +commit; +-- cleanup +drop table t; +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,100000) i; +-- cursor +begin; +declare foo cursor for select row(id, 1),id from t order by id; +savepoint x; +fetch from foo; + row | id +-------+---- + (1,1) | 1 +(1 row) + +rollback to x; +fetch ABSOLUTE 100000 from foo; + row | id +------------+-------- + (100000,1) | 100000 +(1 row) + +abort; +truncate table t; +select row(id, 1) from t; + row +----- +(0 rows) + +-- cleanup +drop table t; +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; +create or replace function foo() returns void as $$ +begin + EXECUTE 'SELECT row(id, 2) from t'; + RETURN; +end +$$ language 'plpgsql'; +select foo(); + foo +----- + +(1 row) + +-- cleanup +drop function foo(); +drop table t; +drop schema transient_types; diff --git a/src/test/regress/greenplum_schedule b/src/test/regress/greenplum_schedule index cf5206bae7a89d18844fd09f81e8b72917e9090b..8927a47793299400024c65b798a5eebc18f49008 100755 --- a/src/test/regress/greenplum_schedule +++ b/src/test/regress/greenplum_schedule @@ -18,7 +18,7 @@ ignore: leastsquares test: opr_sanity_gp decode_expr bitmapscan bitmapscan_ao case_gp limit_gp notin percentile naivebayes join_gp union_gp gpcopy gp_create_table test: filter gpctas gpdist matrix toast sublink table_functions olap_setup complex opclass_ddl bitmap_index information_schema -test: indexjoin as_alias regex_gp gpparams with_clause +test: indexjoin as_alias regex_gp gpparams with_clause transient_types test: dispatch diff --git a/src/test/regress/sql/transient_types.sql b/src/test/regress/sql/transient_types.sql new file mode 100644 index 0000000000000000000000000000000000000000..b97c38635da0decd69fd944425c7a002998e0176 --- /dev/null +++ b/src/test/regress/sql/transient_types.sql @@ -0,0 +1,146 @@ +create schema transient_types; +set search_path='transient_types'; + +-- prepare a distributed table +create table t as select i as id from generate_series(1,8) i; + +-- test row +select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; + +-- test function +create or replace function foo(in int, out int, out int) as +$$ +select $1, $1; +$$ language sql; + +select row(id, 1), foo(id) from t; + +-- cleanup +drop table t; +drop function foo(int); + +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; + +-- create type +drop type if exists myudt; +create type myudt as (i int, c char); + +-- test row +select row((1,'a')::myudt), row((2,'b')::myudt, 2) from t; + +-- test function +create or replace function foo(in int, out int, out myudt) as +$$ +select $1, ($1, 't')::myudt; +$$ language sql; + +select row(id, 1), foo(id) from t; + +--cleanup +drop function foo(int); +drop type myudt; +drop table t; +-- Test when old QE got released, all types will be dispatched to new QE. + +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; + +-- set QE release timeout 10ms +set gp_vmem_idle_resource_timeout=10; + +-- query 1 +select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; +-- sleep 1000ms +select pg_sleep(1); +-- query 2 +select row(1, 2, 3, 4, 5, 6), row(), row(1, 2, 3, 4, 5), row(1, 2), row(1, 2, 3, 4), row(1, 'a', 'abc', 1.5) from t; +-- Utility statement won't need to dispatch transient types. So QE may have transient type which is not mapped to QD. + +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; + +-- 2 types on QD, but not on QE. +select row(1, row(1,2), 3), row(1, 2, 3, 4); + +-- 1 another type on both QD and QE, but not mapped since it's not dispatched. +create or replace function foo(in int, out int, out int) as +$$ +select $1, $1; +$$ language sql; + +-- dispatch 3 types to QE. +select foo(id) from t; + +--cleanup +drop function foo(int); +drop table t; +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; + +-- commit +begin; +select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; +commit; + +-- abort +begin; +select row(), row(1, row(1, 2)), row(1, 2, 3) from t; +abort; + +-- subtrans +begin; +select row(1, 2) from t; +savepoint s1; +select row(1, 2, 3, 'a'), row(1, 2), row(1, 2, 3); +select row(1, 'b', 3, 'a'), row(1, 2, 3, 4, 5, 6), row(1, 2, 3, 4) from t; +rollback to savepoint s1; +savepoint s2; +select row(), row(1), row(1, 'a'), row(1, 2, 3); +rollback to savepoint s2; +select row(), row(1), row('a', 'b'), row(1, 2, 3, 4) from t; +commit; + + +-- cleanup +drop table t; +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,100000) i; + +-- cursor +begin; +declare foo cursor for select row(id, 1),id from t order by id; +savepoint x; +fetch from foo; +rollback to x; +fetch ABSOLUTE 100000 from foo; +abort; + +truncate table t; +select row(id, 1) from t; + +-- cleanup +drop table t; +-- prepare a distributed table +drop table if exists t; +create table t as select i as id from generate_series(1,8) i; + +create or replace function foo() returns void as $$ +begin + EXECUTE 'SELECT row(id, 2) from t'; + RETURN; +end +$$ language 'plpgsql'; + +select foo(); + +-- cleanup +drop function foo(); +drop table t; + +drop schema transient_types; diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/__init__.py b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query01_basic.ans b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query01_basic.ans deleted file mode 100644 index 2675331a59e020b1c3b46c539eeea5b8fb531af7..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query01_basic.ans +++ /dev/null @@ -1,48 +0,0 @@ --- start_ignore --- end_ignore --- prepare a distributed table -drop table if exists t; -psql:/path/sql_file:1: NOTICE: table "t" does not exist, skipping -DROP TABLE -create table t as select i as id from generate_series(1,8) i; -psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'id' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -SELECT 8 --- test row -select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; - row | row | row ------+-------+--------------- - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) -(8 rows) - --- test function -create or replace function foo(in int, out int, out int) as -$$ -select $1, $1; -$$ language sql; -CREATE FUNCTION -select row(id, 1), foo(id) from t; - row | foo --------+------- - (1,1) | (1,1) - (2,1) | (2,2) - (3,1) | (3,3) - (4,1) | (4,4) - (5,1) | (5,5) - (6,1) | (6,6) - (7,1) | (7,7) - (8,1) | (8,8) -(8 rows) - --- cleanup -drop table t; -DROP TABLE -drop function foo(int); -DROP FUNCTION diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query02_udt.ans b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query02_udt.ans deleted file mode 100644 index 69d94f44536b9b68eb9c6d5d262d609464e08230..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query02_udt.ans +++ /dev/null @@ -1,56 +0,0 @@ --- start_ignore --- end_ignore --- prepare a distributed table -drop table if exists t; -psql:/path/sql_file:1: NOTICE: table "t" does not exist, skipping -DROP TABLE -create table t as select i as id from generate_series(1,8) i; -psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'id' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -SELECT 8 --- create type -drop type if exists myudt; -psql:/path/sql_file:1: NOTICE: type "myudt" does not exist, skipping -DROP TYPE -create type myudt as (i int, c char); -CREATE TYPE --- test row -select row((1,'a')::myudt), row((2,'b')::myudt, 2) from t; - row | row ------------+------------- - ("(1,a)") | ("(2,b)",2) - ("(1,a)") | ("(2,b)",2) - ("(1,a)") | ("(2,b)",2) - ("(1,a)") | ("(2,b)",2) - ("(1,a)") | ("(2,b)",2) - ("(1,a)") | ("(2,b)",2) - ("(1,a)") | ("(2,b)",2) - ("(1,a)") | ("(2,b)",2) -(8 rows) - --- test function -create or replace function foo(in int, out int, out myudt) as -$$ -select $1, ($1, 't')::myudt; -$$ language sql; -CREATE FUNCTION -select row(id, 1), foo(id) from t; - row | foo --------+------------- - (1,1) | (1,"(1,t)") - (2,1) | (2,"(2,t)") - (3,1) | (3,"(3,t)") - (4,1) | (4,"(4,t)") - (5,1) | (5,"(5,t)") - (6,1) | (6,"(6,t)") - (7,1) | (7,"(7,t)") - (8,1) | (8,"(8,t)") -(8 rows) - ---cleanup -drop function foo(int); -DROP FUNCTION -drop type myudt; -DROP TYPE -drop table t; -DROP TABLE diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query03_new_qe.ans b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query03_new_qe.ans deleted file mode 100644 index 716880ba39622d56eb2c07a3e05f8f6e1f8f6ff2..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query03_new_qe.ans +++ /dev/null @@ -1,49 +0,0 @@ --- start_ignore --- end_ignore --- Test when old QE got released, all types will be dispatched to new QE. --- prepare a distributed table -drop table if exists t; -psql:/path/sql_file:1: NOTICE: table "t" does not exist, skipping -DROP TABLE -create table t as select i as id from generate_series(1,8) i; -psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'id' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -SELECT 8 --- set QE release timeout 10ms -set gp_vmem_idle_resource_timeout=10; -SET --- query 1 -select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; - row | row | row ------+-------+--------------- - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) -(8 rows) - --- sleep 1000ms -select pg_sleep(1); - pg_sleep ----------- - -(1 row) - --- query 2 -select row(1, 2, 3, 4, 5, 6), row(), row(1, 2, 3, 4, 5), row(1, 2), row(1, 2, 3, 4), row(1, 'a', 'abc', 1.5) from t; - row | row | row | row | row | row ----------------+-----+-------------+-------+-----------+--------------- - (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) - (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) - (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) - (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) - (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) - (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) - (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) - (1,2,3,4,5,6) | () | (1,2,3,4,5) | (1,2) | (1,2,3,4) | (1,a,abc,1.5) -(8 rows) - diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query04_mismatch.ans b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query04_mismatch.ans deleted file mode 100644 index 99f1215d31be408a240f3e87dcfca5f7a87c1caf..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query04_mismatch.ans +++ /dev/null @@ -1,42 +0,0 @@ --- start_ignore --- end_ignore --- Utility statement won't need to dispatch transient types. So QE may have transient type which is not mapped to QD. --- prepare a distributed table -drop table if exists t; -DROP TABLE -create table t as select i as id from generate_series(1,8) i; -psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'id' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -SELECT 8 --- 2 types on QD, but not on QE. -select row(1, row(1,2), 3), row(1, 2, 3, 4); - row | row ----------------+----------- - (1,"(1,2)",3) | (1,2,3,4) -(1 row) - --- 1 another type on both QD and QE, but not mapped since it's not dispatched. -create or replace function foo(in int, out int, out int) as -$$ -select $1, $1; -$$ language sql; -CREATE FUNCTION --- dispatch 3 types to QE. -select foo(id) from t; - foo -------- - (1,1) - (2,2) - (3,3) - (4,4) - (5,5) - (6,6) - (7,7) - (8,8) -(8 rows) - ---cleanup -drop function foo(int); -DROP FUNCTION -drop table t; -DROP TABLE diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query05_trans.ans b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query05_trans.ans deleted file mode 100644 index 4514a3748ede2125ffc668418e368c247fd742a8..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query05_trans.ans +++ /dev/null @@ -1,113 +0,0 @@ --- start_ignore --- end_ignore --- prepare a distributed table -drop table if exists t; -psql:/path/sql_file:1: NOTICE: table "t" does not exist, skipping -DROP TABLE -create table t as select i as id from generate_series(1,8) i; -psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'id' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -SELECT 8 --- commit -begin; -BEGIN -select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; - row | row | row ------+-------+--------------- - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) - () | (1,2) | (1,a,abc,1.5) -(8 rows) - -commit; -COMMIT --- abort -begin; -BEGIN -select row(), row(1, row(1, 2)), row(1, 2, 3) from t; - row | row | row ------+-------------+--------- - () | (1,"(1,2)") | (1,2,3) - () | (1,"(1,2)") | (1,2,3) - () | (1,"(1,2)") | (1,2,3) - () | (1,"(1,2)") | (1,2,3) - () | (1,"(1,2)") | (1,2,3) - () | (1,"(1,2)") | (1,2,3) - () | (1,"(1,2)") | (1,2,3) - () | (1,"(1,2)") | (1,2,3) -(8 rows) - -abort; -ROLLBACK --- subtrans -begin; -BEGIN -select row(1, 2) from t; - row -------- - (1,2) - (1,2) - (1,2) - (1,2) - (1,2) - (1,2) - (1,2) - (1,2) -(8 rows) - -savepoint s1; -SAVEPOINT -select row(1, 2, 3, 'a'), row(1, 2), row(1, 2, 3); - row | row | row ------------+-------+--------- - (1,2,3,a) | (1,2) | (1,2,3) -(1 row) - -select row(1, 'b', 3, 'a'), row(1, 2, 3, 4, 5, 6), row(1, 2, 3, 4) from t; - row | row | row ------------+---------------+----------- - (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) - (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) - (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) - (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) - (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) - (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) - (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) - (1,b,3,a) | (1,2,3,4,5,6) | (1,2,3,4) -(8 rows) - -rollback to savepoint s1; -ROLLBACK -savepoint s2; -SAVEPOINT -select row(), row(1), row(1, 'a'), row(1, 2, 3); - row | row | row | row ------+-----+-------+--------- - () | (1) | (1,a) | (1,2,3) -(1 row) - -rollback to savepoint s2; -ROLLBACK -select row(), row(1), row('a', 'b'), row(1, 2, 3, 4) from t; - row | row | row | row ------+-----+-------+----------- - () | (1) | (a,b) | (1,2,3,4) - () | (1) | (a,b) | (1,2,3,4) - () | (1) | (a,b) | (1,2,3,4) - () | (1) | (a,b) | (1,2,3,4) - () | (1) | (a,b) | (1,2,3,4) - () | (1) | (a,b) | (1,2,3,4) - () | (1) | (a,b) | (1,2,3,4) - () | (1) | (a,b) | (1,2,3,4) -(8 rows) - -commit; -COMMIT --- cleanup -drop table t; -DROP TABLE diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query06_cursor.ans b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query06_cursor.ans deleted file mode 100644 index adeeb243709c4674f280858a713e13f5620306f1..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query06_cursor.ans +++ /dev/null @@ -1,43 +0,0 @@ --- start_ignore --- end_ignore --- prepare a distributed table -drop table if exists t; -psql:/path/sql_file:1: NOTICE: table "t" does not exist, skipping -DROP TABLE -create table t as select i as id from generate_series(1,100000) i; -psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'id' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -SELECT 100000 --- cursor -begin; -BEGIN -declare foo cursor for select row(id, 1),id from t order by id; -DECLARE CURSOR -savepoint x; -SAVEPOINT -fetch from foo; - row | id --------+---- - (1,1) | 1 -(1 row) - -rollback to x; -ROLLBACK -fetch ABSOLUTE 100000 from foo; - row | id -------------+-------- - (100000,1) | 100000 -(1 row) - -abort; -ROLLBACK -truncate table t; -TRUNCATE TABLE -select row(id, 1) from t; - row ------ -(0 rows) - --- cleanup -drop table t; -DROP TABLE diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query07_spi.ans b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query07_spi.ans deleted file mode 100644 index 478c59fc094d6bf20391bdc311b4a27b821eb02e..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/expected/query07_spi.ans +++ /dev/null @@ -1,28 +0,0 @@ --- start_ignore --- end_ignore --- prepare a distributed table -drop table if exists t; -psql:/path/sql_file:1: NOTICE: table "t" does not exist, skipping -DROP TABLE -create table t as select i as id from generate_series(1,8) i; -psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'id' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -SELECT 8 -create or replace function foo() returns void as $$ -begin - EXECUTE 'SELECT row(id, 2) from t'; - RETURN; -end -$$ language 'plpgsql'; -CREATE FUNCTION -select foo(); - foo ------ - -(1 row) - --- cleanup -drop function foo(); -DROP FUNCTION -drop table t; -DROP TABLE diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query01_basic.sql b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query01_basic.sql deleted file mode 100644 index f6d2b1814faac5ef9c0ed0e68a4d3364657a2fa1..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query01_basic.sql +++ /dev/null @@ -1,19 +0,0 @@ --- prepare a distributed table -drop table if exists t; -create table t as select i as id from generate_series(1,8) i; - --- test row -select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; - --- test function -create or replace function foo(in int, out int, out int) as -$$ -select $1, $1; -$$ language sql; - -select row(id, 1), foo(id) from t; - --- cleanup -drop table t; -drop function foo(int); - diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query02_udt.sql b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query02_udt.sql deleted file mode 100644 index 5955ef27b767932835d2e49f266e266a5d21bb5c..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query02_udt.sql +++ /dev/null @@ -1,23 +0,0 @@ --- prepare a distributed table -drop table if exists t; -create table t as select i as id from generate_series(1,8) i; - --- create type -drop type if exists myudt; -create type myudt as (i int, c char); - --- test row -select row((1,'a')::myudt), row((2,'b')::myudt, 2) from t; - --- test function -create or replace function foo(in int, out int, out myudt) as -$$ -select $1, ($1, 't')::myudt; -$$ language sql; - -select row(id, 1), foo(id) from t; - ---cleanup -drop function foo(int); -drop type myudt; -drop table t; diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query03_new_qe.sql b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query03_new_qe.sql deleted file mode 100644 index 80a2f02a952604d613926e1a78e6da1c7762990c..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query03_new_qe.sql +++ /dev/null @@ -1,15 +0,0 @@ --- Test when old QE got released, all types will be dispatched to new QE. - --- prepare a distributed table -drop table if exists t; -create table t as select i as id from generate_series(1,8) i; - --- set QE release timeout 10ms -set gp_vmem_idle_resource_timeout=10; - --- query 1 -select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; --- sleep 1000ms -select pg_sleep(1); --- query 2 -select row(1, 2, 3, 4, 5, 6), row(), row(1, 2, 3, 4, 5), row(1, 2), row(1, 2, 3, 4), row(1, 'a', 'abc', 1.5) from t; diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query04_mismatch.sql b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query04_mismatch.sql deleted file mode 100644 index 9a998bb5782503bbcbab807e86eb5314488cb8dc..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query04_mismatch.sql +++ /dev/null @@ -1,21 +0,0 @@ --- Utility statement won't need to dispatch transient types. So QE may have transient type which is not mapped to QD. - --- prepare a distributed table -drop table if exists t; -create table t as select i as id from generate_series(1,8) i; - --- 2 types on QD, but not on QE. -select row(1, row(1,2), 3), row(1, 2, 3, 4); - --- 1 another type on both QD and QE, but not mapped since it's not dispatched. -create or replace function foo(in int, out int, out int) as -$$ -select $1, $1; -$$ language sql; - --- dispatch 3 types to QE. -select foo(id) from t; - ---cleanup -drop function foo(int); -drop table t; diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query05_trans.sql b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query05_trans.sql deleted file mode 100644 index 2affdc568e75f0f2d469bd4934dad4ebda5bdf9b..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query05_trans.sql +++ /dev/null @@ -1,30 +0,0 @@ --- prepare a distributed table -drop table if exists t; -create table t as select i as id from generate_series(1,8) i; - --- commit -begin; -select row(), row(1, 2), row(1, 'a', 'abc', 1.5) from t; -commit; - --- abort -begin; -select row(), row(1, row(1, 2)), row(1, 2, 3) from t; -abort; - --- subtrans -begin; -select row(1, 2) from t; -savepoint s1; -select row(1, 2, 3, 'a'), row(1, 2), row(1, 2, 3); -select row(1, 'b', 3, 'a'), row(1, 2, 3, 4, 5, 6), row(1, 2, 3, 4) from t; -rollback to savepoint s1; -savepoint s2; -select row(), row(1), row(1, 'a'), row(1, 2, 3); -rollback to savepoint s2; -select row(), row(1), row('a', 'b'), row(1, 2, 3, 4) from t; -commit; - - --- cleanup -drop table t; diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query06_cursor.sql b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query06_cursor.sql deleted file mode 100644 index 011663ff9caea79447c8812e20adf6918d3959f9..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query06_cursor.sql +++ /dev/null @@ -1,18 +0,0 @@ --- prepare a distributed table -drop table if exists t; -create table t as select i as id from generate_series(1,100000) i; - --- cursor -begin; -declare foo cursor for select row(id, 1),id from t order by id; -savepoint x; -fetch from foo; -rollback to x; -fetch ABSOLUTE 100000 from foo; -abort; - -truncate table t; -select row(id, 1) from t; - --- cleanup -drop table t; diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query07_spi.sql b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query07_spi.sql deleted file mode 100644 index 1b873c88b9c6ba1c874dd6950ab4ed9097c63e8c..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/sql/query07_spi.sql +++ /dev/null @@ -1,16 +0,0 @@ --- prepare a distributed table -drop table if exists t; -create table t as select i as id from generate_series(1,8) i; - -create or replace function foo() returns void as $$ -begin - EXECUTE 'SELECT row(id, 2) from t'; - RETURN; -end -$$ language 'plpgsql'; - -select foo(); - --- cleanup -drop function foo(); -drop table t; diff --git a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/test_transienttypes.py b/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/test_transienttypes.py deleted file mode 100644 index 76f7f4986d66ba5e0c426a0d5d50e2a6276cf3c1..0000000000000000000000000000000000000000 --- a/src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/transient_types/test_transienttypes.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved. - -This program and the accompanying materials are made available under -the terms of the under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" - -from mpp.models import SQLTestCase - -class TransientTypesTestCase(SQLTestCase): - """ - @db_name transienttypes - @product_version gpdb: [4.3.6.0-9.9.99.99] - @tags list_mgmt_expand - """ - sql_dir = 'sql/' - ans_dir = 'expected/' - out_dir = 'output/' -