Skip to content

Commit

Permalink
fix test update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxxen committed Sep 5, 2024
1 parent 175e9f4 commit 58aa5df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ CREATE INDEX my_hnsw_cosine_index ON my_vector_table USING HNSW (vec) WITH (metr

The following table shows the supported distance metrics and their corresponding DuckDB functions

| Description | Metric | Function |
| --- | --- | --- |
| Euclidean distance | `l2sq` | `array_distance` |
| Cosine similarity | `cosine` | `array_cosine_similarity` |
| Inner product | `ip` | `array_inner_product` |
| Description | Metric | Function |
| --- | --- |--------------------------------|
| Euclidean distance | `l2sq` | `array_distance` |
| Cosine similarity | `cosine` | `array_cosine_distance` |
| Inner product | `ip` | `array_negative_inner_product` |

## Inserts, Updates, Deletes and Re-Compaction

Expand Down
9 changes: 7 additions & 2 deletions test/sql/hnsw/hnsw_topk.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ EXPLAIN SELECT min_by(vec, array_distance(vec, [1,2,3]::FLOAT[3]), 3) as x FROM
----
physical_plan <REGEX>:.*HNSW_INDEX_SCAN.*

query II
EXPLAIN SELECT list_sum(flatten(min_by(vec, array_distance(vec, [5,5,5]::FLOAT[3]), 3))) BETWEEN 44 AND 50 FROM t1;
----
physical_plan <REGEX>:.*HNSW_INDEX_SCAN.*

query I
SELECT min_by(vec, array_distance(vec, [5,5,5]::FLOAT[3]), 3) as x FROM t1;
SELECT list_sum(flatten(min_by(vec, array_distance(vec, [5,5,5]::FLOAT[3]), 3))) BETWEEN 45 AND 50 FROM t1;
----
[[5.0, 5.0, 5.0], [6.0, 5.0, 5.0], [5.0, 6.0, 5.0]]
true

0 comments on commit 58aa5df

Please sign in to comment.