mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-11 15:16:54 +08:00
Moved IvfflatGetType [skip ci]
This commit is contained in:
@@ -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
|
* Get max dimensions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -281,7 +281,6 @@ VectorArray VectorArrayInit(int maxlen, int dimensions, Size itemsize);
|
|||||||
void VectorArrayFree(VectorArray arr);
|
void VectorArrayFree(VectorArray arr);
|
||||||
void IvfflatKmeans(Relation index, VectorArray samples, VectorArray centers, IvfflatType type);
|
void IvfflatKmeans(Relation index, VectorArray samples, VectorArray centers, IvfflatType type);
|
||||||
FmgrInfo *IvfflatOptionalProcInfo(Relation index, uint16 procnum);
|
FmgrInfo *IvfflatOptionalProcInfo(Relation index, uint16 procnum);
|
||||||
IvfflatType IvfflatGetType(Relation index);
|
|
||||||
Datum IvfflatNormValue(FmgrInfo *procinfo, Oid collation, Datum value);
|
Datum IvfflatNormValue(FmgrInfo *procinfo, Oid collation, Datum value);
|
||||||
bool IvfflatCheckNorm(FmgrInfo *procinfo, Oid collation, Datum value);
|
bool IvfflatCheckNorm(FmgrInfo *procinfo, Oid collation, Datum value);
|
||||||
int IvfflatGetLists(Relation index);
|
int IvfflatGetLists(Relation index);
|
||||||
|
|||||||
@@ -61,27 +61,6 @@ IvfflatOptionalProcInfo(Relation index, uint16 procnum)
|
|||||||
return index_getprocinfo(index, 1, 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
|
* Normalize value
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user