Closed LHQ-MO closed 3 hours ago
@aunjgr vector related, pls kindly take a look, thx
没有自动把 string("[1,2,3]") cast 成vecf32。应该加一下就好了
fixed
测试步骤:
main
mysql> select git_version();
+---------------+
| git_version() |
+---------------+
| e08cd95ce |
+---------------+
1 row in set (0.00 sec)
mysql -h 127.0.0.1 -P 6001 -udump -p111
create database test;
use test;
CREATE TABLE `vector_test` (
id INT PRIMARY KEY AUTO_INCREMENT,
vector vecf32(3)
);
INSERT INTO `vector_test` VALUES(1,"[1,2,4]");
INSERT INTO `vector_test` VALUES(2,"[3,2,4]");
运行脚本
SET @v = "[1,2,4]";
SELECT id, cosine_similarity(vector, @v) from vector_test;
结论:main测试通过
2.0-dev
mysql> select git_version();
+---------------+
| git_version() |
+---------------+
| 31cdef2f9 |
+---------------+
1 row in set (0.00 sec)
运行脚本:
结论:2.0-dev测试通过
Is there an existing issue for the same bug?
Branch Name
v2.0.0
Commit ID
0bbda66
Other Environment Information
Actual Behavior
When using vector with text format as a parameter
It returns with error like:
Expected Behavior
It's expected to work properly like
Steps to Reproduce
Create a table and insert data:
Then do a query with golang:
Additional information
A walkaround for this issue is using
CAST
with the parameter like this:BTW variables in SQL also encounter this: