1
0
mirror of https://github.com/tensorchord/pgvecto.rs.git synced 2025-08-07 03:22:55 +03:00
Files
pgvecto.rs/tests/sqllogictest/vector_binary.slt
Usamoi 35701dd2c6 feat: support binary representation (#314)
* feat: support binary representation

Signed-off-by: usamoi <usamoi@outlook.com>

* fix: check data corruption in send/recv

Signed-off-by: usamoi <usamoi@outlook.com>

---------

Signed-off-by: usamoi <usamoi@outlook.com>
2024-02-05 08:04:06 +00:00

38 lines
880 B
Plaintext

statement ok
SET search_path TO pg_temp, vectors;
statement ok
CREATE TABLE t (id bigserial, val vector);
statement ok
INSERT INTO t (val) SELECT NULL FROM generate_series(1, 1000);
statement ok
INSERT INTO t (val) SELECT ARRAY[random()]::real[] FROM generate_series(1, 1000);
statement ok
INSERT INTO t (val) SELECT ARRAY[random(), random()]::real[] FROM generate_series(1, 1000);
statement ok
INSERT INTO t (val) SELECT ARRAY[random(), random(), random()]::real[] FROM generate_series(1, 1000);
statement ok
COPY t TO '/tmp/data.bin' WITH (FORMAT binary);
statement ok
CREATE TABLE t2 (id bigserial, val vector);
statement ok
COPY t2 FROM '/tmp/data.bin' WITH (FORMAT binary);
query I
SELECT SUM(((t.val = t2.val) OR (t.val IS NULL and t2.val IS NULL))::int) FROM t FULL OUTER JOIN t2 ON t.id = t2.id;
----
4000
statement ok
DROP TABLE t;
statement ok
DROP TABLE t2;