Debian Codegraph @

mysql-test/suite/mariabackup/vector.result

raw
1 create table t1 (id int auto_increment primary key, v vector(5) not null, vector index (v)) engine=innodb;
2 insert t1 (v) values (Vec_Fromtext('[0.418,0.809,0.823,0.598,0.033]')),
3 (Vec_Fromtext('[0.687,0.789,0.496,0.574,0.917]')),
4 (Vec_Fromtext('[0.333,0.962,0.467,0.448,0.475]')),
5 (Vec_Fromtext('[0.822,0.185,0.683,0.211,0.554]')),
6 (Vec_Fromtext('[0.437,0.167,0.077,0.428,0.241]')),
7 (Vec_Fromtext('[0.769,0.926,0.803,0.015,0.589]')),
8 (Vec_Fromtext('[0.493,0.641,0.761,0.942,0.425]')),
9 (Vec_Fromtext('[0.924,0.275,0.054,0.073,0.136]')),
10 (Vec_Fromtext('[0.186,0.696,0.035,0.668,0.847]')),
11 (Vec_Fromtext('[0.415,0.609,0.426,0.988,0.475]'));
12 select id from t1 order by vec_distance_euclidean(v, Vec_FromText('[1,0,0,0,0]')) limit 3;
13 id
14 8
15 5
16 4
17 drop table t1;
18 db.opt
19 t1#i#01.ibd
20 t1.frm
21 t1.ibd
22 # shutdown server
23 # remove datadir
24 # xtrabackup move back
25 # restart
26 show create table t1;
27 Table Create Table
28 t1 CREATE TABLE `t1` (
29 `id` int(11) NOT NULL AUTO_INCREMENT,
30 `v` vector(5) NOT NULL,
31 PRIMARY KEY (`id`),
32 VECTOR KEY `v` (`v`)
33 ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
34 select id, Vec_ToText(v) from t1;
35 id Vec_ToText(v)
36 1 [0.418,0.809,0.823,0.598,0.033]
37 2 [0.687,0.789,0.496,0.574,0.917]
38 3 [0.333,0.962,0.467,0.448,0.475]
39 4 [0.822,0.185,0.683,0.211,0.554]
40 5 [0.437,0.167,0.077,0.428,0.241]
41 6 [0.769,0.926,0.803,0.015,0.589]
42 7 [0.493,0.641,0.761,0.942,0.425]
43 8 [0.924,0.275,0.054,0.073,0.136]
44 9 [0.186,0.696,0.035,0.668,0.847]
45 10 [0.415,0.609,0.426,0.988,0.475]
46 select id from t1 order by vec_distance_euclidean(v, Vec_FromText('[1,0,0,0,0]')) limit 3;
47 id
48 8
49 5
50 4
51 drop table t1;
52 #
53 # MDEV-35258 Mariabackup does not work with MyISAM tables with vector keys
54 #
55 create table t1 (a int, v vector(1) not null, vector(v)) engine=MyISAM;
56 insert into t1 values (1,0x31313131),(2,0x32323232);
57 drop table t1;
58 db.opt
59 t1#i#00.MYD
60 t1#i#00.MYI
61 t1.MYD
62 t1.MYI
63 t1.frm
64 # shutdown server
65 # remove datadir
66 # xtrabackup move back
67 # restart
68 show create table t1;
69 Table Create Table
70 t1 CREATE TABLE `t1` (
71 `a` int(11) DEFAULT NULL,
72 `v` vector(1) NOT NULL,
73 VECTOR KEY `v` (`v`)
74 ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
75 select * from t1 order by vec_distance_euclidean(v, 0x30303030) limit 1;
76 a v
77 1 1111
78 drop table t1;