Skip to content

Commit

Permalink
test: fix flaky test in bvector.slt (#512)
Browse files Browse the repository at this point in the history
Signed-off-by: usamoi <[email protected]>
  • Loading branch information
usamoi authored Jul 2, 2024
1 parent 64e8196 commit 9e0edb0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/sqllogictest/bvector.slt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ statement ok
SET search_path TO pg_temp, vectors;

statement ok
CREATE TABLE t (val bvector(3));
CREATE TABLE t (val bvector(10));

statement ok
INSERT INTO t (val) SELECT ARRAY[ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0)]::real[]::vector::bvector FROM generate_series(1, 1000);
INSERT INTO t (val) SELECT ARRAY[ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0)]::real[]::vector::bvector FROM generate_series(1, 1000);

statement ok
CREATE INDEX ON t USING vectors (val bvector_l2_ops)
Expand All @@ -24,22 +24,22 @@ CREATE INDEX ON t USING vectors (val bvector_jaccard_ops)
WITH (options = "[indexing.hnsw]");

query I
SELECT COUNT(1) FROM (SELECT 1 FROM t ORDER BY val <-> '[0,1,0]'::bvector limit 10) t2;
SELECT COUNT(1) FROM (SELECT 1 FROM t ORDER BY val <-> '[0,1,0,0,0,0,0,0,0,0]'::bvector limit 10) t2;
----
10

query I
SELECT COUNT(1) FROM (SELECT 1 FROM t ORDER BY val <#> '[0,1,0]'::bvector limit 10) t2;
SELECT COUNT(1) FROM (SELECT 1 FROM t ORDER BY val <#> '[0,1,0,0,0,0,0,0,0,0]'::bvector limit 10) t2;
----
10

query I
SELECT COUNT(1) FROM (SELECT 1 FROM t ORDER BY val <=> '[0,1,0]'::bvector limit 10) t2;
SELECT COUNT(1) FROM (SELECT 1 FROM t ORDER BY val <=> '[0,1,0,0,0,0,0,0,0,0]'::bvector limit 10) t2;
----
10

query I
SELECT COUNT(1) FROM (SELECT 1 FROM t ORDER BY val <~> '[0,1,0]'::bvector limit 10) t2;
SELECT COUNT(1) FROM (SELECT 1 FROM t ORDER BY val <~> '[0,1,0,0,0,0,0,0,0,0]'::bvector limit 10) t2;
----
10

Expand Down

0 comments on commit 9e0edb0

Please sign in to comment.