Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit57b40c9

Browse files
Merge remote-tracking branch 'rum_original/master' into PGPRO-9336
2 parents02e7c0d +8ca0f71 commit57b40c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+688
-237
lines changed

‎.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
os:linux
22

3-
dist:bionic
3+
dist:jammy
44

55
language:c
66

@@ -23,6 +23,8 @@ notifications:
2323
on_failure:always
2424

2525
env:
26+
-PG_VERSION=17
27+
-PG_VERSION=17 LEVEL=hardcore
2628
-PG_VERSION=16
2729
-PG_VERSION=16 LEVEL=hardcore
2830
-PG_VERSION=15

‎LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
RUM is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
22

3-
Portions Copyright (c) 2015-2019, Postgres Professional
3+
Portions Copyright (c) 2015-2024, Postgres Professional
44
Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
55
Portions Copyright (c) 1994, The Regents of the University of California
66

‎README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,26 @@ Typical installation procedure may look like this:
6060

6161
>**Important:** Don't forget to set the`PG_CONFIG` variable in case you want to test`RUM` on a custom build of PostgreSQL. Read more[here](https://wiki.postgresql.org/wiki/Building_and_Installing_PostgreSQL_Extension_Modules).
6262
63+
##Tests
64+
65+
$ make check
66+
67+
This command runs:
68+
- regression tests;
69+
- isolation tests;
70+
- tap tests.
71+
72+
One of the tap tests downloads a 1GB archive and then unpacks it
73+
into a file weighing almost 3GB. It is disabled by default.
74+
75+
To run this test, you need to set an environment variable:
76+
77+
$ export PG_TEST_EXTRA=big_values
78+
79+
The way to turn it off again:
80+
81+
$ export -n PG_TEST_EXTRA
82+
6383
##Common operators and functions
6484

6585
The**rum** module provides next operators.

‎expected/altorder.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* altorder.out - test output for 64-bit systems and
7+
* altorder_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
CREATE TABLE atsts (id int, t tsvector, d timestamp);
211
\copy atsts from 'data/tsts.data'
312
-- PGPRO-2537: We need more data to test rumsort.c with logtape.c

‎expected/altorder_1.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* altorder.out - test output for 64-bit systems and
7+
* altorder_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
CREATE TABLE atsts (id int, t tsvector, d timestamp);
211
\copy atsts from 'data/tsts.data'
312
-- PGPRO-2537: We need more data to test rumsort.c with logtape.c

‎expected/altorder_hash.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* altorder_hash.out - test output for 64-bit systems and
7+
* altorder_hash_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
CREATE TABLE atstsh (id int, t tsvector, d timestamp);
211
\copy atstsh from 'data/tsts.data'
312
CREATE INDEX atstsh_idx ON atstsh USING rum (t rum_tsvector_hash_addon_ops, d)

‎expected/altorder_hash_1.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* altorder_hash.out - test output for 64-bit systems and
7+
* altorder_hash_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
CREATE TABLE atstsh (id int, t tsvector, d timestamp);
211
\copy atstsh from 'data/tsts.data'
312
CREATE INDEX atstsh_idx ON atstsh USING rum (t rum_tsvector_hash_addon_ops, d)

