From 8de5f55b0bfd18d8f9b1fb4fbf705e5c40b74160 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sat, 28 Sep 2024 16:18:53 -0700 Subject: [PATCH] Fixed assertion [skip ci] --- src/hnsw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hnsw.c b/src/hnsw.c index 5f6df13..90dacb7 100644 --- a/src/hnsw.c +++ b/src/hnsw.c @@ -174,6 +174,9 @@ hnswcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, layer0TuplesMax = HnswGetLayerM(m, 0) * hnsw_ef_search; layer0Selectivity = scalingFactor * log(path->indexinfo->tuples) / (log(m) * (1 + log(hnsw_ef_search))); ratio = (entryLevel * m + layer0TuplesMax * layer0Selectivity) / path->indexinfo->tuples; + + if (ratio > 1) + ratio = 1; } else ratio = 1;