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

Commitacff257

Browse files
author
Vladlen Popolitov
committed
RUM Tests added for all opclasses
1 parent1362992 commitacff257

Some content is hidden

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

48 files changed

+4884
-35
lines changed

‎anyarray--1.2.sql

Lines changed: 434 additions & 34 deletions
Large diffs are not rendered by default.

‎expected/bit.out

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,162 @@ SELECT t, v FROM test_bit WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)
340340
(17 rows)
341341

342342
RESET anyarray.similarity_threshold;
343+
DROP INDEX idx_test_bit;
344+
CREATE INDEX idx_test_bit ON test_bit USING rum (v _bit_aa_ops);
345+
SET enable_seqscan=off;
346+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bit WHERE v && '{43,50}'::int4[]::bit(10)[] ORDER BY t;
347+
QUERY PLAN
348+
-----------------------------------------------------------------------
349+
Sort
350+
Sort Key: t
351+
-> Bitmap Heap Scan on test_bit
352+
Recheck Cond: (v && '{0000101011,0000110010}'::bit(10)[])
353+
-> Bitmap Index Scan on idx_test_bit
354+
Index Cond: (v && '{0000101011,0000110010}'::bit(10)[])
355+
(6 rows)
356+
357+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bit WHERE v @> '{43,50}'::int4[]::bit(10)[] ORDER BY t;
358+
QUERY PLAN
359+
-----------------------------------------------------------------
360+
Sort
361+
Sort Key: t
362+
-> Index Scan using idx_test_bit on test_bit
363+
Index Cond: (v @> '{0000101011,0000110010}'::bit(10)[])
364+
(4 rows)
365+
366+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bit WHERE v <@ '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)[] ORDER BY t;
367+
QUERY PLAN
368+
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
369+
Sort
370+
Sort Key: t
371+
-> Index Scan using idx_test_bit on test_bit
372+
Index Cond: (v <@ '{0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010}'::bit(10)[])
373+
(4 rows)
374+
375+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bit WHERE v = '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)[] ORDER BY t;
376+
QUERY PLAN
377+
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
378+
Sort
379+
Sort Key: t
380+
-> Index Scan using idx_test_bit on test_bit
381+
Index Cond: (v = '{0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010}'::bit(10)[])
382+
(4 rows)
383+
384+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bit WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)[] ORDER BY t;
385+
QUERY PLAN
386+
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
387+
Sort
388+
Sort Key: t
389+
-> Index Scan using idx_test_bit on test_bit
390+
Index Cond: (v % '{0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010}'::bit(10)[])
391+
(4 rows)
392+
393+
SELECT t, v FROM test_bit WHERE v && '{43,50}'::int4[]::bit(10)[] ORDER BY t;
394+
t | v
395+
----+----------------------------------------------------------------------------------------------------------------------------
396+
43 | {0000100001,0000100010,0000100011,0000100100,0000100101,0000100110,0000100111,0000101000,0000101001,0000101010,0000101011}
397+
44 | {0000100010,0000100011,0000100100,0000100101,0000100110,0000100111,0000101000,0000101001,0000101010,0000101011,0000101100}
398+
45 | {0000100011,0000100100,0000100101,0000100110,0000100111,0000101000,0000101001,0000101010,0000101011,0000101100,0000101101}
399+
46 | {0000100100,0000100101,0000100110,0000100111,0000101000,0000101001,0000101010,0000101011,0000101100,0000101101,0000101110}
400+
47 | {0000100101,0000100110,0000100111,0000101000,0000101001,0000101010,0000101011,0000101100,0000101101,0000101110,0000101111}
401+
48 | {0000100110,0000100111,0000101000,0000101001,0000101010,0000101011,0000101100,0000101101,0000101110,0000101111,0000110000}
402+
49 | {0000100111,0000101000,0000101001,0000101010,0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001}
403+
50 | {0000101000,0000101001,0000101010,0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010}
404+
51 | {0000101001,0000101010,0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010,0000110011}
405+
52 | {0000101010,0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010,0000110011,0000110100}
406+
53 | {0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010,0000110011,0000110100,0000110101}
407+
54 | {0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010,0000110011,0000110100,0000110101,0000110110}
408+
55 | {0000101101,0000101110,0000101111,0000110000,0000110001,0000110010,0000110011,0000110100,0000110101,0000110110,0000110111}
409+
56 | {0000101110,0000101111,0000110000,0000110001,0000110010,0000110011,0000110100,0000110101,0000110110,0000110111,0000111000}
410+
57 | {0000101111,0000110000,0000110001,0000110010,0000110011,0000110100,0000110101,0000110110,0000110111,0000111000,0000111001}
411+
58 | {0000110000,0000110001,0000110010,0000110011,0000110100,0000110101,0000110110,0000110111,0000111000,0000111001,0000111010}
412+
59 | {0000110001,0000110010,0000110011,0000110100,0000110101,0000110110,0000110111,0000111000,0000111001,0000111010,0000111011}
413+
60 | {0000110010,0000110011,0000110100,0000110101,0000110110,0000110111,0000111000,0000111001,0000111010,0000111011,0000111100}
414+
(18 rows)
415+
416+
SELECT t, v FROM test_bit WHERE v @> '{43,50}'::int4[]::bit(10)[] ORDER BY t;
417+
t | v
418+
----+----------------------------------------------------------------------------------------------------------------------------
419+
50 | {0000101000,0000101001,0000101010,0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010}
420+
51 | {0000101001,0000101010,0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010,0000110011}
421+
52 | {0000101010,0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010,0000110011,0000110100}
422+
53 | {0000101011,0000101100,0000101101,0000101110,0000101111,0000110000,0000110001,0000110010,0000110011,0000110100,0000110101}
423+
(4 rows)
424+
425+
SELECT t, v FROM test_bit WHERE v <@ '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)[] ORDER BY t;
426+
t | v
427+
----+----------------------------------------------------------------------------------------------------------------------------
428+
1 | {0000000000,0000000001}
429+
2 | {0000000000,0000000001,0000000010}
430+
3 | {0000000000,0000000001,0000000010,0000000011}
431+
4 | {0000000000,0000000001,0000000010,0000000011,0000000100}
432+
5 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101}
433+
6 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110}
434+
7 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111}
435+
8 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000}
436+
9 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001}
437+
10 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010}
438+
(10 rows)
439+
440+
SELECT t, v FROM test_bit WHERE v = '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)[] ORDER BY t;
441+
t | v
442+
----+----------------------------------------------------------------------------------------------------------------------------
443+
10 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010}
444+
(1 row)
445+
446+
SET anyarray.similarity_type=cosine;
447+
SELECT t, v FROM test_bit WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)[] ORDER BY t;
448+
t | v
449+
----+----------------------------------------------------------------------------------------------------------------------------
450+
3 | {0000000000,0000000001,0000000010,0000000011}
451+
4 | {0000000000,0000000001,0000000010,0000000011,0000000100}
452+
5 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101}
453+
6 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110}
454+
7 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111}
455+
8 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000}
456+
9 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001}
457+
10 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010}
458+
11 | {0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011}
459+
12 | {0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100}
460+
13 | {0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100,0000001101}
461+
14 | {0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100,0000001101,0000001110}
462+
(12 rows)
463+
464+
SET anyarray.similarity_type=jaccard;
465+
SELECT t, v FROM test_bit WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)[] ORDER BY t;
466+
t | v
467+
----+----------------------------------------------------------------------------------------------------------------------------
468+
6 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110}
469+
7 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111}
470+
8 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000}
471+
9 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001}
472+
10 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010}
473+
11 | {0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011}
474+
12 | {0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100}
475+
(7 rows)
476+
477+
SET anyarray.similarity_type=overlap;
478+
SET anyarray.similarity_threshold = 3;
479+
SELECT t, v FROM test_bit WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}'::int4[]::bit(10)[] ORDER BY t;
480+
t | v
481+
----+----------------------------------------------------------------------------------------------------------------------------
482+
2 | {0000000000,0000000001,0000000010}
483+
3 | {0000000000,0000000001,0000000010,0000000011}
484+
4 | {0000000000,0000000001,0000000010,0000000011,0000000100}
485+
5 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101}
486+
6 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110}
487+
7 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111}
488+
8 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000}
489+
9 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001}
490+
10 | {0000000000,0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010}
491+
11 | {0000000001,0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011}
492+
12 | {0000000010,0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100}
493+
13 | {0000000011,0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100,0000001101}
494+
14 | {0000000100,0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100,0000001101,0000001110}
495+
15 | {0000000101,0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100,0000001101,0000001110,0000001111}
496+
16 | {0000000110,0000000111,0000001000,0000001001,0000001010,0000001011,0000001100,0000001101,0000001110,0000001111,0000010000}
497+
17 | {0000000111,0000001000,0000001001,0000001010,0000001011,0000001100,0000001101,0000001110,0000001111,0000010000,0000010001}
498+
18 | {0000001000,0000001001,0000001010,0000001011,0000001100,0000001101,0000001110,0000001111,0000010000,0000010001,0000010010}
499+
(17 rows)
500+
501+
RESET anyarray.similarity_threshold;