‎expected/array.out

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* array.out - test output for 64-bit systems and
7+
* array_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
set enable_seqscan=off;
211
set enable_sort=off;
312
/*
@@ -843,41 +852,71 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
843852
DROP INDEX idx_array;
844853
/*
845854
* Check ordering using distance operator
855+
*
856+
* We want to check that index scan provides us correct ordering by distance
857+
* operator. File 'data/rum_array.data' contains two arrays that statisfy
858+
* i @> '{23,20}' and have finite distance i <=> '{51}', and a bunch of arrays
859+
* that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'.
860+
*
861+
* When ordering by distance the order of this bunch of arrays with infinite
862+
* distance is not determined and may depend of PostgreSQL version and system.
863+
* We don't add another sort expression to ORDER BY because that might cause
864+
* the planner to avoid using the index. Instead, we replace arrays that have
865+
* infinite distance with {-1} to unambiguously determine the test output.
866+
*
867+
* 'Infinity' is printed differently in the output in different PostgreSQL
868+
* versions, so we replace it with -1.
846869
*/
847870
CREATE TABLE test_array_order (
848871
i int2[]
849872
);
850873
\copy test_array_order(i) from 'data/rum_array.data';
851874
CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
875+
/*
876+
* Check that plan of the query uses ordering provided by index scan
877+
*/
852878
EXPLAIN (COSTS OFF)
853-
SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
854-
QUERY PLAN
855-
------------------------------------------------------
856-
Index Scan using idx_array_order on test_array_order
857-
Index Cond: (i @> '{23,20}'::smallint[])
858-
Order By: (i <=> '{51}'::smallint[])
859-
(3 rows)
879+
SELECT
880+
CASE WHEN distance = 'Infinity' THEN '{-1}'
881+
ELSE i
882+
END i,
883+
CASE WHEN distance = 'Infinity' THEN -1
884+
ELSE distance::numeric(18,14)
885+
END distance
886+
FROM
887+
(SELECT *, (i <=> '{51}') AS distance
888+
FROM test_array_order WHERE i @> '{23,20}' ORDER BY distance) t;
889+
QUERY PLAN
890+
------------------------------------------------------------
891+
Subquery Scan on t
892+
-> Index Scan using idx_array_order on test_array_order
893+
Index Cond: (i @> '{23,20}'::smallint[])
894+
Order By: (i <=> '{51}'::smallint[])
895+
(4 rows)
860896

861-
SELECT i,
897+
SELECT
898+
CASE WHEN distance = 'Infinity' THEN '{-1}'
899+
ELSE i
900+
END i,
862901
CASE WHEN distance = 'Infinity' THEN -1
863902
ELSE distance::numeric(18,14)
864903
END distance
865904
FROM
866905
(SELECT *, (i <=> '{51}') AS distance
867-
FROM test_array_order WHERE i @> '{23,20}' ORDER BYi <=> '{51}') t;
906+
FROM test_array_order WHERE i @> '{23,20}' ORDER BYdistance) t;
868907
i | distance
869908
---------------------+------------------
870909
{20,23,51} | 1.73205080756888
871910
{33,51,20,77,23,65} | 2.44948974278318
872-
{23,76,34,23,2,20} | -1
873-
{20,60,45,23,29} | -1
874-
{23,89,38,20,40,95} | -1
875-
{23,20,72} | -1
876-
{73,23,20} | -1
877-
{6,97,20,89,23} | -1
878-
{20,98,30,23,1,66} | -1
879-
{57,23,39,46,50,20} | -1
880-
{81,20,26,22,23} | -1
881-
{18,23,10,90,15,20} | -1
911+
{-1} | -1
912+
{-1} | -1
913+
{-1} | -1
914+
{-1} | -1
915+
{-1} | -1
916+
{-1} | -1
917+
{-1} | -1
918+
{-1} | -1
919+
{-1} | -1
920+
{-1} | -1
882921
(12 rows)
883922

