pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] PR #698: HNSW index test for insert to empty table with empty index is added
3+ messages / 2 participants
[nested] [flat]

* [pgvector/pgvector] PR #698: HNSW index test for insert to empty table with empty index is added
@ 2024-10-23 12:56  "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
  0 siblings, 0 replies; 3+ messages in thread

From: VladlenPopolitov (@VladlenPopolitov) @ 2024-10-23 12:56 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

As soon as TRUNCATE TABLE test is added to check creation of index on empty table, it would be good to add the test of inserting first row to empty table with created index (no one other tests cover this situation). 

inline patch 1: test/expected/hnsw_vector.out, test/sql/hnsw_vector.sql (+17/-0 lines) download inline-1.patchdiff --git a/test/expected/hnsw_vector.out b/test/expected/hnsw_vector.out index 134292b32..23fe19b95 100644 --- a/test/expected/hnsw_vector.out +++ b/test/expected/hnsw_vector.out @@ -31,6 +31,18 @@ SELECT * FROM t ORDER BY val <-> '[3,3,3]'; ----- (0 rows) +-- insert to empty table and empty index +INSERT INTO t (val) VALUES ('[0,0,0]'), ('[1,2,3]'), ('[1,1,1]'), (NULL); +INSERT INTO t (val) VALUES ('[1,2,4]'); +SELECT * FROM t ORDER BY val <-> '[3,3,3]'; + val +--------- + [1,2,3] + [1,2,4] + [1,1,1] + [0,0,0] +(4 rows) + DROP TABLE t; -- inner product CREATE TABLE t (val vector(3)); diff --git a/test/sql/hnsw_vector.sql b/test/sql/hnsw_vector.sql index 328175829..939d36e2d 100644 --- a/test/sql/hnsw_vector.sql +++ b/test/sql/hnsw_vector.sql @@ -15,6 +15,11 @@ SELECT COUNT(*) FROM t; TRUNCATE t; SELECT * FROM t ORDER BY val <-> '[3,3,3]'; +-- insert to empty table and empty index +INSERT INTO t (val) VALUES ('[0,0,0]'), ('[1,2,3]'), ('[1,1,1]'), (NULL); +INSERT INTO t (val) VALUES ('[1,2,4]'); +SELECT * FROM t ORDER BY val <-> '[3,3,3]'; + DROP TABLE t; -- inner product
^ permalink raw [nested|flat] 3+ messages in thread

* Re: [pgvector/pgvector] PR #698: HNSW index test for insert to empty table with empty index is added
@ 2024-10-23 17:10  "ankane (@ankane)" <noreply+ankane@github.com>
  1 sibling, 0 replies; 3+ messages in thread

From: ankane (@ankane) @ 2024-10-23 17:10 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @VladlenPopolitov, thanks for the PR, but there are TAP tests that cover this.

^ permalink  raw  [nested|flat] 3+ messages in thread

* Re: [pgvector/pgvector] PR #698: HNSW index test for insert to empty table with empty index is added
@ 2024-10-23 17:10  "ankane (@ankane)" <noreply+ankane@github.com>
  1 sibling, 0 replies; 3+ messages in thread

From: ankane (@ankane) @ 2024-10-23 17:10 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-10-23 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-10-23 12:56 [pgvector/pgvector] PR #698: HNSW index test for insert to empty table with empty index is added "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
2024-10-23 17:10 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-10-23 17:10 ` "ankane (@ankane)" <noreply+ankane@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox