generated from duckdb/extension-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Free search vector from artificial size limit
The earlier implementation imposed a size limit of 1 for the search vector. This perhaps was not needed. It should be flexible enough to work as a standard aggregate function. So, it wouldn't make sense to impose that limit and as a result use-cases.
- Loading branch information
Showing
3 changed files
with
61 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# name: test/sql/list_distance_inputs.test | ||
# description: test list_distance inputs | ||
# group: [list_distance] | ||
|
||
# Test for different-sized inputs of list_distance | ||
|
||
require vector | ||
|
||
# prepare table | ||
statement ok | ||
CREATE TABLE vectors(v1 DOUBLE[10], v2 DOUBLE[10]); | ||
|
||
statement ok | ||
INSERT INTO vectors VALUES | ||
([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 789.0, 10.0, 11.0], [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 181.0, 10.0, 10.0]), | ||
([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 181.0, 10.0, 10.0], [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 789.0, 10.0, 11.0]), | ||
([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 785.0, 10.0, 11.0], [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 181.0, 10.0, 10.0]); | ||
|
||
# distance w.r.t a single search vector | ||
query R | ||
SELECT list_distance(v1, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 785.0, 10.0, 11.0], 'l2distance') FROM vectors; | ||
---- | ||
4.0 | ||
604.0008278140023 | ||
0.0 | ||
|
||
# distance for multiple columns of a table | ||
query R | ||
SELECT list_euclidean_distance(v1, v2) FROM vectors; | ||
---- | ||
608.0008223678649 | ||
608.0008223678649 | ||
604.0008278140023 | ||
|
||
statement ok | ||
DROP TABLE vectors; |
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