Improved variable names [skip ci]

This commit is contained in:
Andrew Kane
2024-09-29 19:22:35 -07:00
parent 648dd8af78
commit 4ac86f62a1
2 changed files with 15 additions and 15 deletions

View File

@@ -393,7 +393,7 @@ void HnswUpdateNeighborsOnDisk(Relation index, FmgrInfo *procinfo, Oid collatio
void HnswLoadElementFromTuple(HnswElement element, HnswElementTuple etup, bool loadHeaptids, bool loadVec); void HnswLoadElementFromTuple(HnswElement element, HnswElementTuple etup, bool loadHeaptids, bool loadVec);
void HnswLoadElement(HnswElement element, double *distance, Datum *q, Relation index, FmgrInfo *procinfo, Oid collation, bool loadVec, double *maxDistance); void HnswLoadElement(HnswElement element, double *distance, Datum *q, Relation index, FmgrInfo *procinfo, Oid collation, bool loadVec, double *maxDistance);
void HnswSetElementTuple(char *base, HnswElementTuple etup, HnswElement element); void HnswSetElementTuple(char *base, HnswElementTuple etup, HnswElement element);
void HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNeighborArray * currentNeighbors, int lm, int *updateIdx, Relation index, FmgrInfo *procinfo, Oid collation); void HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNeighborArray * neighbors, int lm, int *updateIdx, Relation index, FmgrInfo *procinfo, Oid collation);
bool HnswLoadNeighborTids(HnswElement element, ItemPointerData *indextids, Relation index, int m, int lm, int lc); bool HnswLoadNeighborTids(HnswElement element, ItemPointerData *indextids, Relation index, int m, int lm, int lc);
void HnswInitLockTranche(void); void HnswInitLockTranche(void);
const HnswTypeInfo *HnswGetTypeInfo(Relation index); const HnswTypeInfo *HnswGetTypeInfo(Relation index);

View File

@@ -1104,17 +1104,17 @@ LoadElementsForInsert(HnswNeighborArray * neighbors, Datum q, HnswCandidate * *p
* Update connections * Update connections
*/ */
void void
HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNeighborArray * currentNeighbors, int lm, int *updateIdx, Relation index, FmgrInfo *procinfo, Oid collation) HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNeighborArray * neighbors, int lm, int *updateIdx, Relation index, FmgrInfo *procinfo, Oid collation)
{ {
HnswElement hce = HnswPtrAccess(base, hc->element); HnswElement hce = HnswPtrAccess(base, hc->element);
HnswCandidate hc2; HnswCandidate newHc;
HnswPtrStore(base, hc2.element, element); HnswPtrStore(base, newHc.element, element);
hc2.distance = hc->distance; newHc.distance = hc->distance;
if (currentNeighbors->length < lm) if (neighbors->length < lm)
{ {
currentNeighbors->items[currentNeighbors->length++] = hc2; neighbors->items[neighbors->length++] = newHc;
/* Track update */ /* Track update */
if (updateIdx != NULL) if (updateIdx != NULL)
@@ -1127,18 +1127,18 @@ HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNe
/* Load elements on insert */ /* Load elements on insert */
if (index != NULL) if (index != NULL)
LoadElementsForInsert(currentNeighbors, HnswGetValue(base, hce), &pruned, index, procinfo, collation); LoadElementsForInsert(neighbors, HnswGetValue(base, hce), &pruned, index, procinfo, collation);
if (pruned == NULL) if (pruned == NULL)
{ {
List *c = NIL; List *c = NIL;
/* Add candidates */ /* Add candidates */
for (int i = 0; i < currentNeighbors->length; i++) for (int i = 0; i < neighbors->length; i++)
c = lappend(c, &currentNeighbors->items[i]); c = lappend(c, &neighbors->items[i]);
c = lappend(c, &hc2); c = lappend(c, &newHc);
SelectNeighbors(base, c, lm, procinfo, collation, currentNeighbors, &hc2, &pruned, true); SelectNeighbors(base, c, lm, procinfo, collation, neighbors, &newHc, &pruned, true);
/* Should not happen */ /* Should not happen */
if (pruned == NULL) if (pruned == NULL)
@@ -1146,11 +1146,11 @@ HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNe
} }
/* Find and replace the pruned element */ /* Find and replace the pruned element */
for (int i = 0; i < currentNeighbors->length; i++) for (int i = 0; i < neighbors->length; i++)
{ {
if (HnswPtrEqual(base, currentNeighbors->items[i].element, pruned->element)) if (HnswPtrEqual(base, neighbors->items[i].element, pruned->element))
{ {
currentNeighbors->items[i] = hc2; neighbors->items[i] = newHc;
/* Track update */ /* Track update */
if (updateIdx != NULL) if (updateIdx != NULL)