Skip to content

Commit

Permalink
Make zstd tests more deterministic
Browse files Browse the repository at this point in the history
The current tests would diff on the SELECT queries containing ORDER BY
LIMIT on a gpdemo cluster (seen on my MacOS Mojave laptop and on a
CentOS 6 & 7 VM). Most likely the test answer file was created from a
cluster that was not the test standard 3 primary segment configuration
so the SELECT may output differently.

Co-authored-by: Karen Huddleston <khuddleston@pivotal.io>
  • Loading branch information
2 people authored and benchristel committed Jan 10, 2019
1 parent dc5acb7 commit 00dd1ea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
30 changes: 15 additions & 15 deletions gpcontrib/zstd/expected/compression_zstd.out
Expand Up @@ -5,23 +5,23 @@ HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sur
INSERT INTO zstdtest SELECT g, 'foo' || g FROM generate_series(1, 100000) g;
INSERT INTO zstdtest SELECT g, 'bar' || g FROM generate_series(1, 100000) g;
-- Check contents, at the beginning of the table and at the end.
SELECT * FROM zstdtest ORDER BY id LIMIT 5;
SELECT * FROM zstdtest ORDER BY (id, t) LIMIT 5;
id | t
----+------
1 | bar1
1 | foo1
2 | foo2
2 | bar2
2 | foo2
3 | bar3
(5 rows)

SELECT * FROM zstdtest ORDER BY id DESC LIMIT 5;
SELECT * FROM zstdtest ORDER BY (id, t) DESC LIMIT 5;
id | t
--------+-----------
100000 | bar100000
100000 | foo100000
99999 | bar99999
100000 | bar100000
99999 | foo99999
99999 | bar99999
99998 | foo99998
(5 rows)

Expand All @@ -37,46 +37,46 @@ NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' a
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
INSERT INTO zstdtest_1 SELECT g, 'foo' || g FROM generate_series(1, 10000) g;
INSERT INTO zstdtest_1 SELECT g, 'bar' || g FROM generate_series(1, 10000) g;
SELECT * FROM zstdtest_1 ORDER BY id LIMIT 5;
SELECT * FROM zstdtest_1 ORDER BY (id, t) LIMIT 5;
id | t
----+------
1 | bar1
1 | foo1
2 | foo2
2 | bar2
2 | foo2
3 | bar3
(5 rows)

SELECT * FROM zstdtest_1 ORDER BY id DESC LIMIT 5;
SELECT * FROM zstdtest_1 ORDER BY (id, t) DESC LIMIT 5;
id | t
-------+----------
10000 | foo10000
10000 | bar10000
9999 | bar9999
9999 | foo9999
9998 | bar9998
9999 | bar9999
9998 | foo9998
(5 rows)

INSERT INTO zstdtest_19 SELECT g, 'foo' || g FROM generate_series(1, 10000) g;
INSERT INTO zstdtest_19 SELECT g, 'bar' || g FROM generate_series(1, 10000) g;
SELECT * FROM zstdtest_19 ORDER BY id LIMIT 5;
SELECT * FROM zstdtest_19 ORDER BY (id, t) LIMIT 5;
id | t
----+------
1 | bar1
1 | foo1
2 | foo2
2 | bar2
2 | foo2
3 | bar3
(5 rows)

SELECT * FROM zstdtest_19 ORDER BY id DESC LIMIT 5;
SELECT * FROM zstdtest_19 ORDER BY (id, t) DESC LIMIT 5;
id | t
-------+----------
10000 | foo10000
10000 | bar10000
9999 | bar9999
9999 | foo9999
9998 | bar9998
9999 | bar9999
9998 | foo9998
(5 rows)

-- Test the bounds of compresslevel. None of these are allowed.
Expand Down
12 changes: 6 additions & 6 deletions gpcontrib/zstd/sql/compression_zstd.sql
Expand Up @@ -6,8 +6,8 @@ INSERT INTO zstdtest SELECT g, 'foo' || g FROM generate_series(1, 100000) g;
INSERT INTO zstdtest SELECT g, 'bar' || g FROM generate_series(1, 100000) g;

-- Check contents, at the beginning of the table and at the end.
SELECT * FROM zstdtest ORDER BY id LIMIT 5;
SELECT * FROM zstdtest ORDER BY id DESC LIMIT 5;
SELECT * FROM zstdtest ORDER BY (id, t) LIMIT 5;
SELECT * FROM zstdtest ORDER BY (id, t) DESC LIMIT 5;


-- Test different compression levels:
Expand All @@ -17,13 +17,13 @@ CREATE TABLE zstdtest_19 (id int4, t text) WITH (appendonly=true, compresstype=z

INSERT INTO zstdtest_1 SELECT g, 'foo' || g FROM generate_series(1, 10000) g;
INSERT INTO zstdtest_1 SELECT g, 'bar' || g FROM generate_series(1, 10000) g;
SELECT * FROM zstdtest_1 ORDER BY id LIMIT 5;
SELECT * FROM zstdtest_1 ORDER BY id DESC LIMIT 5;
SELECT * FROM zstdtest_1 ORDER BY (id, t) LIMIT 5;
SELECT * FROM zstdtest_1 ORDER BY (id, t) DESC LIMIT 5;

INSERT INTO zstdtest_19 SELECT g, 'foo' || g FROM generate_series(1, 10000) g;
INSERT INTO zstdtest_19 SELECT g, 'bar' || g FROM generate_series(1, 10000) g;
SELECT * FROM zstdtest_19 ORDER BY id LIMIT 5;
SELECT * FROM zstdtest_19 ORDER BY id DESC LIMIT 5;
SELECT * FROM zstdtest_19 ORDER BY (id, t) LIMIT 5;
SELECT * FROM zstdtest_19 ORDER BY (id, t) DESC LIMIT 5;


-- Test the bounds of compresslevel. None of these are allowed.
Expand Down

0 comments on commit 00dd1ea

Please sign in to comment.