提交 64b3e456 编写于 作者: M Marbin Tan 提交者: Larry Hamel

Refactor gpexpand testing to be less brittle

Signed-off-by: NC.J. Jameson <cjameson@pivotal.io>
上级 21106e53
......@@ -361,9 +361,9 @@ INSERT INTO heap_part_table_9
SELECT i, (i * 10), date '2013-09-01 03:04:05' + i * '1 day'::interval
FROM generate_series(1, 1000)i;
INSERT 0 1000
DROP TABLE IF EXISTS users_rank_1;
DROP TABLE IF EXISTS users_rank_third_to_last;
DROP TABLE
CREATE TABLE users_rank_1 (
CREATE TABLE users_rank_third_to_last (
id INT4,
name TEXT,
age INT4
......@@ -371,49 +371,29 @@ CREATE TABLE users_rank_1 (
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column 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.
CREATE TABLE
INSERT INTO users_rank_1 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT INTO users_rank_third_to_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT 0 1000
DROP TABLE IF EXISTS users_rank_3;
DROP TABLE IF EXISTS users_rank_second_to_last;
DROP TABLE
CREATE TABLE users_rank_3 (
CREATE TABLE users_rank_second_to_last (
id SERIAL,
name TEXT,
age INT4
) DISTRIBUTED BY (age);
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "users_rank_3_id_seq" for serial column "users_rank_3.id"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "users_rank_second_to_last_id_seq" for serial column "users_rank_second_to_last.id"
CREATE TABLE
INSERT INTO users_rank_3 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT INTO users_rank_second_to_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT 0 1000
DROP TABLE IF EXISTS users_rank_2;
DROP TABLE IF EXISTS users_rank_very_last;
DROP TABLE
CREATE TABLE users_rank_2 (
CREATE TABLE users_rank_very_last (
id SERIAL,
name TEXT,
age INT4
) DISTRIBUTED RANDOMLY;
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "users_rank_2_id_seq" for serial column "users_rank_2.id"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "users_rank_very_last_id_seq" for serial column "users_rank_very_last.id"
CREATE TABLE
INSERT INTO users_rank_2 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT 0 1000
DROP TABLE IF EXISTS users_rank_10;
DROP TABLE
CREATE TABLE users_rank_10(
a text,
b int,
c text,
d timestamp
)
distributed by (a)
PARTITION BY RANGE(b) (START (0) END (100) INCLUSIVE EVERY(20));
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_1" for table "users_rank_10"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_2" for table "users_rank_10"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_3" for table "users_rank_10"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_4" for table "users_rank_10"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_5" for table "users_rank_10"
CREATE TABLE
INSERT INTO users_rank_10
SELECT i, (i * 10) % 100, i::text, '2013-09-01 03:04:05'
FROM generate_series(1, 1000)i;
INSERT INTO users_rank_very_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT 0 1000
DROP TABLE IF EXISTS users_with_primary_key;
DROP TABLE
......
......@@ -274,45 +274,30 @@ FROM generate_series(1, 1000)i;
DROP TABLE IF EXISTS users_rank_1;
CREATE TABLE users_rank_1 (
DROP TABLE IF EXISTS users_rank_third_to_last;
CREATE TABLE users_rank_third_to_last (
id INT4,
name TEXT,
age INT4
);
INSERT INTO users_rank_1 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT INTO users_rank_third_to_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
DROP TABLE IF EXISTS users_rank_3;
CREATE TABLE users_rank_3 (
DROP TABLE IF EXISTS users_rank_second_to_last;
CREATE TABLE users_rank_second_to_last (
id SERIAL,
name TEXT,
age INT4
) DISTRIBUTED BY (age);
INSERT INTO users_rank_3 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT INTO users_rank_second_to_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
DROP TABLE IF EXISTS users_rank_2;
CREATE TABLE users_rank_2 (
DROP TABLE IF EXISTS users_rank_very_last;
CREATE TABLE users_rank_very_last (
id SERIAL,
name TEXT,
age INT4
) DISTRIBUTED RANDOMLY;
INSERT INTO users_rank_2 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
DROP TABLE IF EXISTS users_rank_10;
CREATE TABLE users_rank_10(
a text,
b int,
c text,
d timestamp
)
distributed by (a)
PARTITION BY RANGE(b) (START (0) END (100) INCLUSIVE EVERY(20));
INSERT INTO users_rank_10
SELECT i, (i * 10) % 100, i::text, '2013-09-01 03:04:05'
FROM generate_series(1, 1000)i;
INSERT INTO users_rank_very_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
DROP TABLE IF EXISTS users_with_primary_key;
CREATE TABLE users_with_primary_key (
......
-- start_ignore
-- end_ignore
UPDATE gpexpand.status_detail SET rank= 10;
UPDATE 78
UPDATE gpexpand.status_detail SET rank=1 WHERE fq_name = 'public.users_rank_1';
UPDATE gpexpand.status_detail SET rank=7 WHERE fq_name = 'public.users_rank_third_to_last';
UPDATE 1
UPDATE gpexpand.status_detail SET rank=2 WHERE fq_name = 'public.users_rank_2';
UPDATE gpexpand.status_detail SET rank=8 WHERE fq_name = 'public.users_rank_second_to_last';
UPDATE 1
UPDATE gpexpand.status_detail SET rank=3 WHERE fq_name = 'public.users_rank_3';
UPDATE gpexpand.status_detail SET rank=9 WHERE fq_name = 'public.users_rank_very_last';
UPDATE 1
-- start_ignore
-- end_ignore
select rank from gpexpand.status_detail order by expansion_started;
select rank from gpexpand.status_detail WHERE rank IN (7,8,9) ORDER BY expansion_started;
rank
------
1
2
3
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
(79 rows)
7
8
9
(3 rows)
UPDATE gpexpand.status_detail SET rank= 10;
UPDATE gpexpand.status_detail SET rank=1 WHERE fq_name = 'public.users_rank_1';
UPDATE gpexpand.status_detail SET rank=2 WHERE fq_name = 'public.users_rank_2';
UPDATE gpexpand.status_detail SET rank=3 WHERE fq_name = 'public.users_rank_3';
UPDATE gpexpand.status_detail SET rank=7 WHERE fq_name = 'public.users_rank_third_to_last';
UPDATE gpexpand.status_detail SET rank=8 WHERE fq_name = 'public.users_rank_second_to_last';
UPDATE gpexpand.status_detail SET rank=9 WHERE fq_name = 'public.users_rank_very_last';
select rank from gpexpand.status_detail order by expansion_started;
select rank from gpexpand.status_detail WHERE rank IN (7,8,9) ORDER BY expansion_started;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册