Skip to content

Commit 5545068

Browse files
committed
KNNGIST, otherwise known as order-by-operator support for GIST.
This commit represents a rather heavily editorialized version of Teodor's builtin_knngist_itself-0.8.2 and builtin_knngist_proc-0.8.1 patches. I redid the opclass API to add a separate Distance method instead of turning the Consistent method into an illogical mess, fixed some bit-rot in the rbtree interfaces, and generally worked over the code style and comments. There's still no non-code documentation to speak of, but I'll work on that separately. Some contrib-module changes are also yet to come (right now, point <-> point is the only KNN-ified operator). Teodor Sigaev and Tom Lane
1 parent c0a4d3e commit 5545068

File tree

16 files changed

+972
-498
lines changed

16 files changed

+972
-498
lines changed

src/backend/access/gist/gist.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,9 @@ gistnewroot(Relation r, Buffer buffer, IndexTuple *itup, int len, ItemPointer ke
10301030
END_CRIT_SECTION();
10311031
}
10321032

1033+
/*
1034+
* Fill a GISTSTATE with information about the index
1035+
*/
10331036
void
10341037
initGISTstate(GISTSTATE *giststate, Relation index)
10351038
{
@@ -1064,6 +1067,13 @@ initGISTstate(GISTSTATE *giststate, Relation index)
10641067
fmgr_info_copy(&(giststate->equalFn[i]),
10651068
index_getprocinfo(index, i + 1, GIST_EQUAL_PROC),
10661069
CurrentMemoryContext);
1070+
/* opclasses are not required to provide a Distance method */
1071+
if (OidIsValid(index_getprocid(index, i + 1, GIST_DISTANCE_PROC)))
1072+
fmgr_info_copy(&(giststate->distanceFn[i]),
1073+
index_getprocinfo(index, i + 1, GIST_DISTANCE_PROC),
1074+
CurrentMemoryContext);
1075+
else
1076+
giststate->distanceFn[i].fn_oid = InvalidOid;
10671077
}
10681078
}
10691079

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy