mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 01:04:19 +01:00
170 lines
6.2 KiB
Text
170 lines
6.2 KiB
Text
create table t1 (id int auto_increment primary key, v vector(5) not null, vector index (v));
|
||
insert t1 (v) values (x'e360d63ebe554f3fcdbc523f4522193f5236083d'),
|
||
(x'f511303f72224a3fdd05fe3eb22a133ffae86a3f'),
|
||
(x'f09baa3ea172763f123def3e0c7fe53e288bf33e'),
|
||
(x'b97a523f2a193e3eb4f62e3f2d23583e9dd60d3f'),
|
||
(x'f7c5df3e984b2b3e65e59d3d7376db3eac63773e'),
|
||
(x'de01453ffa486d3f10aa4d3fdd66813c71cb163f'),
|
||
(x'76edfc3e4b57243f10f8423fb158713f020bda3e'),
|
||
(x'56926c3fdf098d3e2c8c5e3d1ad4953daa9d0b3e'),
|
||
(x'7b713f3e5258323f80d1113d673b2b3f66e3583f'),
|
||
(x'6ca1d43e9df91b3fe580da3e1c247d3f147cf33e');
|
||
select vec_totext(x'aabbcc');
|
||
vec_totext(x'aabbcc')
|
||
NULL
|
||
Warnings:
|
||
Warning 4204 Invalid binary vector format. Must use IEEE standard float representation in little-endian format. Use VEC_FromText() to generate it.
|
||
select vec_totext(x'0000f07f');
|
||
vec_totext(x'0000f07f')
|
||
[NaN]
|
||
select vec_totext(x'0000f0ff');
|
||
vec_totext(x'0000f0ff')
|
||
[NaN]
|
||
select vec_totext(x'0000807f');
|
||
vec_totext(x'0000807f')
|
||
[Inf]
|
||
select vec_totext(x'000080ff');
|
||
vec_totext(x'000080ff')
|
||
[-Inf]
|
||
select hex(vec_fromtext('["a"]'));
|
||
hex(vec_fromtext('["a"]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 4 for '["a"]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[]'));
|
||
hex(vec_fromtext('[]'))
|
||
|
||
select hex(vec_fromtext('["a"]'));
|
||
hex(vec_fromtext('["a"]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 4 for '["a"]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[{"a": "b"}]'));
|
||
hex(vec_fromtext('[{"a": "b"}]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 2 for '[{"a": "b"}]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[null]'));
|
||
hex(vec_fromtext('[null]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 5 for '[null]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[1, null]'));
|
||
hex(vec_fromtext('[1, null]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 8 for '[1, null]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[1, ["a"]]'));
|
||
hex(vec_fromtext('[1, ["a"]]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 5 for '[1, ["a"]]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[1, [2]]'));
|
||
hex(vec_fromtext('[1, [2]]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 5 for '[1, [2]]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('{"a":"b"}'));
|
||
hex(vec_fromtext('{"a":"b"}'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 1 for '{"a":"b"}'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[1, 2, "z", 3]'));
|
||
hex(vec_fromtext('[1, 2, "z", 3]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 10 for '[1, 2, "z", 3]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[1, 2, 3'));
|
||
hex(vec_fromtext('[1, 2, 3'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 8 for '[1, 2, 3'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('1, 2, 3]'));
|
||
hex(vec_fromtext('1, 2, 3]'))
|
||
NULL
|
||
Warnings:
|
||
Warning 4205 Invalid vector format at offset: 1 for '1, 2, 3]'. Must be a valid JSON array of numbers.
|
||
select hex(vec_fromtext('[]'));
|
||
hex(vec_fromtext('[]'))
|
||
|
||
select vec_totext(x'');
|
||
vec_totext(x'')
|
||
[]
|
||
select id, vec_totext(t1.v) as a, vec_totext(vec_fromtext(vec_totext(t1.v))) as b,
|
||
vec_distance_euclidean(t1.v, vec_fromtext(vec_totext(t1.v))) < 0.000001 as c
|
||
from t1;
|
||
id a b c
|
||
1 [0.418708,0.809902,0.823193,0.598179,0.0332549] [0.418708,0.809902,0.823193,0.598179,0.0332549] 1
|
||
2 [0.687774,0.789588,0.496138,0.57487,0.917617] [0.687774,0.789588,0.496138,0.57487,0.917617] 1
|
||
3 [0.333221,0.962687,0.467263,0.448235,0.475671] [0.333221,0.962687,0.467263,0.448235,0.475671] 1
|
||
4 [0.822185,0.185643,0.683452,0.211072,0.554056] [0.822185,0.185643,0.683452,0.211072,0.554056] 1
|
||
5 [0.437057,0.167281,0.0770977,0.428638,0.241591] [0.437057,0.167281,0.0770977,0.428638,0.241591] 1
|
||
6 [0.76956,0.926895,0.803376,0.0157961,0.589042] [0.76956,0.926895,0.803376,0.0157961,0.589042] 1
|
||
7 [0.493999,0.641957,0.761598,0.94276,0.425865] [0.493999,0.641957,0.761598,0.94276,0.425865] 1
|
||
8 [0.924108,0.275466,0.0543329,0.0731585,0.136344] [0.924108,0.275466,0.0543329,0.0731585,0.136344] 1
|
||
9 [0.186956,0.69666,0.0356002,0.668875,0.84722] [0.186956,0.69666,0.0356002,0.668875,0.84722] 1
|
||
10 [0.415294,0.609278,0.426765,0.988832,0.475556] [0.415294,0.609278,0.426765,0.988832,0.475556] 1
|
||
drop table t1;
|
||
set collation_connection=utf16_general_ci;
|
||
set character_set_results=utf16;
|
||
select hex(vec_fromtext('[1,2,3]'));
|
||
|
||
|