Added support function for l2_normalize [skip ci]

This commit is contained in:
Andrew Kane
2024-04-22 18:36:47 -07:00
parent 2b77005610
commit f14c21748b
8 changed files with 22 additions and 18 deletions

View File

@@ -195,17 +195,12 @@ HnswGetType(Relation index)
* Normalize value
*/
Datum
HnswNormValue(Datum value, HnswType type)
HnswNormValue(FmgrInfo *procinfo, Oid collation, Datum value)
{
/* TODO Remove type-specific code */
if (type == HNSW_TYPE_VECTOR)
if (procinfo == NULL)
return DirectFunctionCall1(l2_normalize, value);
else if (type == HNSW_TYPE_HALFVEC)
return DirectFunctionCall1(halfvec_l2_normalize, value);
else if (type == HNSW_TYPE_SPARSEVEC)
return DirectFunctionCall1(sparsevec_l2_normalize, value);
else
elog(ERROR, "Unsupported type");
return FunctionCall1Coll(procinfo, collation, value);
}
/*