diff --git a/test/expected/pinecone_zero_vector_insert.out b/test/expected/pinecone_zero_vector_insert.out index 63509d21..f1f818ea 100644 --- a/test/expected/pinecone_zero_vector_insert.out +++ b/test/expected/pinecone_zero_vector_insert.out @@ -1,7 +1,6 @@ -- SETUP -- suppress output \o /dev/null -NOTICE: Mock table created delete from pinecone_mock; -- logging level SET client_min_messages = 'notice'; @@ -36,6 +35,16 @@ VALUES ('https://api.pinecone.io/indexes', 'POST', $${ } } }$$); +-- mock describe index stats +INSERT INTO pinecone_mock (url_prefix, method, response) +VALUES ('https://fakehost/describe_index_stats', 'GET', '{"namespaces":{},"dimension":3,"indexFullness":0,"totalVectorCount":0}'); +INSERT INTO t (id, val) VALUES (2, '[0,0,0]'); +-- create index after insering 0 vector - Throws an error +CREATE INDEX i2 ON t USING pinecone (val) WITH (spec = '{"serverless":{"cloud":"aws","region":"us-west-2"}}'); +ERROR: Invalid vector: zero vector +HINT: Pinecone insists that dense vectors cannot be zero in all dimensions. I don't know why they do this to you even when your metric isn't cosine. +-- Truncate the table to remove the values for creating an index successfully +TRUNCATE TABLE t; -- create index CREATE INDEX i2 ON t USING pinecone (val) WITH (spec = '{"serverless":{"cloud":"aws","region":"us-west-2"}}'); INSERT INTO pinecone_mock (url_prefix, method, response) @@ -49,18 +58,6 @@ VALUES ('https://fakehost/vectors/upsert', }', '{"upsertedCount":1}' ); -INSERT INTO pinecone_mock (url_prefix, method, response) -VALUES ('https://fakehost/vectors/upsert', -'{ "vectors": [ - { - "id": "000000000002", - "values": [0, 0, 0], - "metadata": { - } - }] - }', - 'ERROR' -); INSERT INTO t (id, val) VALUES (1, '[100,1,1]'); INSERT INTO t (id, val) VALUES (2, '[0,0,0]'); ERROR: Invalid vector: zero vector diff --git a/test/sql/pinecone_zero_vector_insert.sql b/test/sql/pinecone_zero_vector_insert.sql index 25c301f9..4bbd61c1 100644 --- a/test/sql/pinecone_zero_vector_insert.sql +++ b/test/sql/pinecone_zero_vector_insert.sql @@ -1,7 +1,6 @@ -- SETUP -- suppress output \o /dev/null -SELECT pinecone_create_mock_table(); delete from pinecone_mock; -- logging level SET client_min_messages = 'notice'; @@ -10,8 +9,6 @@ SET pinecone.vectors_per_request = 1; SET pinecone.requests_per_batch = 1; -- disable flat scan to force use of the index SET enable_seqscan = off; --- Testing database is responsible for initializing the mock table with --- SELECT pinecone_create_mock_table(); -- CREATE TABLE DROP TABLE IF EXISTS t; CREATE TABLE t (id int, val vector(3));