Set length for newCenters and aggCenters [skip ci]

This commit is contained in:
Andrew Kane
2024-04-23 15:47:04 -07:00
parent 60ceaea4f2
commit 991743786a

View File

@@ -99,7 +99,7 @@ NormCenters(FmgrInfo *normalizeprocinfo, Oid collation, VectorArray centers)
ALLOCSET_DEFAULT_SIZES);
MemoryContext oldCtx = MemoryContextSwitchTo(normCtx);
for (int j = 0; j < centers->maxlen; j++)
for (int j = 0; j < centers->length; j++)
{
Datum center = PointerGetDatum(VectorArrayGet(centers, j));
Datum newCenter = IvfflatNormValue(normalizeprocinfo, collation, center);
@@ -483,6 +483,9 @@ ElkanKmeans(Relation index, VectorArray samples, VectorArray centers, IvfflatTyp
else
elog(ERROR, "Unsupported type");
aggCenters->length = aggCenters->maxlen;
newCenters->length = newCenters->maxlen;
#ifdef IVFFLAT_MEMORY
ShowMemoryUsage(oldCtx, totalSize);
#endif