interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / vec1 / test / vec1ivf.test

63 lines · 1413 bytes Raw Blame History
1# 2026-01-17
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12#
13
14source [file join [file dirname [info script]] vec1_common.tcl]
15set testprefix vec1flat
16vec1_load db
17
18
19do_execsql_test 1.0 {
20 CREATE VIRTUAL TABLE v1 USING vec1(v);
21 WITH s(i) AS (
22 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000
23 )
24 INSERT INTO v1(v) SELECT random_vector(32) FROM s;
25 INSERT INTO v1(cmd, arg) VALUES('rebuild', (
26 SELECT vec1_train(v, '{nbucket:24, codesize:0}') FROM v1
27 ));
28}
29
30db close
31sqlite3 db test.db
32vec1_load db
33
34do_execsql_test 1.1 {
35 SELECT length(v) FROM v1 LIMIT 1
36} {128}
37
38#-------------------------------------------------------------------------
39reset_db
40vec1_load db
41
42do_execsql_test 2.0 {
43 CREATE VIRTUAL TABLE v2 USING vec1(v);
44 WITH s(i) AS (
45 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000
46 )
47 INSERT INTO v2(v) SELECT random_vector(7) FROM s;
48}
49
50breakpoint
51do_execsql_test 2.1 {
52 INSERT INTO v2(cmd, arg) VALUES('rebuild', (
53 SELECT vec1_train(v, '{nbucket:24, codesize:0}') FROM v2
54 ));
55}
56
57set v [db one { SELECT v FROM v2 WHERE rowid = 499 }]
58
59do_execsql_test 2.1 {
60}
61
62finish_test
63