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

Commitb3a93b7

Browse files
author
Artur Zakirov
committed
Add EMPTY scankey for full-index scan
1 parent5d0122d commitb3a93b7

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

‎rumget.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ callConsistentFn(RumState *rumstate, RumScanKey key)
6464
*/
6565
key->recheckCurItem= true;
6666

67-
res=DatumGetBool(FunctionCall10Coll(&rumstate->consistentFn[key->attnum-1],
67+
if (key->searchMode==GIN_SEARCH_MODE_INCLUDE_EMPTY)
68+
res= true;
69+
else
70+
res=DatumGetBool(FunctionCall10Coll(&rumstate->consistentFn[key->attnum-1],
6871
rumstate->supportCollation[key->attnum-1],
6972
PointerGetDatum(key->entryRes),
7073
UInt16GetDatum(key->strategy),
@@ -87,7 +90,7 @@ callConsistentFn(RumState *rumstate, RumScanKey key)
8790

8891
key->outerAddInfoIsNull= true;
8992

90-
for(i=0;i<key->nuserentries;i++)
93+
for(i=0;i<key->nentries/*nuserentries*/;i++)
9194
{
9295
if (key->entryRes[i]&&key->addInfoIsNull[0]== false)
9396
{

‎rumscan.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ rumbeginscan(Relation rel, int nkeys, int norderbys)
4141
ALLOCSET_DEFAULT_INITSIZE,
4242
ALLOCSET_DEFAULT_MAXSIZE);
4343
so->keyCtx=AllocSetContextCreate(CurrentMemoryContext,
44-
"Gin scan key context",
44+
"Rum scan key context",
4545
ALLOCSET_DEFAULT_MINSIZE,
4646
ALLOCSET_DEFAULT_INITSIZE,
4747
ALLOCSET_DEFAULT_MAXSIZE);
@@ -386,6 +386,8 @@ rumNewScanKey(IndexScanDesc scan)
386386
{
387387
RumScanOpaqueso= (RumScanOpaque)scan->opaque;
388388
inti;
389+
uint32nkeys,
390+
norderbys;
389391
boolhasNullQuery= false;
390392
MemoryContextoldCtx;
391393

@@ -417,13 +419,15 @@ rumNewScanKey(IndexScanDesc scan)
417419
if (so->isVoidRes)
418420
break;
419421
}
422+
nkeys=so->nkeys;
420423

421424
for (i=0;i<scan->numberOfOrderBys;i++)
422425
{
423426
initScanKey(so,&scan->orderByData[i],&hasNullQuery);
424427
if (so->isVoidRes)
425428
break;
426429
}
430+
norderbys=so->nkeys-nkeys;
427431

428432
if (scan->numberOfOrderBys>0)
429433
{
@@ -437,11 +441,13 @@ rumNewScanKey(IndexScanDesc scan)
437441
* If there are no regular scan keys, generate an EVERYTHING scankey to
438442
* drive a full-index scan.
439443
*/
440-
if (so->nkeys==0&& !so->isVoidRes)
444+
if (nkeys==0&& !so->isVoidRes)
441445
{
442446
hasNullQuery= true;
443447
rumFillScanKey(so,FirstOffsetNumber,
444-
InvalidStrategy,GIN_SEARCH_MODE_EVERYTHING,
448+
InvalidStrategy,
449+
(norderbys>0) ?GIN_SEARCH_MODE_INCLUDE_EMPTY :
450+
GIN_SEARCH_MODE_EVERYTHING,
445451
(Datum)0,0,
446452
NULL,NULL,NULL,NULL, false);
447453
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp