Restored isnan check [skip ci]

This commit is contained in:
Andrew Kane
2024-09-23 13:44:29 -07:00
parent ffca8e720c
commit 8597eb79aa
2 changed files with 9 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
#include "postgres.h"
#include <float.h>
#include <math.h>
#include "access/generic_xlog.h"
@@ -573,7 +574,14 @@ HnswLoadElementImpl(BlockNumber blkno, OffsetNumber offno, float *distance, Datu
if (DatumGetPointer(*q) == NULL)
*distance = 0;
else
{
*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 */

View File

@@ -110,7 +110,7 @@ intvec_in(PG_FUNCTION_ARGS)
int8 x[INTVEC_MAX_DIM];
int dim = 0;
char *pt = lit;
IntVector *result;
IntVector *result;
while (intvec_isspace(*pt))
pt++;