mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 13:22:57 +00:00
refactor: rewrite some UDFs to DataFusion style (part 2) (#6967)
* refactor: rewrite some UDFs to DataFusion style (part 2) Signed-off-by: luofucong <luofc@foxmail.com> * deal with vector UDFs `(scalar, scalar)` situation, and try getting the scalar value reference everytime Signed-off-by: luofucong <luofc@foxmail.com> * reduce some vector literal parsing Signed-off-by: luofucong <luofc@foxmail.com> * fix ci Signed-off-by: luofucong <luofc@foxmail.com> --------- Signed-off-by: luofucong <luofc@foxmail.com>
This commit is contained in:
@@ -76,13 +76,7 @@ SELECT CLAMP(0.5, 0, 1);
|
||||
|
||||
SELECT CLAMP(10, 1, 0);
|
||||
|
||||
Error: 3001(EngineExecuteQuery), Invalid function args: The second arg should be less than or equal to the third arg, have: PrimitiveVector { array: PrimitiveArray<Int64>
|
||||
[
|
||||
1,
|
||||
] }, PrimitiveVector { array: PrimitiveArray<Int64>
|
||||
[
|
||||
0,
|
||||
] }
|
||||
Error: 3001(EngineExecuteQuery), Execution error: min '1' > max '0'
|
||||
|
||||
SELECT CLAMP_MIN(10, 12);
|
||||
|
||||
|
||||
@@ -240,11 +240,11 @@ SELECT geohash(37.76938, -122.3889, 11);
|
||||
|
||||
SELECT geohash(37.76938, -122.3889, 100);
|
||||
|
||||
Error: 3001(EngineExecuteQuery), Invalid geohash resolution 100, expect value: [1, 12]
|
||||
Error: 3001(EngineExecuteQuery), Execution error: Invalid geohash resolution 100, valid value range: [1, 12]
|
||||
|
||||
SELECT geohash(37.76938, -122.3889, -1);
|
||||
|
||||
Error: 3001(EngineExecuteQuery), Invalid geohash resolution -1, expect value: [1, 12]
|
||||
Error: 3001(EngineExecuteQuery), Cast error: Can't cast value -1 to type UInt8
|
||||
|
||||
SELECT geohash(37.76938, -122.3889, 11::Int8);
|
||||
|
||||
|
||||
@@ -375,17 +375,7 @@ TQL EVAL (0, 15, '5s') clamp(host, 6 - 6, 6 + 6);
|
||||
-- SQLNESS SORT_RESULT 3 1
|
||||
TQL EVAL (0, 15, '5s') clamp(host, 12, 0);
|
||||
|
||||
Error: 3001(EngineExecuteQuery), Invalid function args: The second arg should be less than or equal to the third arg, have: PrimitiveVector { array: PrimitiveArray<Float64>
|
||||
[
|
||||
12.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
12.0,
|
||||
12.0,
|
||||
[
|
||||
] }, PrimitiveVector { array: PrimitiveArray<Float64>
|
||||
] }
|
||||
Error: 3001(EngineExecuteQuery), Execution error: min '12' > max '0'
|
||||
|
||||
-- SQLNESS SORT_RESULT 3 1
|
||||
TQL EVAL (0, 15, '5s') clamp(host{host="host1"}, -1, 6);
|
||||
|
||||
@@ -99,7 +99,7 @@ SELECT round(vec_cos_distance(v, v), 2) FROM t;
|
||||
-- Unexpected dimension --
|
||||
SELECT vec_cos_distance(v, '[1.0]') FROM t;
|
||||
|
||||
Error: 3001(EngineExecuteQuery), Invalid function args: The length of the vectors must match to calculate distance, have: 3 vs 1
|
||||
Error: 3001(EngineExecuteQuery), Execution error: vectors length not match: vec_cos_distance
|
||||
|
||||
-- Invalid type --
|
||||
SELECT vec_cos_distance(v, 1.0) FROM t;
|
||||
@@ -174,7 +174,7 @@ SELECT round(vec_l2sq_distance(v, v), 2) FROM t;
|
||||
-- Unexpected dimension --
|
||||
SELECT vec_l2sq_distance(v, '[1.0]') FROM t;
|
||||
|
||||
Error: 3001(EngineExecuteQuery), Invalid function args: The length of the vectors must match to calculate distance, have: 3 vs 1
|
||||
Error: 3001(EngineExecuteQuery), Execution error: vectors length not match: vec_l2sq_distance
|
||||
|
||||
-- Invalid type --
|
||||
SELECT vec_l2sq_distance(v, 1.0) FROM t;
|
||||
@@ -249,7 +249,7 @@ SELECT round(vec_dot_product(v, v), 2) FROM t;
|
||||
-- Unexpected dimension --
|
||||
SELECT vec_dot_product(v, '[1.0]') FROM t;
|
||||
|
||||
Error: 3001(EngineExecuteQuery), Invalid function args: The length of the vectors must match to calculate distance, have: 3 vs 1
|
||||
Error: 3001(EngineExecuteQuery), Execution error: vectors length not match: vec_dot_product
|
||||
|
||||
-- Invalid type --
|
||||
SELECT vec_dot_product(v, 1.0) FROM t;
|
||||
|
||||
Reference in New Issue
Block a user