mariadb/mysql-test/main/vector_funcs.result
2024-12-02 17:51:17 +02:00

170 lines
6.2 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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]'));
0000803F0000004000004040
select vec_totext(x'0000803F0000004000004040FFFFFFFF0000807F000080FF');
[1,2,3,NaN,Inf,-Inf]
set character_set_results=default;
select vec_totext(x'0000803F0000004000004040FFFFFFFF0000807F000080FF');
vec_totext(x'0000803F0000004000004040FFFFFFFF0000807F000080FF')
[1,2,3,NaN,Inf,-Inf]
set names utf8mb4;
create table t1 as select vec_totext(x'55555555') x;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` varchar(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
select * from t1;
x
[1.46602e13]
drop table t1;
#
# MDEV-35212 Server crashes in Item_func_vec_fromtext::val_str upon query from empty table
#
select vec_fromtext(NULL);
vec_fromtext(NULL)
NULL
#
# MDEV-35210 Vector type cannot store values which VEC_FromText produces and VEC_ToText accepts
#
select vec_totext(0x77777777);
vec_totext(0x77777777)
[5.01922e33]
select hex(vec_fromtext('[5.01922e33]'));
hex(vec_fromtext('[5.01922e33]'))
NULL
Warnings:
Warning 1292 Truncated incorrect vector value: '[5.01922e33]'
#
# MDEV-35215 ASAN errors in Item_func_vec_fromtext::val_str upon VEC_FROMTEXT with an invalid argument
#
create table t (v vector(1));
insert into t values (vec_fromtext('[0.93]'));
select vec_fromtext(v) from t;
vec_fromtext(v)
NULL
Warnings:
Warning 4205 Invalid vector format at offset: 1 for '{\0014n?'. Must be a valid JSON array of numbers.
drop table t;
select vec_fromtext(0x00000000);
vec_fromtext(0x00000000)
NULL
Warnings:
Warning 4036 Character disallowed in JSON in argument 1 to function 'VEC_FromText' at position 1
#
# MDEV-35220 Assertion `!item->null_value' failed upon VEC_TOTEXT call
#
select vec_totext(`null`) from (values (null),(0x00000000)) x;
vec_totext(`null`)
NULL
[0]