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

Commitead26db

Browse files
committed
make tum_tuplesort
1 parent0892ebc commitead26db

File tree

6 files changed

+149
-110
lines changed

6 files changed

+149
-110
lines changed

‎expected/rum.out

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever|
1717
Index Cond: (a @@ '''ever'' | ''wrote'''::tsquery)
1818
(5 rows)
1919

20+
explain (costs off)
21+
SELECT * FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote')
22+
ORDER BY a >< to_tsquery('pg_catalog.english', 'ever|wrote');
23+
QUERY PLAN
24+
------------------------------------------------------------------
25+
Sort
26+
Sort Key: ((a >< '''ever'' | ''wrote'''::tsquery))
27+
-> Bitmap Heap Scan on test_rum
28+
Recheck Cond: (a @@ '''ever'' | ''wrote'''::tsquery)
29+
-> Bitmap Index Scan on rumidx
30+
Index Cond: (a @@ '''ever'' | ''wrote'''::tsquery)
31+
(6 rows)
32+
2033
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
2134
count
2235
-------
@@ -53,6 +66,23 @@ SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '(comp
5366
2
5467
(1 row)
5568

69+
SELECT rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way')), *
70+
FROM test_rum
71+
WHERE a @@ to_tsquery('pg_catalog.english', 'way')
72+
ORDER BY a >< to_tsquery('pg_catalog.english', 'way');
73+
rum_ts_distance | t | a
74+
-----------------+--------------------------------------------------------------------------+---------------------------------------------------------------
75+
16.4493 | my appreciation of you in a more complimentary way than by sending this | 'appreci':2 'complimentari':8 'send':12 'way':9
76+
16.4493 | itself. Put on your “specs” and look at the castle, half way up the | 'castl':10 'half':11 'look':7 'put':2 'spec':5 'way':12
77+
16.4493 | so well that only a fragment, as it were, gave way. It still hangs as if | 'fragment':6 'gave':10 'hang':14 'still':13 'way':11 'well':2
78+
16.4493 | thinking--“to go or not to go?” We are this far on the way. Reached | 'far':11 'go':3,7 'reach':15 'think':1 'way':14
79+
(4 rows)
80+
81+
-- CRASHES
82+
--SELECT rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)')), *
83+
--FROM test_rum
84+
--WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
85+
--ORDER BY a >< to_tsquery('pg_catalog.english', 'way & (go | half)');
5686
INSERT INTO test_rum (t) VALUES ('foo bar foo the over foo qq bar');
5787
INSERT INTO test_rum (t) VALUES ('345 qwerty copyright');
5888
INSERT INTO test_rum (t) VALUES ('345 qwerty');

‎rumget.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ insertScanItem(RumScanOpaque so, bool recheck)
21752175
item->data[j]=keyGetOrdering(&so->rumstate,so->tempCtx,&so->keys[i],&so->iptr);
21762176
j++;
21772177
}
2178-
tuplesort_putrum(so->sortstate,item);
2178+
rum_tuplesort_putrum(so->sortstate,item);
21792179
}
21802180

21812181
bool
@@ -2202,7 +2202,7 @@ rumgettuple(IndexScanDesc scan, ScanDirection direction)
22022202
so->tbm=NULL;
22032203
so->entriesIncrIndex=-1;
22042204
so->firstCall= false;
2205-
so->sortstate=tuplesort_begin_rum(work_mem,so->norderbys, false);
2205+
so->sortstate=rum_tuplesort_begin_rum(work_mem,so->norderbys, false);
22062206

22072207
scanPendingInsert(scan);
22082208

@@ -2215,10 +2215,10 @@ rumgettuple(IndexScanDesc scan, ScanDirection direction)
22152215
{
22162216
insertScanItem(so,recheck);
22172217
}
2218-
tuplesort_performsort(so->sortstate);
2218+
rum_tuplesort_performsort(so->sortstate);
22192219
}
22202220

2221-
item=tuplesort_getrum(so->sortstate, true,&should_free);
2221+
item=rum_tuplesort_getrum(so->sortstate, true,&should_free);
22222222
if (item)
22232223
{
22242224
scan->xs_ctup.t_self=item->iptr;

‎rumscan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ rumendscan(IndexScanDesc scan)
456456
freeScanKeys(so);
457457

458458
if (so->sortstate)
459-
tuplesort_end(so->sortstate);
459+
rum_tuplesort_end(so->sortstate);
460460

461461
MemoryContextDelete(so->tempCtx);
462462

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp