diff options
author | Tomas Vondra | 2017-01-19 13:44:02 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-01-19 13:44:02 +0000 |
commit | b42ae78afe60e2a179bedbc76478ae344f70eeba (patch) | |
tree | e9896c4e70585254476f3fabeffe8ea5ce4ebc16 | |
parent | 15d6570ded9d2f2a81aeaacbf3493fc9f4370ca2 (diff) |
resolve failures in box regression tests (missing SP-GiST part)
The expected output was missing the new section, testing SP-GiST
on a box column. Make sure the table with test data is replicated
to get stable output.
-rw-r--r-- | src/test/regress/expected/box_1.out | 264 | ||||
-rw-r--r-- | src/test/regress/sql/box.sql | 2 |
2 files changed, 265 insertions, 1 deletions
diff --git a/src/test/regress/expected/box_1.out b/src/test/regress/expected/box_1.out index 40ef620191..ee7d5b6ec3 100644 --- a/src/test/regress/expected/box_1.out +++ b/src/test/regress/expected/box_1.out @@ -218,3 +218,267 @@ SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL ORDER BY (f1[0])[0], (f1[0 | 0 | 0 (4 rows) +-- +-- Test the SP-GiST index +-- +CREATE TEMPORARY TABLE box_temp (f1 box) DISTRIBUTE BY REPLICATION; +INSERT INTO box_temp + SELECT box(point(i, i), point(i * 2, i * 2)) + FROM generate_series(1, 50) AS i; +CREATE INDEX box_spgist ON box_temp USING spgist (f1); +INSERT INTO box_temp + VALUES (NULL), + ('(0,0)(0,100)'), + ('(-3,4.3333333333)(40,1)'), + ('(0,100)(0,infinity)'), + ('(-infinity,0)(0,infinity)'), + ('(-infinity,-infinity)(infinity,infinity)'); +SET enable_seqscan = false; +SELECT * FROM box_temp WHERE f1 << '(10,20),(30,40)'; + f1 +---------------------------- + (2,2),(1,1) + (4,4),(2,2) + (6,6),(3,3) + (8,8),(4,4) + (0,100),(0,0) + (0,Infinity),(0,100) + (0,Infinity),(-Infinity,0) +(7 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 << '(10,20),(30,40)'; + QUERY PLAN +---------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 << '(30,40),(10,20)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 &< '(10,4.333334),(5,100)'; + f1 +---------------------------- + (2,2),(1,1) + (4,4),(2,2) + (6,6),(3,3) + (8,8),(4,4) + (10,10),(5,5) + (0,100),(0,0) + (0,Infinity),(0,100) + (0,Infinity),(-Infinity,0) +(8 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &< '(10,4.333334),(5,100)'; + QUERY PLAN +---------------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 &< '(10,100),(5,4.333334)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 && '(15,20),(25,30)'; + f1 +------------------------------------------- + (20,20),(10,10) + (22,22),(11,11) + (24,24),(12,12) + (26,26),(13,13) + (28,28),(14,14) + (30,30),(15,15) + (32,32),(16,16) + (34,34),(17,17) + (36,36),(18,18) + (38,38),(19,19) + (40,40),(20,20) + (42,42),(21,21) + (44,44),(22,22) + (46,46),(23,23) + (48,48),(24,24) + (50,50),(25,25) + (Infinity,Infinity),(-Infinity,-Infinity) +(17 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 && '(15,20),(25,30)'; + QUERY PLAN +---------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 && '(25,30),(15,20)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 &> '(40,30),(45,50)'; + f1 +------------------- + (80,80),(40,40) + (82,82),(41,41) + (84,84),(42,42) + (86,86),(43,43) + (88,88),(44,44) + (90,90),(45,45) + (92,92),(46,46) + (94,94),(47,47) + (96,96),(48,48) + (98,98),(49,49) + (100,100),(50,50) +(11 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &> '(40,30),(45,50)'; + QUERY PLAN +---------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 &> '(45,50),(40,30)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 >> '(30,40),(40,30)'; + f1 +------------------- + (82,82),(41,41) + (84,84),(42,42) + (86,86),(43,43) + (88,88),(44,44) + (90,90),(45,45) + (92,92),(46,46) + (94,94),(47,47) + (96,96),(48,48) + (98,98),(49,49) + (100,100),(50,50) +(10 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 >> '(30,40),(40,30)'; + QUERY PLAN +---------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 >> '(40,40),(30,30)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 <<| '(10,4.33334),(5,100)'; + f1 +-------------------------- + (2,2),(1,1) + (4,4),(2,2) + (40,4.3333333333),(-3,1) +(3 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 <<| '(10,4.33334),(5,100)'; + QUERY PLAN +---------------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 <<| '(10,100),(5,4.33334)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 &<| '(10,4.3333334),(5,1)'; + f1 +-------------------------- + (2,2),(1,1) + (4,4),(2,2) + (40,4.3333333333),(-3,1) +(3 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &<| '(10,4.3333334),(5,1)'; + QUERY PLAN +---------------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 &<| '(10,4.3333334),(5,1)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 |&> '(49.99,49.99),(49.99,49.99)'; + f1 +---------------------- + (100,100),(50,50) + (0,Infinity),(0,100) +(2 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 |&> '(49.99,49.99),(49.99,49.99)'; + QUERY PLAN +----------------------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 |&> '(49.99,49.99),(49.99,49.99)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 |>> '(37,38),(39,40)'; + f1 +---------------------- + (82,82),(41,41) + (84,84),(42,42) + (86,86),(43,43) + (88,88),(44,44) + (90,90),(45,45) + (92,92),(46,46) + (94,94),(47,47) + (96,96),(48,48) + (98,98),(49,49) + (100,100),(50,50) + (0,Infinity),(0,100) +(11 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 |>> '(37,38),(39,40)'; + QUERY PLAN +----------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 |>> '(39,40),(37,38)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 @> '(10,11),(15,16)'; + f1 +------------------------------------------- + (16,16),(8,8) + (18,18),(9,9) + (20,20),(10,10) + (Infinity,Infinity),(-Infinity,-Infinity) +(4 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 @> '(10,11),(15,15)'; + QUERY PLAN +---------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 @> '(15,15),(10,11)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 <@ '(10,15),(30,35)'; + f1 +----------------- + (30,30),(15,15) +(1 row) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 <@ '(10,15),(30,35)'; + QUERY PLAN +---------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 <@ '(30,35),(10,15)'::box) +(4 rows) + +SELECT * FROM box_temp WHERE f1 ~= '(20,20),(40,40)'; + f1 +----------------- + (40,40),(20,20) +(1 row) + +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 ~= '(20,20),(40,40)'; + QUERY PLAN +---------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1 + -> Index Only Scan using box_spgist on box_temp + Index Cond: (f1 ~= '(40,40),(20,20)'::box) +(4 rows) + +RESET enable_seqscan; +DROP INDEX box_spgist; diff --git a/src/test/regress/sql/box.sql b/src/test/regress/sql/box.sql index a1838c624b..17622157bf 100644 --- a/src/test/regress/sql/box.sql +++ b/src/test/regress/sql/box.sql @@ -124,7 +124,7 @@ SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL ORDER BY (f1[0])[0], (f1[0 -- Test the SP-GiST index -- -CREATE TEMPORARY TABLE box_temp (f1 box); +CREATE TEMPORARY TABLE box_temp (f1 box) DISTRIBUTE BY REPLICATION; INSERT INTO box_temp SELECT box(point(i, i), point(i * 2, i * 2)) |