mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-16 09:30:59 +08:00
Keep scan-build happy
This commit is contained in:
@@ -874,6 +874,8 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F
|
|||||||
for (int i = 0; i < unvisitedLength; i++)
|
for (int i = 0; i < unvisitedLength; i++)
|
||||||
{
|
{
|
||||||
HnswElement eElement;
|
HnswElement eElement;
|
||||||
|
HnswCandidate *e;
|
||||||
|
HnswPairingHeapNode *node;
|
||||||
float eDistance;
|
float eDistance;
|
||||||
bool alwaysAdd = wlen < ef;
|
bool alwaysAdd = wlen < ef;
|
||||||
|
|
||||||
@@ -883,6 +885,9 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F
|
|||||||
{
|
{
|
||||||
eElement = unvisited[i].element;
|
eElement = unvisited[i].element;
|
||||||
eDistance = GetElementDistance(base, eElement, q, procinfo, collation);
|
eDistance = GetElementDistance(base, eElement, q, procinfo, collation);
|
||||||
|
|
||||||
|
if (!(eDistance < f->distance || alwaysAdd))
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -893,12 +898,10 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F
|
|||||||
/* Avoid any allocations if not adding */
|
/* Avoid any allocations if not adding */
|
||||||
eElement = NULL;
|
eElement = NULL;
|
||||||
HnswLoadElementImpl(blkno, offno, &eDistance, &q, index, procinfo, collation, inserting, alwaysAdd ? NULL : &f->distance, &eElement);
|
HnswLoadElementImpl(blkno, offno, &eDistance, &q, index, procinfo, collation, inserting, alwaysAdd ? NULL : &f->distance, &eElement);
|
||||||
}
|
|
||||||
|
|
||||||
if (eDistance < f->distance || alwaysAdd)
|
if (eElement == NULL)
|
||||||
{
|
continue;
|
||||||
HnswCandidate *e;
|
}
|
||||||
HnswPairingHeapNode *node;
|
|
||||||
|
|
||||||
Assert(!eElement->deleted);
|
Assert(!eElement->deleted);
|
||||||
|
|
||||||
@@ -916,9 +919,9 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F
|
|||||||
pairingheap_add(W, &node->w_node);
|
pairingheap_add(W, &node->w_node);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do not count elements being deleted towards ef when
|
* Do not count elements being deleted towards ef when vacuuming.
|
||||||
* vacuuming. It would be ideal to do this for inserts as
|
* It would be ideal to do this for inserts as well, but this
|
||||||
* well, but this could affect insert performance.
|
* could affect insert performance.
|
||||||
*/
|
*/
|
||||||
if (CountElement(base, skipElement, eElement))
|
if (CountElement(base, skipElement, eElement))
|
||||||
{
|
{
|
||||||
@@ -930,7 +933,6 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Add each element of W to w */
|
/* Add each element of W to w */
|
||||||
while (!pairingheap_is_empty(W))
|
while (!pairingheap_is_empty(W))
|
||||||
|
|||||||
Reference in New Issue
Block a user