From 67e648b13e59932f2f72a2b0f5d5e176fb85e200 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Fri, 29 Aug 2025 01:09:18 -0700 Subject: [PATCH] Added another test for binary_quantize function [skip ci] --- test/expected/halfvec.out | 6 ++++++ test/expected/vector_type.out | 6 ++++++ test/sql/halfvec.sql | 1 + test/sql/vector_type.sql | 1 + 4 files changed, 14 insertions(+) diff --git a/test/expected/halfvec.out b/test/expected/halfvec.out index a3ce893..3ef913d 100644 --- a/test/expected/halfvec.out +++ b/test/expected/halfvec.out @@ -540,6 +540,12 @@ SELECT binary_quantize('[0,0.1,-0.2,-0.3,0.4,0.5,0.6,-0.7,0.8,-0.9,1]'::halfvec) 01001110101 (1 row) +SELECT binary_quantize('[1,2,3,-4,5,6,-7,8,1,-2,-3,4,5,-6,7,8,-1,2,3]'::halfvec); + binary_quantize +--------------------- + 1110110110011011011 +(1 row) + SELECT subvector('[1,2,3,4,5]'::halfvec, 1, 3); subvector ----------- diff --git a/test/expected/vector_type.out b/test/expected/vector_type.out index 6748658..f4c85d0 100644 --- a/test/expected/vector_type.out +++ b/test/expected/vector_type.out @@ -576,6 +576,12 @@ SELECT binary_quantize('[0,0.1,-0.2,-0.3,0.4,0.5,0.6,-0.7,0.8,-0.9,1]'::vector); 01001110101 (1 row) +SELECT binary_quantize('[1,2,3,-4,5,6,-7,8,1,-2,-3,4,5,-6,7,8,-1,2,3]'::vector); + binary_quantize +--------------------- + 1110110110011011011 +(1 row) + SELECT subvector('[1,2,3,4,5]'::vector, 1, 3); subvector ----------- diff --git a/test/sql/halfvec.sql b/test/sql/halfvec.sql index 1a3fd1b..592a6e3 100644 --- a/test/sql/halfvec.sql +++ b/test/sql/halfvec.sql @@ -121,6 +121,7 @@ SELECT l2_normalize('[65504]'::halfvec); SELECT binary_quantize('[1,0,-1]'::halfvec); SELECT binary_quantize('[0,0.1,-0.2,-0.3,0.4,0.5,0.6,-0.7,0.8,-0.9,1]'::halfvec); +SELECT binary_quantize('[1,2,3,-4,5,6,-7,8,1,-2,-3,4,5,-6,7,8,-1,2,3]'::halfvec); SELECT subvector('[1,2,3,4,5]'::halfvec, 1, 3); SELECT subvector('[1,2,3,4,5]'::halfvec, 3, 2); diff --git a/test/sql/vector_type.sql b/test/sql/vector_type.sql index 088b040..086a39b 100644 --- a/test/sql/vector_type.sql +++ b/test/sql/vector_type.sql @@ -128,6 +128,7 @@ SELECT l2_normalize('[3e38]'::vector); SELECT binary_quantize('[1,0,-1]'::vector); SELECT binary_quantize('[0,0.1,-0.2,-0.3,0.4,0.5,0.6,-0.7,0.8,-0.9,1]'::vector); +SELECT binary_quantize('[1,2,3,-4,5,6,-7,8,1,-2,-3,4,5,-6,7,8,-1,2,3]'::vector); SELECT subvector('[1,2,3,4,5]'::vector, 1, 3); SELECT subvector('[1,2,3,4,5]'::vector, 3, 2);