diff --git a/src/backend/Makefile b/src/backend/Makefile index 0f807d4fc02..6e46c45781c 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -70,6 +70,26 @@ OBJS += \ $(top_builddir)/src/pl/plpgsql/src/pl_handler.o \ $(top_builddir)/src/pl/plpgsql/src/pl_scanner.o +OBJS += \ + $(top_builddir)/../pg_ext/pgvector/src/bitutils.o \ + $(top_builddir)/../pg_ext/pgvector/src/bitvec.o \ + $(top_builddir)/../pg_ext/pgvector/src/halfutils.o \ + $(top_builddir)/../pg_ext/pgvector/src/halfvec.o \ + $(top_builddir)/../pg_ext/pgvector/src/hnsw.o \ + $(top_builddir)/../pg_ext/pgvector/src/hnswbuild.o \ + $(top_builddir)/../pg_ext/pgvector/src/hnswscan.o \ + $(top_builddir)/../pg_ext/pgvector/src/hnswutils.o \ + $(top_builddir)/../pg_ext/pgvector/src/hnswvacuum.o \ + $(top_builddir)/../pg_ext/pgvector/src/ivfbuild.o \ + $(top_builddir)/../pg_ext/pgvector/src/ivfflat.o \ + $(top_builddir)/../pg_ext/pgvector/src/ivfinsert.o \ + $(top_builddir)/../pg_ext/pgvector/src/ivfkmeans.o \ + $(top_builddir)/../pg_ext/pgvector/src/ivfscan.o \ + $(top_builddir)/../pg_ext/pgvector/src/ivfutils.o \ + $(top_builddir)/../pg_ext/pgvector/src/ivfvacuum.o \ + $(top_builddir)/../pg_ext/pgvector/src/sparsevec.o \ + $(top_builddir)/../pg_ext/pgvector/src/vector.o + postgres: $(OBJS) $(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) $(LIBS) -sALLOW_MEMORY_GROWTH=1 -sFORCE_FILESYSTEM=1 -lnodefs.js -lproxyfs.js -lidbfs.js -o $@ diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 2575ea1ca0d..c5d248847a8 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -456,7 +456,7 @@ InitProcess(void) * be careful and reinitialize its value here. (This is not strictly * necessary anymore, but seems like a good idea for cleanliness.) */ - PGSemaphoreReset(MyProc->sem); + // PGSemaphoreReset(MyProc->sem); // caused process to hang for some reason /* * Arrange to clean up at backend exit. @@ -468,6 +468,7 @@ InitProcess(void) * local state needed for LWLocks, and the deadlock checker. */ InitLWLockAccess(); + InitDeadLockChecking(); } diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c index 764793ce212..e8b2db462ec 100644 --- a/src/backend/utils/fmgr/dfmgr.c +++ b/src/backend/utils/fmgr/dfmgr.c @@ -37,6 +37,7 @@ #include "utils/hsearch.h" #include "extensions/plpgsql.h" +#include "extensions/pgvector.h" /* signatures for PostgreSQL-specific library init/fini functions */ typedef void (*PG_init_t) (void); @@ -110,6 +111,222 @@ static const func_map function_map[] = { {NULL, NULL} }; +bool pgvector_loaded = false; +static const func_map pgvector_func_map[] = { + {"sparsevec_in", sparsevec_in}, + {"pg_finfo_sparsevec_in", pg_finfo_sparsevec_in}, + {"sparsevec_out", sparsevec_out}, + {"pg_finfo_sparsevec_out", pg_finfo_sparsevec_out}, + {"sparsevec_typmod_in", sparsevec_typmod_in}, + {"pg_finfo_sparsevec_typmod_in", pg_finfo_sparsevec_typmod_in}, + {"sparsevec_recv", sparsevec_recv}, + {"pg_finfo_sparsevec_recv", pg_finfo_sparsevec_recv}, + {"sparsevec_send", sparsevec_send}, + {"pg_finfo_sparsevec_send", pg_finfo_sparsevec_send}, + {"sparsevec", sparsevec}, + {"pg_finfo_sparsevec", pg_finfo_sparsevec}, + {"vector_to_sparsevec", vector_to_sparsevec}, + {"pg_finfo_vector_to_sparsevec", pg_finfo_vector_to_sparsevec}, + {"halfvec_to_sparsevec", halfvec_to_sparsevec}, + {"pg_finfo_halfvec_to_sparsevec", pg_finfo_halfvec_to_sparsevec}, + {"sparsevec_l2_distance", sparsevec_l2_distance}, + {"pg_finfo_sparsevec_l2_distance", pg_finfo_sparsevec_l2_distance}, + {"sparsevec_l2_squared_distance", sparsevec_l2_squared_distance}, + {"pg_finfo_sparsevec_l2_squared_distance", pg_finfo_sparsevec_l2_squared_distance}, + {"sparsevec_inner_product", sparsevec_inner_product}, + {"pg_finfo_sparsevec_inner_product", pg_finfo_sparsevec_inner_product}, + {"sparsevec_negative_inner_product", sparsevec_negative_inner_product}, + {"pg_finfo_sparsevec_negative_inner_product", pg_finfo_sparsevec_negative_inner_product}, + {"sparsevec_cosine_distance", sparsevec_cosine_distance}, + {"pg_finfo_sparsevec_cosine_distance", pg_finfo_sparsevec_cosine_distance}, + {"sparsevec_l1_distance", sparsevec_l1_distance}, + {"pg_finfo_sparsevec_l1_distance", pg_finfo_sparsevec_l1_distance}, + {"sparsevec_l2_norm", sparsevec_l2_norm}, + {"pg_finfo_sparsevec_l2_norm", pg_finfo_sparsevec_l2_norm}, + {"sparsevec_l2_normalize", sparsevec_l2_normalize}, + {"pg_finfo_sparsevec_l2_normalize", pg_finfo_sparsevec_l2_normalize}, + {"sparsevec_lt", sparsevec_lt}, + {"pg_finfo_sparsevec_lt", pg_finfo_sparsevec_lt}, + {"sparsevec_le", sparsevec_le}, + {"pg_finfo_sparsevec_le", pg_finfo_sparsevec_le}, + {"sparsevec_eq", sparsevec_eq}, + {"pg_finfo_sparsevec_eq", pg_finfo_sparsevec_eq}, + {"sparsevec_ne", sparsevec_ne}, + {"pg_finfo_sparsevec_ne", pg_finfo_sparsevec_ne}, + {"sparsevec_ge", sparsevec_ge}, + {"pg_finfo_sparsevec_ge", pg_finfo_sparsevec_ge}, + {"sparsevec_gt", sparsevec_gt}, + {"pg_finfo_sparsevec_gt", pg_finfo_sparsevec_gt}, + {"sparsevec_cmp", sparsevec_cmp}, + {"pg_finfo_sparsevec_cmp", pg_finfo_sparsevec_cmp}, + {"hamming_distance", hamming_distance}, + {"pg_finfo_hamming_distance", pg_finfo_hamming_distance}, + {"jaccard_distance", jaccard_distance}, + {"pg_finfo_jaccard_distance", pg_finfo_jaccard_distance}, + {"vector_in", vector_in}, + {"pg_finfo_vector_in", pg_finfo_vector_in}, + {"vector_out", vector_out}, + {"pg_finfo_vector_out", pg_finfo_vector_out}, + {"vector_typmod_in", vector_typmod_in}, + {"pg_finfo_vector_typmod_in", pg_finfo_vector_typmod_in}, + {"vector_recv", vector_recv}, + {"pg_finfo_vector_recv", pg_finfo_vector_recv}, + {"vector_send", vector_send}, + {"pg_finfo_vector_send", pg_finfo_vector_send}, + {"vector", vector}, + {"pg_finfo_vector", pg_finfo_vector}, + {"array_to_vector", array_to_vector}, + {"pg_finfo_array_to_vector", pg_finfo_array_to_vector}, + {"vector_to_float4", vector_to_float4}, + {"pg_finfo_vector_to_float4", pg_finfo_vector_to_float4}, + {"halfvec_to_vector", halfvec_to_vector}, + {"pg_finfo_halfvec_to_vector", pg_finfo_halfvec_to_vector}, + {"l2_distance", l2_distance}, + {"pg_finfo_l2_distance", pg_finfo_l2_distance}, + {"vector_l2_squared_distance", vector_l2_squared_distance}, + {"pg_finfo_vector_l2_squared_distance", pg_finfo_vector_l2_squared_distance}, + {"inner_product", inner_product}, + {"pg_finfo_inner_product", pg_finfo_inner_product}, + {"vector_negative_inner_product", vector_negative_inner_product}, + {"pg_finfo_vector_negative_inner_product", pg_finfo_vector_negative_inner_product}, + {"cosine_distance", cosine_distance}, + {"pg_finfo_cosine_distance", pg_finfo_cosine_distance}, + {"vector_spherical_distance", vector_spherical_distance}, + {"pg_finfo_vector_spherical_distance", pg_finfo_vector_spherical_distance}, + {"l1_distance", l1_distance}, + {"pg_finfo_l1_distance", pg_finfo_l1_distance}, + {"vector_dims", vector_dims}, + {"pg_finfo_vector_dims", pg_finfo_vector_dims}, + {"vector_norm", vector_norm}, + {"pg_finfo_vector_norm", pg_finfo_vector_norm}, + {"l2_normalize", l2_normalize}, + {"pg_finfo_l2_normalize", pg_finfo_l2_normalize}, + {"vector_add", vector_add}, + {"pg_finfo_vector_add", pg_finfo_vector_add}, + {"vector_sub", vector_sub}, + {"pg_finfo_vector_sub", pg_finfo_vector_sub}, + {"vector_mul", vector_mul}, + {"pg_finfo_vector_mul", pg_finfo_vector_mul}, + {"vector_concat", vector_concat}, + {"pg_finfo_vector_concat", pg_finfo_vector_concat}, + {"binary_quantize", binary_quantize}, + {"pg_finfo_binary_quantize", pg_finfo_binary_quantize}, + {"subvector", subvector}, + {"pg_finfo_subvector", pg_finfo_subvector}, + {"vector_lt", vector_lt}, + {"pg_finfo_vector_lt", pg_finfo_vector_lt}, + {"vector_le", vector_le}, + {"pg_finfo_vector_le", pg_finfo_vector_le}, + {"vector_eq", vector_eq}, + {"pg_finfo_vector_eq", pg_finfo_vector_eq}, + {"vector_ne", vector_ne}, + {"pg_finfo_vector_ne", pg_finfo_vector_ne}, + {"vector_ge", vector_ge}, + {"pg_finfo_vector_ge", pg_finfo_vector_ge}, + {"vector_gt", vector_gt}, + {"pg_finfo_vector_gt", pg_finfo_vector_gt}, + {"vector_cmp", vector_cmp}, + {"pg_finfo_vector_cmp", pg_finfo_vector_cmp}, + {"vector_accum", vector_accum}, + {"pg_finfo_vector_accum", pg_finfo_vector_accum}, + {"vector_combine", vector_combine}, + {"pg_finfo_vector_combine", pg_finfo_vector_combine}, + {"vector_avg", vector_avg}, + {"pg_finfo_vector_avg", pg_finfo_vector_avg}, + {"sparsevec_to_vector", sparsevec_to_vector}, + {"pg_finfo_sparsevec_to_vector", pg_finfo_sparsevec_to_vector}, + {"ivfflathandler", ivfflathandler}, + {"pg_finfo_ivfflathandler", pg_finfo_ivfflathandler}, + {"halfvec_in", halfvec_in}, + {"pg_finfo_halfvec_in", pg_finfo_halfvec_in}, + {"halfvec_out", halfvec_out}, + {"pg_finfo_halfvec_out", pg_finfo_halfvec_out}, + {"halfvec_typmod_in", halfvec_typmod_in}, + {"pg_finfo_halfvec_typmod_in", pg_finfo_halfvec_typmod_in}, + {"halfvec_recv", halfvec_recv}, + {"pg_finfo_halfvec_recv", pg_finfo_halfvec_recv}, + {"halfvec_send", halfvec_send}, + {"pg_finfo_halfvec_send", pg_finfo_halfvec_send}, + {"halfvec", halfvec}, + {"pg_finfo_halfvec", pg_finfo_halfvec}, + {"array_to_halfvec", array_to_halfvec}, + {"pg_finfo_array_to_halfvec", pg_finfo_array_to_halfvec}, + {"halfvec_to_float4", halfvec_to_float4}, + {"pg_finfo_halfvec_to_float4", pg_finfo_halfvec_to_float4}, + {"vector_to_halfvec", vector_to_halfvec}, + {"pg_finfo_vector_to_halfvec", pg_finfo_vector_to_halfvec}, + {"halfvec_l2_distance", halfvec_l2_distance}, + {"pg_finfo_halfvec_l2_distance", pg_finfo_halfvec_l2_distance}, + {"halfvec_l2_squared_distance", halfvec_l2_squared_distance}, + {"pg_finfo_halfvec_l2_squared_distance", pg_finfo_halfvec_l2_squared_distance}, + {"halfvec_inner_product", halfvec_inner_product}, + {"pg_finfo_halfvec_inner_product", pg_finfo_halfvec_inner_product}, + {"halfvec_negative_inner_product", halfvec_negative_inner_product}, + {"pg_finfo_halfvec_negative_inner_product", pg_finfo_halfvec_negative_inner_product}, + {"halfvec_cosine_distance", halfvec_cosine_distance}, + {"pg_finfo_halfvec_cosine_distance", pg_finfo_halfvec_cosine_distance}, + {"halfvec_spherical_distance", halfvec_spherical_distance}, + {"pg_finfo_halfvec_spherical_distance", pg_finfo_halfvec_spherical_distance}, + {"halfvec_l1_distance", halfvec_l1_distance}, + {"pg_finfo_halfvec_l1_distance", pg_finfo_halfvec_l1_distance}, + {"halfvec_vector_dims", halfvec_vector_dims}, + {"pg_finfo_halfvec_vector_dims", pg_finfo_halfvec_vector_dims}, + {"halfvec_l2_norm", halfvec_l2_norm}, + {"pg_finfo_halfvec_l2_norm", pg_finfo_halfvec_l2_norm}, + {"halfvec_l2_normalize", halfvec_l2_normalize}, + {"pg_finfo_halfvec_l2_normalize", pg_finfo_halfvec_l2_normalize}, + {"halfvec_add", halfvec_add}, + {"pg_finfo_halfvec_add", pg_finfo_halfvec_add}, + {"halfvec_sub", halfvec_sub}, + {"pg_finfo_halfvec_sub", pg_finfo_halfvec_sub}, + {"halfvec_mul", halfvec_mul}, + {"pg_finfo_halfvec_mul", pg_finfo_halfvec_mul}, + {"halfvec_concat", halfvec_concat}, + {"pg_finfo_halfvec_concat", pg_finfo_halfvec_concat}, + {"halfvec_binary_quantize", halfvec_binary_quantize}, + {"pg_finfo_halfvec_binary_quantize", pg_finfo_halfvec_binary_quantize}, + {"halfvec_subvector", halfvec_subvector}, + {"pg_finfo_halfvec_subvector", pg_finfo_halfvec_subvector}, + {"halfvec_lt", halfvec_lt}, + {"pg_finfo_halfvec_lt", pg_finfo_halfvec_lt}, + {"halfvec_le", halfvec_le}, + {"pg_finfo_halfvec_le", pg_finfo_halfvec_le}, + {"halfvec_eq", halfvec_eq}, + {"pg_finfo_halfvec_eq", pg_finfo_halfvec_eq}, + {"halfvec_ne", halfvec_ne}, + {"pg_finfo_halfvec_ne", pg_finfo_halfvec_ne}, + {"halfvec_ge", halfvec_ge}, + {"pg_finfo_halfvec_ge", pg_finfo_halfvec_ge}, + {"halfvec_gt", halfvec_gt}, + {"pg_finfo_halfvec_gt", pg_finfo_halfvec_gt}, + {"halfvec_cmp", halfvec_cmp}, + {"pg_finfo_halfvec_cmp", pg_finfo_halfvec_cmp}, + {"halfvec_accum", halfvec_accum}, + {"pg_finfo_halfvec_accum", pg_finfo_halfvec_accum}, + {"halfvec_avg", halfvec_avg}, + {"pg_finfo_halfvec_avg", pg_finfo_halfvec_avg}, + {"sparsevec_to_halfvec", sparsevec_to_halfvec}, + {"pg_finfo_sparsevec_to_halfvec", pg_finfo_sparsevec_to_halfvec}, + {"l2_normalize", l2_normalize}, + {"halfvec_l2_normalize", halfvec_l2_normalize}, + {"sparsevec_l2_normalize", sparsevec_l2_normalize}, + {"ivfflat_halfvec_support", ivfflat_halfvec_support}, + {"pg_finfo_ivfflat_halfvec_support", pg_finfo_ivfflat_halfvec_support}, + {"ivfflat_bit_support", ivfflat_bit_support}, + {"pg_finfo_ivfflat_bit_support", pg_finfo_ivfflat_bit_support}, + {"hnswhandler", hnswhandler}, + {"pg_finfo_hnswhandler", pg_finfo_hnswhandler}, + {"l2_normalize", l2_normalize}, + {"halfvec_l2_normalize", halfvec_l2_normalize}, + {"sparsevec_l2_normalize", sparsevec_l2_normalize}, + {"hnsw_halfvec_support", hnsw_halfvec_support}, + {"pg_finfo_hnsw_halfvec_support", pg_finfo_hnsw_halfvec_support}, + {"hnsw_bit_support", hnsw_bit_support}, + {"pg_finfo_hnsw_bit_support", pg_finfo_hnsw_bit_support}, + {"hnsw_sparsevec_support", hnsw_sparsevec_support}, + {"pg_finfo_hnsw_sparsevec_support", pg_finfo_hnsw_sparsevec_support}, + {NULL, NULL}, +}; /* * Load the specified dynamic-link library file, and look for a function @@ -146,6 +363,20 @@ load_external_function(const char *filename, const char *funcname, } } + /* PGVector Static Dispatch */ + if (strcmp(filename, "$libdir/vector") == 0) { + if (!pgvector_loaded) { + _PG_init(); + pgvector_loaded = true; + } + + for (int i = 0; pgvector_func_map[i].name != NULL; i++) { + if (strcmp(funcname, pgvector_func_map[i].name) == 0) { + return pgvector_func_map[i].function; + } + } + } + char *fullname; void *lib_handle; void *retval; @@ -196,6 +427,13 @@ load_file(const char *filename, bool restricted) } return; } + if (strcmp(filename, "$libdir/vector") == 0) { + if (!pgvector_loaded) { + _PG_init(); + pgvector_loaded = true; + } + return; + } char *fullname; @@ -231,6 +469,12 @@ lookup_external_function(void *filehandle, const char *funcname) } } + for (int i = 0; pgvector_func_map[i].name != NULL; i++) { + if (strcmp(funcname, pgvector_func_map[i].name) == 0) { + return pgvector_func_map[i].function; + } + } + return dlsym(filehandle, funcname); } diff --git a/src/include/extensions/pglite_ext_util.h b/src/include/extensions/pglite_ext_util.h new file mode 100644 index 00000000000..edefe9a6c6a --- /dev/null +++ b/src/include/extensions/pglite_ext_util.h @@ -0,0 +1,3 @@ +#define PGlite_FUNCTION_INFO_V1(sym) \ + extern Datum sym(FunctionCallInfo fcinfo); \ + extern const Pg_finfo_record *pg_finfo_##sym(void) \ No newline at end of file diff --git a/src/include/extensions/pgvector.h b/src/include/extensions/pgvector.h new file mode 100644 index 00000000000..45eb1678430 --- /dev/null +++ b/src/include/extensions/pgvector.h @@ -0,0 +1,113 @@ +#include "postgres.h" +#include "pglite_ext_util.h" + +extern void _PG_init(void); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(ivfflathandler); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_in); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_out); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_typmod_in); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_recv); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_send); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(array_to_halfvec); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_to_float4); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_to_halfvec); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_l2_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_l2_squared_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_inner_product); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_negative_inner_product); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_cosine_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_spherical_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_l1_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_vector_dims); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_l2_norm); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_l2_normalize); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_add); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_sub); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_mul); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_concat); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_binary_quantize); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_subvector); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_lt); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_le); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_eq); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_ne); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_ge); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_gt); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_cmp); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_accum); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_avg); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_to_halfvec); +PGDLLEXPORT Datum l2_normalize(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum halfvec_l2_normalize(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum sparsevec_l2_normalize(PG_FUNCTION_ARGS); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(ivfflat_halfvec_support); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(ivfflat_bit_support); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(hnswhandler); +PGDLLEXPORT Datum l2_normalize(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum halfvec_l2_normalize(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum sparsevec_l2_normalize(PG_FUNCTION_ARGS); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(hnsw_halfvec_support); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(hnsw_bit_support); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(hnsw_sparsevec_support); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_in); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_out); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_typmod_in); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_recv); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_send); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_to_sparsevec); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_to_sparsevec); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_l2_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_l2_squared_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_inner_product); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_negative_inner_product); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_cosine_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_l1_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_l2_norm); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_l2_normalize); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_lt); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_le); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_eq); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_ne); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_ge); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_gt); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_cmp); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(hamming_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(jaccard_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_in); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_out); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_typmod_in); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_recv); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_send); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(array_to_vector); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_to_float4); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(halfvec_to_vector); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(l2_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_l2_squared_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(inner_product); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_negative_inner_product); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(cosine_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_spherical_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(l1_distance); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_dims); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_norm); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(l2_normalize); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_add); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_sub); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_mul); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_concat); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(binary_quantize); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(subvector); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_lt); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_le); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_eq); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_ne); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_ge); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_gt); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_cmp); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_accum); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_combine); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(vector_avg); +PGDLLEXPORT PGlite_FUNCTION_INFO_V1(sparsevec_to_vector);