‎expected/bytea.out

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,5 +499,164 @@ SELECT t, v FROM test_bytea WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
499499
18 | {8,9,10,11,12,13,14,15,16,17,18}
500500
(17 rows)
501501

502+
RESET anyarray.similarity_threshold;
503+
DROP INDEX idx_test_bytea;
504+
CREATE INDEX idx_test_bytea ON test_bytea USING rum (v _bytea_aa_ops);
505+
SET enable_seqscan=off;
506+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bytea WHERE v && '{43,50}' ORDER BY t;
507+
QUERY PLAN
508+
-----------------------------------------------------
509+
Sort
510+
Sort Key: t
511+
-> Bitmap Heap Scan on test_bytea
512+
Recheck Cond: (v && '{43,50}'::bytea[])
513+
-> Bitmap Index Scan on idx_test_bytea
514+
Index Cond: (v && '{43,50}'::bytea[])
515+
(6 rows)
516+
517+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bytea WHERE v @> '{43,50}' ORDER BY t;
518+
QUERY PLAN
519+
-----------------------------------------------------
520+
Sort
521+
Sort Key: t
522+
-> Index Scan using idx_test_bytea on test_bytea
523+
Index Cond: (v @> '{43,50}'::bytea[])
524+
(4 rows)
525+
526+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bytea WHERE v <@ '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
527+
QUERY PLAN
528+
----------------------------------------------------------------
529+
Sort
530+
Sort Key: t
531+
-> Index Scan using idx_test_bytea on test_bytea
532+
Index Cond: (v <@ '{0,1,2,3,4,5,6,7,8,9,10}'::bytea[])
533+
(4 rows)
534+
535+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bytea WHERE v = '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
536+
QUERY PLAN
537+
---------------------------------------------------------------
538+
Sort
539+
Sort Key: t
540+
-> Index Scan using idx_test_bytea on test_bytea
541+
Index Cond: (v = '{0,1,2,3,4,5,6,7,8,9,10}'::bytea[])
542+
(4 rows)
543+
544+
EXPLAIN (COSTS OFF) SELECT t, v FROM test_bytea WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
545+
QUERY PLAN
546+
---------------------------------------------------------------
547+
Sort
548+
Sort Key: t
549+
-> Index Scan using idx_test_bytea on test_bytea
550+
Index Cond: (v % '{0,1,2,3,4,5,6,7,8,9,10}'::bytea[])
551+
(4 rows)
552+
553+
SELECT t, v FROM test_bytea WHERE v && '{43,50}' ORDER BY t;
554+
t | v
555+
----+------------------------------------
556+
43 | {33,34,35,36,37,38,39,40,41,42,43}
557+
44 | {34,35,36,37,38,39,40,41,42,43,44}
558+
45 | {35,36,37,38,39,40,41,42,43,44,45}
559+
46 | {36,37,38,39,40,41,42,43,44,45,46}
560+
47 | {37,38,39,40,41,42,43,44,45,46,47}
561+
48 | {38,39,40,41,42,43,44,45,46,47,48}
562+
49 | {39,40,41,42,43,44,45,46,47,48,49}
563+
50 | {40,41,42,43,44,45,46,47,48,49,50}
564+
51 | {41,42,43,44,45,46,47,48,49,50,51}
565+
52 | {42,43,44,45,46,47,48,49,50,51,52}
566+
53 | {43,44,45,46,47,48,49,50,51,52,53}
567+
54 | {44,45,46,47,48,49,50,51,52,53,54}
568+
55 | {45,46,47,48,49,50,51,52,53,54,55}
569+
56 | {46,47,48,49,50,51,52,53,54,55,56}
570+
57 | {47,48,49,50,51,52,53,54,55,56,57}
571+
58 | {48,49,50,51,52,53,54,55,56,57,58}
572+
59 | {49,50,51,52,53,54,55,56,57,58,59}
573+
60 | {50,51,52,53,54,55,56,57,58,59,60}
574+
(18 rows)
575+
576+
SELECT t, v FROM test_bytea WHERE v @> '{43,50}' ORDER BY t;
577+
t | v
578+
----+------------------------------------
579+
50 | {40,41,42,43,44,45,46,47,48,49,50}
580+
51 | {41,42,43,44,45,46,47,48,49,50,51}
581+
52 | {42,43,44,45,46,47,48,49,50,51,52}
582+
53 | {43,44,45,46,47,48,49,50,51,52,53}
583+
(4 rows)
584+
585+
SELECT t, v FROM test_bytea WHERE v <@ '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
586+
t | v
587+
----+--------------------------
588+
1 | {0,1}
589+
2 | {0,1,2}
590+
3 | {0,1,2,3}
591+
4 | {0,1,2,3,4}
592+
5 | {0,1,2,3,4,5}
593+
6 | {0,1,2,3,4,5,6}
594+
7 | {0,1,2,3,4,5,6,7}
595+
8 | {0,1,2,3,4,5,6,7,8}
596+
9 | {0,1,2,3,4,5,6,7,8,9}
597+
10 | {0,1,2,3,4,5,6,7,8,9,10}
598+
(10 rows)
599+
600+
SELECT t, v FROM test_bytea WHERE v = '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
601+
t | v
602+
----+--------------------------
603+
10 | {0,1,2,3,4,5,6,7,8,9,10}
604+
(1 row)
605+
606+
SET anyarray.similarity_type=cosine;
607+
SELECT t, v FROM test_bytea WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
608+
t | v
609+
----+------------------------------
610+
3 | {0,1,2,3}
611+
4 | {0,1,2,3,4}
612+
5 | {0,1,2,3,4,5}
613+
6 | {0,1,2,3,4,5,6}
614+
7 | {0,1,2,3,4,5,6,7}
615+
8 | {0,1,2,3,4,5,6,7,8}
616+
9 | {0,1,2,3,4,5,6,7,8,9}
617+
10 | {0,1,2,3,4,5,6,7,8,9,10}
618+
11 | {1,2,3,4,5,6,7,8,9,10,11}
619+
12 | {2,3,4,5,6,7,8,9,10,11,12}
620+
13 | {3,4,5,6,7,8,9,10,11,12,13}
621+
14 | {4,5,6,7,8,9,10,11,12,13,14}
622+
(12 rows)
623+
624+
SET anyarray.similarity_type=jaccard;
625+
SELECT t, v FROM test_bytea WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
626+
t | v
627+
----+----------------------------
628+
6 | {0,1,2,3,4,5,6}
629+
7 | {0,1,2,3,4,5,6,7}
630+
8 | {0,1,2,3,4,5,6,7,8}
631+
9 | {0,1,2,3,4,5,6,7,8,9}
632+
10 | {0,1,2,3,4,5,6,7,8,9,10}
633+
11 | {1,2,3,4,5,6,7,8,9,10,11}
634+
12 | {2,3,4,5,6,7,8,9,10,11,12}
635+
(7 rows)
636+
637+
SET anyarray.similarity_type=overlap;
638+
SET anyarray.similarity_threshold = 3;
639+
SELECT t, v FROM test_bytea WHERE v % '{0,1,2,3,4,5,6,7,8,9,10}' ORDER BY t;
640+
t | v
641+
----+----------------------------------
642+
2 | {0,1,2}
643+
3 | {0,1,2,3}
644+
4 | {0,1,2,3,4}
645+
5 | {0,1,2,3,4,5}
646+
6 | {0,1,2,3,4,5,6}
647+
7 | {0,1,2,3,4,5,6,7}
648+
8 | {0,1,2,3,4,5,6,7,8}
649+
9 | {0,1,2,3,4,5,6,7,8,9}
650+
10 | {0,1,2,3,4,5,6,7,8,9,10}
651+
11 | {1,2,3,4,5,6,7,8,9,10,11}
652+
12 | {2,3,4,5,6,7,8,9,10,11,12}
653+
13 | {3,4,5,6,7,8,9,10,11,12,13}
654+
14 | {4,5,6,7,8,9,10,11,12,13,14}
655+
15 | {5,6,7,8,9,10,11,12,13,14,15}
656+
16 | {6,7,8,9,10,11,12,13,14,15,16}
657+
17 | {7,8,9,10,11,12,13,14,15,16,17}
658+
18 | {8,9,10,11,12,13,14,15,16,17,18}
659+
(17 rows)
660+
502661
RESET anyarray.similarity_threshold;
503662
RESET bytea_output;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp