Class VectorTopKProcessor
java.lang.Object
org.apache.cassandra.index.sai.plan.VectorTopKProcessor
Processor that scans all rows from given partitions and selects rows with top-k scores based on vector indexes.
This processor performs the following steps:
- collect rows with score into PriorityQueue that sorts rows based on score. If there are multiple vector indexes,
the final score is the sum of all vector index scores.
- remove rows with the lowest scores from PQ if PQ size exceeds limit
- return rows from PQ in primary key order to client
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<U extends Unfiltered,R extends BaseRowIterator<U>, P extends BasePartitionIterator<R>>
BasePartitionIterator<?>consumeSortByScoreAndTakeTopK(P partitions) Filter given partitions and keep the rows with the highest scores.<U extends Unfiltered,R extends BaseRowIterator<U>, P extends BasePartitionIterator<R>>
BasePartitionIterator<?>takeTopKThenSortByPrimaryKey(P partitions) Filter given partitions and keep the rows with the highest scores.
-
Constructor Details
-
VectorTopKProcessor
-
-
Method Details
-
consumeSortByScoreAndTakeTopK
public <U extends Unfiltered,R extends BaseRowIterator<U>, BasePartitionIterator<?> consumeSortByScoreAndTakeTopKP extends BasePartitionIterator<R>> (P partitions) Filter given partitions and keep the rows with the highest scores. In case ofUnfilteredPartitionIterator, all tombstones will be kept. -
takeTopKThenSortByPrimaryKey
public <U extends Unfiltered,R extends BaseRowIterator<U>, BasePartitionIterator<?> takeTopKThenSortByPrimaryKeyP extends BasePartitionIterator<R>> (P partitions) Filter given partitions and keep the rows with the highest scores. In case ofUnfilteredPartitionIterator, all tombstones will be kept.
-