pgvector.git / summary / log / commit / refs

commit    8b6eab25a3ca925b05dcba4a3d52a857f377cc76
Author:   Andrew Kane <andrew@ankane.org>
Date:     Wed Apr 24 22:34:10 2024 +0000

    Moved IvfflatGetType [skip ci]


src/ivfbuild.c | 21 +++++++++++++++++++++ src/ivfflat.h | 1 - src/ivfutils.c | 21 --------------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/ivfbuild.c b/src/ivfbuild.c index ac85949b..e95036c7 100644 --- a/src/ivfbuild.c +++ b/src/ivfbuild.c @@ -319,6 +319,27 @@ InsertTuples(Relation index, IvfflatBuildState * buildstate, ForkNumber forkNum) } } +/* + * Get type + */ +static IvfflatType +IvfflatGetType(Relation index) +{ + FmgrInfo *procinfo = IvfflatOptionalProcInfo(index, IVFFLAT_TYPE_SUPPORT_PROC); + Oid typid = TupleDescAttr(index->rd_att, 0)->atttypid; + IvfflatType result; + + if (procinfo == NULL) + return IVFFLAT_TYPE_VECTOR; + + result = (IvfflatType) DatumGetInt32(FunctionCall1(procinfo, ObjectIdGetDatum(typid))); + + if (result == IVFFLAT_TYPE_UNSUPPORTED) + elog(ERROR, "type not supported for ivfflat index"); + + return result; +} + /* * Get max dimensions */ diff --git a/src/ivfflat.h b/src/ivfflat.h index 050ca3d5..21bcd3a5 100644 --- a/src/ivfflat.h +++ b/src/ivfflat.h @@ -281,7 +281,6 @@ VectorArray VectorArrayInit(int maxlen, int dimensions, Size itemsize); void VectorArrayFree(VectorArray arr); void IvfflatKmeans(Relation index, VectorArray samples, VectorArray centers, IvfflatType type); FmgrInfo *IvfflatOptionalProcInfo(Relation index, uint16 procnum); -IvfflatType IvfflatGetType(Relation index); Datum IvfflatNormValue(FmgrInfo *procinfo, Oid collation, Datum value); bool IvfflatCheckNorm(FmgrInfo *procinfo, Oid collation, Datum value); int IvfflatGetLists(Relation index); diff --git a/src/ivfutils.c b/src/ivfutils.c index 0c9d2cfc..9b5151d8 100644 --- a/src/ivfutils.c +++ b/src/ivfutils.c @@ -61,27 +61,6 @@ IvfflatOptionalProcInfo(Relation index, uint16 procnum) return index_getprocinfo(index, 1, procnum); } -/* - * Get type - */ -IvfflatType -IvfflatGetType(Relation index) -{ - FmgrInfo *procinfo = IvfflatOptionalProcInfo(index, IVFFLAT_TYPE_SUPPORT_PROC); - Oid typid = TupleDescAttr(index->rd_att, 0)->atttypid; - IvfflatType result; - - if (procinfo == NULL) - return IVFFLAT_TYPE_VECTOR; - - result = (IvfflatType) DatumGetInt32(FunctionCall1(procinfo, ObjectIdGetDatum(typid))); - - if (result == IVFFLAT_TYPE_UNSUPPORTED) - elog(ERROR, "type not supported for ivfflat index"); - - return result; -} - /* * Normalize value */ [parent: 69c3e719f73d]