Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/vec1/test/vec1stream2.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / vec1 / test / vec1stream2.test` 87 lines ยท 2178 bytes Raw Blame History 1 # 2026-03-14 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 14 source [file join [file dirname [info script]] vec1_common.tcl] 15 set testprefix vec1stream2 16 vec1_load db 17 18 19 do_execsql_test 1.0 { 20 CREATE VIRTUAL TABLE t1 USING vec1(v); 21 WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000 ) 22 INSERT INTO t1 SELECT rvec(16, i) FROM s; 23 INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"flat"}'); 24 } 25 26 foreach {tn2 idx} { 27 1 { 28 INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"flat"}'); 29 } 30 2 { 31 INSERT INTO t1(cmd, arg) VALUES('rebuild', ( 32 SELECT vec1_train(v, '{nbucket:8}') FROM t1 33 )); 34 SELECT vec1_config('nprobe', 2); 35 } 36 3 { 37 INSERT INTO t1(cmd, arg) VALUES('rebuild', ( 38 SELECT vec1_train(v, '{nbucket:8, codesize:4}') FROM t1 39 )); 40 SELECT vec1_config('nprobe', 4); 41 } 42 } { 43 foreach {tn iVec} { 44 1 498753 45 2 722456 46 3 462190 47 4 981077 48 5 606275 49 6 239435 50 7 508863 51 8 795393 52 9 163905 53 10 697229 54 } { 55 db eval $idx 56 57 for {set nRes 2} {$nRes < 100} {incr nRes 3} { 58 set expect [db eval { SELECT rowid FROM t1( rvec(16, $iVec), $nRes ) }] 59 60 if {$nRes>[llength $expect]} break 61 62 do_test 1.$tn2.$tn.$nRes.1 { 63 set J "{K:$nRes, streaming:1}" 64 set all [db eval { SELECT rowid FROM t1( rvec(16, $iVec), $J) }] 65 lrange $all 0 [expr $nRes-1] 66 } $expect 67 68 set expect [db eval { SELECT rowid FROM t1 ORDER BY 1 }] 69 70 do_test 1.$tn2.$tn.$nRes.2 { 71 set J "{K:$nRes, streaming:1}" 72 set all [db eval { SELECT rowid FROM t1( rvec(16, $iVec), $J) }] 73 lsort -integer $all 74 } $expect 75 76 do_test 1.$tn2.$tn.$nRes.3 { 77 set J "{K:$nRes, streaming:1, nprobe_slack:0.2}" 78 set all [db eval { SELECT rowid FROM t1( rvec(16, $iVec), $J) }] 79 lsort -integer $all 80 } $expect 81 } 82 } 83 } 84 85 86 finish_test 87