Repository navigation
Expand file tree
/
Copy pathvec1stream2.test
More file actions
87 lines (74 loc) · 2.13 KB
/
Copy pathvec1stream2.test
File metadata and controls
87 lines (74 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# 2026-03-14
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
#
source [file join [file dirname [info script]] vec1_common.tcl]
set testprefix vec1stream2
vec1_load db
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE t1 USING vec1(v);
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000 )
INSERT INTO t1 SELECT rvec(16, i) FROM s;
INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"flat"}');
}
foreach {tn2 idx} {
1 {
INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"flat"}');
}
2 {
INSERT INTO t1(cmd, arg) VALUES('rebuild', (
SELECT vec1_train(v, '{nbucket:8}') FROM t1
));
SELECT vec1_config('nprobe', 2);
}
3 {
INSERT INTO t1(cmd, arg) VALUES('rebuild', (
SELECT vec1_train(v, '{nbucket:8, codesize:4}') FROM t1
));
SELECT vec1_config('nprobe', 4);
}
} {
foreach {tn iVec} {
1 498753
2 722456
3 462190
4 981077
5 606275
6 239435
7 508863
8 795393
9 163905
10 697229
} {
db eval $idx
for {set nRes 2} {$nRes < 100} {incr nRes 3} {
set expect [db eval { SELECT rowid FROM t1( rvec(16, $iVec), $nRes ) }]
if {$nRes>[llength $expect]} break
do_test 1.$tn2.$tn.$nRes.1 {
set J "{K:$nRes, streaming:1}"
set all [db eval { SELECT rowid FROM t1( rvec(16, $iVec), $J) }]
lrange $all 0 [expr $nRes-1]
} $expect
set expect [db eval { SELECT rowid FROM t1 ORDER BY 1 }]
do_test 1.$tn2.$tn.$nRes.2 {
set J "{K:$nRes, streaming:1}"
set all [db eval { SELECT rowid FROM t1( rvec(16, $iVec), $J) }]
lsort -integer $all
} $expect
do_test 1.$tn2.$tn.$nRes.3 {
set J "{K:$nRes, streaming:1, nprobe_slack:0.2}"
set all [db eval { SELECT rowid FROM t1( rvec(16, $iVec), $J) }]
lsort -integer $all
} $expect
}
}
}
finish_test