mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-11 23:26:55 +08:00
Restored isnan check [skip ci]
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "access/generic_xlog.h"
|
#include "access/generic_xlog.h"
|
||||||
@@ -573,7 +574,14 @@ HnswLoadElementImpl(BlockNumber blkno, OffsetNumber offno, float *distance, Datu
|
|||||||
if (DatumGetPointer(*q) == NULL)
|
if (DatumGetPointer(*q) == NULL)
|
||||||
*distance = 0;
|
*distance = 0;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*distance = (float) DatumGetFloat8(FunctionCall2Coll(procinfo, collation, *q, PointerGetDatum(&etup->data)));
|
*distance = (float) DatumGetFloat8(FunctionCall2Coll(procinfo, collation, *q, PointerGetDatum(&etup->data)));
|
||||||
|
|
||||||
|
/* Needed for intvec cosine distance */
|
||||||
|
/* TODO Improve */
|
||||||
|
if (isnan(*distance))
|
||||||
|
*distance = FLT_MAX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load element */
|
/* Load element */
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ intvec_in(PG_FUNCTION_ARGS)
|
|||||||
int8 x[INTVEC_MAX_DIM];
|
int8 x[INTVEC_MAX_DIM];
|
||||||
int dim = 0;
|
int dim = 0;
|
||||||
char *pt = lit;
|
char *pt = lit;
|
||||||
IntVector *result;
|
IntVector *result;
|
||||||
|
|
||||||
while (intvec_isspace(*pt))
|
while (intvec_isspace(*pt))
|
||||||
pt++;
|
pt++;
|
||||||
|
|||||||
Reference in New Issue
Block a user