‎expected/array_1.out

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* array.out - test output for 64-bit systems and
7+
* array_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
set enable_seqscan=off;
211
set enable_sort=off;
312
/*
@@ -836,41 +845,71 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
836845
DROP INDEX idx_array;
837846
/*
838847
* Check ordering using distance operator
848+
*
849+
* We want to check that index scan provides us correct ordering by distance
850+
* operator. File 'data/rum_array.data' contains two arrays that statisfy
851+
* i @> '{23,20}' and have finite distance i <=> '{51}', and a bunch of arrays
852+
* that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'.
853+
*
854+
* When ordering by distance the order of this bunch of arrays with infinite
855+
* distance is not determined and may depend of PostgreSQL version and system.
856+
* We don't add another sort expression to ORDER BY because that might cause
857+
* the planner to avoid using the index. Instead, we replace arrays that have
858+
* infinite distance with {-1} to unambiguously determine the test output.
859+
*
860+
* 'Infinity' is printed differently in the output in different PostgreSQL
861+
* versions, so we replace it with -1.
839862
*/
840863
CREATE TABLE test_array_order (
841864
i int2[]
842865
);
843866
\copy test_array_order(i) from 'data/rum_array.data';
844867
CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
868+
/*
869+
* Check that plan of the query uses ordering provided by index scan
870+
*/
845871
EXPLAIN (COSTS OFF)
846-
SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
847-
QUERY PLAN
848-
------------------------------------------------------
849-
Index Scan using idx_array_order on test_array_order
850-
Index Cond: (i @> '{23,20}'::smallint[])
851-
Order By: (i <=> '{51}'::smallint[])
852-
(3 rows)
872+
SELECT
873+
CASE WHEN distance = 'Infinity' THEN '{-1}'
874+
ELSE i
875+
END i,
876+
CASE WHEN distance = 'Infinity' THEN -1
877+
ELSE distance::numeric(18,14)
878+
END distance
879+
FROM
880+
(SELECT *, (i <=> '{51}') AS distance
881+
FROM test_array_order WHERE i @> '{23,20}' ORDER BY distance) t;
882+
QUERY PLAN
883+
------------------------------------------------------------
884+
Subquery Scan on t
885+
-> Index Scan using idx_array_order on test_array_order
886+
Index Cond: (i @> '{23,20}'::smallint[])
887+
Order By: (i <=> '{51}'::smallint[])
888+
(4 rows)
853889

854-
SELECT i,
890+
SELECT
891+
CASE WHEN distance = 'Infinity' THEN '{-1}'
892+
ELSE i
893+
END i,
855894
CASE WHEN distance = 'Infinity' THEN -1
856895
ELSE distance::numeric(18,14)
857896
END distance
858897
FROM
859898
(SELECT *, (i <=> '{51}') AS distance
860-
FROM test_array_order WHERE i @> '{23,20}' ORDER BYi <=> '{51}') t;
899+
FROM test_array_order WHERE i @> '{23,20}' ORDER BYdistance) t;
861900
i | distance
862901
---------------------+------------------
863902
{20,23,51} | 1.73205080756888
864903
{33,51,20,77,23,65} | 2.44948974278318
865-
{23,76,34,23,2,20} | -1
866-
{20,60,45,23,29} | -1
867-
{23,89,38,20,40,95} | -1
868-
{23,20,72} | -1
869-
{73,23,20} | -1
870-
{6,97,20,89,23} | -1
871-
{20,98,30,23,1,66} | -1
872-
{57,23,39,46,50,20} | -1
873-
{81,20,26,22,23} | -1
874-
{18,23,10,90,15,20} | -1
904+
{-1} | -1
905+
{-1} | -1
906+
{-1} | -1
907+
{-1} | -1
908+
{-1} | -1
909+
{-1} | -1
910+
{-1} | -1
911+
{-1} | -1
912+
{-1} | -1
913+
{-1} | -1
875914
(12 rows)
876915

‎expected/float8.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* float8.out - test output for 64-bit systems and
7+
* float8_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
set enable_seqscan=off;
211
CREATE TABLE test_float8 (
312
i float8

‎expected/float8_1.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* float8.out - test output for 64-bit systems and
7+
* float8_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
set enable_seqscan=off;
211
CREATE TABLE test_float8 (
312
i float8

‎expected/int8.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* int8.out - test output for 64-bit systems and
7+
* int8_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
set enable_seqscan=off;
211
CREATE TABLE test_int8 (
312
i int8

‎expected/int8_1.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* int8.out - test output for 64-bit systems and
7+
* int8_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
set enable_seqscan=off;
211
CREATE TABLE test_int8 (
312
i int8

‎expected/money.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* money.out - test output for 64-bit systems and
7+
* money_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
set enable_seqscan=off;
211
CREATE TABLE test_money (
312
i money

‎expected/money_1.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* money.out - test output for 64-bit systems and
7+
* money_1.out - test output for 32-bit systems.
8+
*
9+
*/
110
set enable_seqscan=off;
211
CREATE TABLE test_money (
312
i money

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp