mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-27 14:16:18 +00:00
feat: add vec_subvector function (#5683)
* feat: add vec_subvector function * change datatype of arg1 and arg2 from u64 to i64 * add sqlness test * improve description comments
This commit is contained in:
@@ -99,3 +99,26 @@ FROM (
|
||||
UNION ALL
|
||||
SELECT '[7.0, 8.0, 9.0, 10.0]' AS v
|
||||
) Order By vec_dim(v) ASC;
|
||||
|
||||
SELECT vec_to_string(vec_subvector('[1.0,2.0,3.0,4.0,5.0]', 0, 3));
|
||||
|
||||
SELECT vec_to_string(vec_subvector('[1.0,2.0,3.0,4.0,5.0]', 5, 5));
|
||||
|
||||
SELECT v, vec_to_string(vec_subvector(v, 3, 5))
|
||||
FROM (
|
||||
SELECT '[1.0, 2.0, 3.0, 4.0, 5.0]' AS v
|
||||
UNION ALL
|
||||
SELECT '[-1.0, -2.0, -3.0, -4.0, -5.0, -6.0]' AS v
|
||||
UNION ALL
|
||||
SELECT '[4.0, 5.0, 6.0, 10, -8, 100]' AS v
|
||||
) ORDER BY v;
|
||||
|
||||
SELECT vec_to_string(vec_subvector(v, 0, 5))
|
||||
FROM (
|
||||
SELECT '[1.1, 2.2, 3.3, 4.4, 5.5]' AS v
|
||||
UNION ALL
|
||||
SELECT '[-1.1, -2.1, -3.1, -4.1, -5.1, -6.1]' AS v
|
||||
UNION ALL
|
||||
SELECT '[4.0, 5.0, 6.0, 10, -8, 100]' AS v
|
||||
) ORDER BY v;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user