Skip to content

Commit

Permalink
update tests to include the warning for parser hook
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed Oct 29, 2024
1 parent 89a4492 commit cd6c598
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_correct.out
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SELECT
l2sq_dist(v, '{0,0}') AS dist
FROM
small_world;
WARNING: this hook is experimental and can cause undefined behaviour
-- Get the results with the index
CREATE TEMP TABLE results_w_index AS
SELECT
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_cost_estimate.out
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ INFO: done init usearch index
INFO: inserted 0 elements
INFO: done saving 0 vectors
SET _lantern_internal.is_test = true;
WARNING: this hook is experimental and can cause undefined behaviour
SELECT is_cost_estimate_within_error('EXPLAIN SELECT * FROM empty_table ORDER BY v <?> ''{1,2}'' LIMIT 10', 0.47);
DEBUG: LANTERN - Query cost estimator
DEBUG: LANTERN - ---------------------
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_create.out
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ CREATE TABLE IF NOT EXISTS sift_base10k (
\copy sift_base10k (v) FROM '/tmp/lantern/vector_datasets/siftsmall_base_arrays.csv' with csv;
SET lantern.pgvector_compat=FALSE;
CREATE INDEX hnsw_idx ON sift_base10k USING lantern_hnsw (v dist_l2sq_ops) WITH (M=2, ef_construction=10, ef=4, dim=128);
WARNING: this hook is experimental and can cause undefined behaviour
INFO: done init usearch index
INFO: inserted 10000 elements
INFO: done saving 10000 vectors
Expand Down
6 changes: 6 additions & 0 deletions lantern_hnsw/test/expected/hnsw_create_expr.out
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,16 @@ SET enable_seqscan = false;
SET lantern.pgvector_compat=FALSE;
-- This should success
CREATE INDEX ON test_table USING lantern_hnsw (int_to_fixed_binary_real_array(id)) WITH (M=2);
WARNING: this hook is experimental and can cause undefined behaviour
WARNING: this hook is experimental and can cause undefined behaviour
WARNING: this hook is experimental and can cause undefined behaviour
WARNING: this hook is experimental and can cause undefined behaviour
WARNING: this hook is experimental and can cause undefined behaviour
INFO: done init usearch index
INFO: inserted 3 elements
INFO: done saving 3 vectors
SELECT _lantern_internal.validate_index('test_table_int_to_fixed_binary_real_array_idx', false);
WARNING: this hook is experimental and can cause undefined behaviour
INFO: validate_index() start for test_table_int_to_fixed_binary_real_array_idx
INFO: validate_index() done, no issues found.
validate_index
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_create_unlogged.out
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CREATE UNLOGGED TABLE IF NOT EXISTS sift_base10k (
\copy sift_base10k (v) FROM '/tmp/lantern/vector_datasets/siftsmall_base_arrays.csv' with csv;
SET lantern.pgvector_compat=FALSE;
CREATE INDEX hnsw_idx ON sift_base10k USING lantern_hnsw (v dist_l2sq_ops) WITH (M=2, ef_construction=10, ef=4, dim=128);
WARNING: this hook is experimental and can cause undefined behaviour
INFO: done init usearch index
INFO: inserted 10000 elements
INFO: done saving 10000 vectors
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_dist_func.out
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SET enable_seqscan=FALSE;
SET lantern.pgvector_compat=FALSE;
-- Verify that the distance functions work (check distances)
SELECT ROUND(l2sq_dist(v, '{0,1,0}')::numeric, 2) FROM small_world_l2 ORDER BY v <?> '{0,1,0}';
WARNING: this hook is experimental and can cause undefined behaviour
round
-------
0.00
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_extras.out
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ EXPLAIN (COSTS FALSE) SELECT id FROM sift_base1k order by v <-> :'v777' LIMIT 10

SET lantern.pgvector_compat=FALSE;
EXPLAIN (COSTS FALSE) SELECT id FROM sift_base1k order by v <?> :'v777' LIMIT 10;
WARNING: this hook is experimental and can cause undefined behaviour
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_index_from_file.out
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ SELECT * FROM ldb_get_indexes('sift_base1k');
SET enable_seqscan=FALSE;
SET lantern.pgvector_compat=FALSE;
SELECT v AS v777 FROM sift_base1k WHERE id = 777 \gset
WARNING: this hook is experimental and can cause undefined behaviour
EXPLAIN (COSTS FALSE) SELECT ROUND(l2sq_dist(v, :'v777')::numeric, 2) FROM sift_base1k order by v <?> :'v777' LIMIT 10;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_insert.out
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ SET enable_seqscan = false;
SET lantern.pgvector_compat = false;
-- Inserting vectors of the same dimension and nulls should work
INSERT INTO small_world (v) VALUES ('{1,1,2}');
WARNING: this hook is experimental and can cause undefined behaviour
INSERT INTO small_world (v) VALUES (NULL);
-- Inserting vectors of different dimension should fail
\set ON_ERROR_STOP off
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_insert_unlogged.out
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ SET enable_seqscan = false;
SET lantern.pgvector_compat = false;
-- Inserting vectors of the same dimension and nulls should work
INSERT INTO small_world (v) VALUES ('{1,1,2}');
WARNING: this hook is experimental and can cause undefined behaviour
INSERT INTO small_world (v) VALUES (NULL);
-- Inserting vectors of different dimension should fail
\set ON_ERROR_STOP off
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_operators.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ INFO: done saving 2 vectors
-- should rewrite operator
SET lantern.pgvector_compat=FALSE;
SELECT * FROM op_test ORDER BY v <?> ARRAY[1,1,1];
WARNING: this hook is experimental and can cause undefined behaviour
v
---------
{1,1,1}
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_select.out
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ SET enable_seqscan=FALSE;
SET lantern.pgvector_compat=FALSE;
-- Verify that basic queries still work given our query parser and planner hooks
SELECT 0 + 1;
WARNING: this hook is experimental and can cause undefined behaviour
?column?
----------
1
Expand Down
1 change: 1 addition & 0 deletions lantern_hnsw/test/expected/hnsw_todo.out
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ INFO: done init usearch index
INFO: inserted 8 elements
INFO: done saving 8 vectors
SELECT _lantern_internal.validate_index('small_world_l2_vector_idx', false);
WARNING: this hook is experimental and can cause undefined behaviour
INFO: validate_index() start for small_world_l2_vector_idx
INFO: validate_index() done, no issues found.
validate_index
Expand Down
3 changes: 2 additions & 1 deletion lantern_hnsw/test/expected/hnsw_vector.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RESET client_min_messages;
SET lantern.pgvector_compat=FALSE;
-- Verify basic functionality of pgvector
SELECT '[1,2,3]'::vector;
WARNING: this hook is experimental and can cause undefined behaviour
vector
---------
[1,2,3]
Expand Down Expand Up @@ -185,7 +186,7 @@ BEGIN
LOOP
real_array := array_append(real_array, CAST(substring(binary_string, i, 1) AS REAL));
END LOOP;
RETURN real_array::vector;
RETURN real_array::public.vector;
END;
$$ LANGUAGE plpgsql IMMUTABLE;
CREATE INDEX ON test_table USING lantern_hnsw (int_to_fixed_binary_vector(id)) WITH (M=2);
Expand Down
2 changes: 1 addition & 1 deletion lantern_hnsw/test/sql/hnsw_vector.sql
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ BEGIN
LOOP
real_array := array_append(real_array, CAST(substring(binary_string, i, 1) AS REAL));
END LOOP;
RETURN real_array::vector;
RETURN real_array::public.vector;
END;
$$ LANGUAGE plpgsql IMMUTABLE;

Expand Down

0 comments on commit cd6c598

Please sign in to comment.