should be it
This commit is contained in:
43
external/duckdb/test/sql/function/array/array_distance.test
vendored
Normal file
43
external/duckdb/test/sql/function/array/array_distance.test
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# name: test/sql/function/array/array_distance.test
|
||||
# group: [array]
|
||||
|
||||
foreach type FLOAT
|
||||
|
||||
query I
|
||||
SELECT array_distance([1, 2, 3]::${type}[3], [1, 2, 3]::${type}[3]);
|
||||
----
|
||||
0.0
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE arrays (l ${type}[3]);
|
||||
|
||||
statement ok
|
||||
INSERT INTO arrays VALUES ([1, 2, 3]), ([1, 2, 4]), ([7, 8, 9]), ([-1, -2, -3]), (NULL);
|
||||
|
||||
query I
|
||||
SELECT array_distance(l, [1, 2, 3]::${type}[3]) FROM arrays;
|
||||
----
|
||||
0.0
|
||||
1.0
|
||||
10.392304
|
||||
7.483315
|
||||
NULL
|
||||
|
||||
|
||||
statement error
|
||||
SELECT array_distance([1, NULL, 3]::${type}[3], [1, 2, 3]::${type}[3]);
|
||||
----
|
||||
left argument can not contain NULL values
|
||||
|
||||
statement error
|
||||
SELECT array_distance([1, 2, 3]::${type}[3], [1, NULL, 3]::${type}[3]);
|
||||
----
|
||||
right argument can not contain NULL values
|
||||
|
||||
statement error
|
||||
SELECT array_distance([1, 2, 3]::${type}[3], [1, 2, 3, 4]::${type}[4]);
|
||||
----
|
||||
array_distance: Array arguments must be of the same size
|
||||
|
||||
|
||||
endloop
|
||||
Reference in New Issue
Block a user