resolve failures in box regression tests (missing SP-GiST part)
authorTomas Vondra <[email protected]>
Thu, 19 Jan 2017 13:44:02 +0000 (14:44 +0100)
committerTomas Vondra <[email protected]>
Thu, 19 Jan 2017 13:44:02 +0000 (14:44 +0100)
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.

src/test/regress/expected/box_1.out
src/test/regress/sql/box.sql

index 40ef620191987f49765a320d868bf0018d46a58b..ee7d5b6ec309f3aaae662dc91bfdbabbf6b03ea8 100644 (file)
@@ -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;
index a1838c624b7f9fc2263a56aebeb7d238e758a145..17622157bfc427fe55d63994a6f2ec4c1a7aed78 100644 (file)
@@ -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))