michaeljmarshall commented on code in PR #4353:
URL: https://github.com/apache/cassandra/pull/4353#discussion_r2699535552
##########
src/java/org/apache/cassandra/index/sai/disk/v1/segment/VectorIndexSegmentSearcher.java:
##########
@@ -208,29 +236,72 @@ private SparseFixedBitSet bitSetForSearch()
return bits;
}
+ /**
+ * Produces a correct ranking of the rows in the given segment. Because
this graph does not have compressed
+ * vectors, read all vectors and put them into a priority queue to rank
them lazily. It is assumed that the whole
+ * PQ will often not be needed.
+ */
+ private CloseableIterator<RowIdWithScore> orderByBruteForce(float[]
queryVector, SegmentRowIdOrdinalPairs segmentOrdinalPairs, int limit, int topK)
throws IOException
+ {
+ if (segmentOrdinalPairs.size() == 0)
+ return CloseableIterator.empty();
+
+ // TODO add heuristic to determine if we should use one pass even
though we have PQ
+ if (graph.getCompressedVectors() != null)
+ return orderByBruteForceTwoPass(graph.getCompressedVectors(),
queryVector, segmentOrdinalPairs, limit, topK);
+
+ try (GraphIndex.View<float[]> view = graph.getView())
+ {
+ NeighborSimilarity.ExactScoreFunction esf =
graph.getExactScoreFunction(queryVector, view);
+ NeighborQueue scoredRowIds =
segmentOrdinalPairs.mapToSegmentRowIdScoreHeap(esf);
+ // TODO metrics?
columnQueryMetrics.onBruteForceNodesReranked(segmentOrdinalPairs.size());
Review Comment:
The metric could help expand what is happening at runtime, but there isn't
much else. We have this same information in the trace at the moment, so I think
we should defer on wiring up this metric.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]