forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
137079: sql/opt: implement vector search in the optimizer r=DrewKimball a=DrewKimball #### sql/opt: implement vector search operators in the optimizer This commit adds the optimizer representations for two operators that will be used to support vector indexes: 1. `VectorSearchExpr` is used to search the vector index. It returns a set of candidate primary keys, which can be used to retrieve full vectors for re-ranking against the query vector. 2. `VectorPartitionSearchExpr` is used to prepare a mutation that modifies the vector index. It determines the partition that contains (or should contain) each input vector, so that the mutation "knows where to look". The following commits will add optimizer tests for these expressions. Epic: None Release note: None #### sql/opt: plan VectorPartitionSearch operators for mutations This commit adds the logic that places `VectorPartitionSearch` operators in the input of a mutation that modifies one or more vector indexes. The operators are used to determine which partition contains, or should contain, each vector involved in the mutation. Epic: None Release note: None #### sql/opt: add rule to generate vector search operators This commit adds the exploration rule `GenerateVectorSearch`, which matches a `Limit` ordered by the indexed vector column of an input `Scan` operator. The replacement expression takes the candidate primary keys returned by the `VectorSearch` operator, and produces a KNN result by fetching the full vectors, calculating distances to the query vector, and feeding the result into a top-k operator. Epic: None Release note: None Co-authored-by: Drew Kimball <[email protected]>
- Loading branch information
Showing
28 changed files
with
2,116 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.