mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
gha: trying to fix linux + windows testing
This commit is contained in:
parent
2843d24ae0
commit
1b3731b2bb
2 changed files with 55 additions and 9 deletions
47
sqlite-vec.c
47
sqlite-vec.c
|
|
@ -12,6 +12,52 @@
|
|||
#include "sqlite3ext.h"
|
||||
SQLITE_EXTENSION_INIT1
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifndef UINT32_TYPE
|
||||
# ifdef HAVE_UINT32_T
|
||||
# define UINT32_TYPE uint32_t
|
||||
# else
|
||||
# define UINT32_TYPE unsigned int
|
||||
# endif
|
||||
#endif
|
||||
#ifndef UINT16_TYPE
|
||||
# ifdef HAVE_UINT16_T
|
||||
# define UINT16_TYPE uint16_t
|
||||
# else
|
||||
# define UINT16_TYPE unsigned short int
|
||||
# endif
|
||||
#endif
|
||||
#ifndef INT16_TYPE
|
||||
# ifdef HAVE_INT16_T
|
||||
# define INT16_TYPE int16_t
|
||||
# else
|
||||
# define INT16_TYPE short int
|
||||
# endif
|
||||
#endif
|
||||
#ifndef UINT8_TYPE
|
||||
# ifdef HAVE_UINT8_T
|
||||
# define UINT8_TYPE uint8_t
|
||||
# else
|
||||
# define UINT8_TYPE unsigned char
|
||||
# endif
|
||||
#endif
|
||||
#ifndef INT8_TYPE
|
||||
# ifdef HAVE_INT8_T
|
||||
# define INT8_TYPE int8_t
|
||||
# else
|
||||
# define INT8_TYPE signed char
|
||||
# endif
|
||||
#endif
|
||||
#ifndef LONGDOUBLE_TYPE
|
||||
# define LONGDOUBLE_TYPE long double
|
||||
#endif
|
||||
|
||||
typedef u_int8_t uint8_t;
|
||||
typedef u_int16_t uint16_t;
|
||||
typedef u_int64_t uint64_t;
|
||||
|
|
@ -4162,7 +4208,6 @@ int vec0Update_Insert(sqlite3_vtab *pVTab, int argc, sqlite3_value **argv,
|
|||
int rc = vector_from_value(valueVector, &vectorDatas[i], &dimensions,
|
||||
&elementType, &cleanups[i], &pzError);
|
||||
todo_assert(rc == SQLITE_OK);
|
||||
printf("%d %d\n", elementType, p->vector_columns[i].element_type);
|
||||
assert(elementType == p->vector_columns[i].element_type);
|
||||
|
||||
if (dimensions != p->vector_columns[i].dimensions) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ from math import isclose
|
|||
|
||||
EXT_PATH = "./dist/vec0"
|
||||
|
||||
SUPPORTS_SUBTYPE = sqlite3.version_info[1] > 38
|
||||
|
||||
def bitmap_full(n: int) -> bytearray:
|
||||
assert (n % 8) == 0
|
||||
|
|
@ -136,7 +137,8 @@ def test_vec_bit():
|
|||
vec_bit = lambda *args: db.execute("select vec_bit(?)", args).fetchone()[0]
|
||||
assert vec_bit(b"\xff") == b"\xff"
|
||||
|
||||
assert db.execute("select subtype(vec_bit(X'FF'))").fetchone()[0] == 224
|
||||
if SUPPORTS_SUBTYPE:
|
||||
assert db.execute("select subtype(vec_bit(X'FF'))").fetchone()[0] == 224
|
||||
|
||||
with pytest.raises(
|
||||
sqlite3.OperationalError, match="zero-length vectors are not supported."
|
||||
|
|
@ -165,7 +167,8 @@ def test_vec_f32():
|
|||
for test in tests:
|
||||
assert vec_f32(json.dumps(test)) == _f32(test)
|
||||
|
||||
assert db.execute("select subtype(vec_f32(X'00000000'))").fetchone()[0] == 223
|
||||
if SUPPORTS_SUBTYPE:
|
||||
assert db.execute("select subtype(vec_f32(X'00000000'))").fetchone()[0] == 223
|
||||
|
||||
with pytest.raises(
|
||||
sqlite3.OperationalError, match="zero-length vectors are not supported."
|
||||
|
|
@ -207,7 +210,9 @@ def test_vec_int8():
|
|||
vec_int8 = lambda *args: db.execute("select vec_int8(?)", args).fetchone()[0]
|
||||
assert vec_int8(b"\x00") == _int8([0])
|
||||
assert vec_int8(b"\x00\x0f") == _int8([0, 15])
|
||||
assert db.execute("select subtype(vec_int8(?))", [b"\x00"]).fetchone()[0] == 225
|
||||
|
||||
if SUPPORTS_SUBTYPE:
|
||||
assert db.execute("select subtype(vec_int8(?))", [b"\x00"]).fetchone()[0] == 225
|
||||
|
||||
|
||||
def npy_cosine(a, b):
|
||||
|
|
@ -584,23 +589,19 @@ def test_smoke():
|
|||
db.execute("create virtual table vec_xyz using vec0( a float[2] )")
|
||||
assert execute_all(
|
||||
db,
|
||||
"select name, ncol from pragma_table_list where name like 'vec_xyz%' order by name;",
|
||||
"select name from sqlite_master where name like 'vec_xyz%' order by name;",
|
||||
) == [
|
||||
{
|
||||
"name": "vec_xyz",
|
||||
"ncol": 4,
|
||||
},
|
||||
{
|
||||
"name": "vec_xyz_chunks",
|
||||
"ncol": 4,
|
||||
},
|
||||
{
|
||||
"name": "vec_xyz_rowids",
|
||||
"ncol": 4,
|
||||
},
|
||||
{
|
||||
"name": "vec_xyz_vector_chunks00",
|
||||
"ncol": 2,
|
||||
},
|
||||
]
|
||||
chunk = db.execute("select * from vec_xyz_chunks").fetchone()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue