round test queries to prevent float trunc errors

This commit is contained in:
Emmanuel Dias 2024-11-18 20:12:19 -03:00
parent 38bd227047
commit 74e3e798b5
2 changed files with 48 additions and 48 deletions

View File

@ -1,24 +1,24 @@
0.8333333333333333 0.8333333333
0.8333333333333333 0.8333333333
0.8333333333333333 0.8333333333
0.8333333333333333 0.8333333333
0.8333333333333333 0.8333333333
0.8333333333333333 0.8333333333
0.8333333333333333 0.8333333333
0.8333333333333333 0.8333333333
0.8333333333333333 0.8333333333
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.8333333333333333 0.8333333333
0.8055555555555555 0.8055555555
0.5 0.5
0.3666666666666667 0.3666666666
0.29166666666666663 0.2916666666
0.56875 0.56875
0.43333333333333335 0.4333333333
1 1
0 0
0 0
@ -28,6 +28,6 @@
0.5 0.5
1 1
0.5 0.5
0.8333333333333333 0.8333333333
1 1
0.5 0.5

View File

@ -1,40 +1,40 @@
-- type correctness tests -- type correctness tests
select arrayPrAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]); select floor(arrayPrAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]), 10);
select arrayPrAUC([0.1, 0.4, 0.35, 0.8], cast([0, 0, 1, 1] as Array(Int8))); select floor(arrayPrAUC([0.1, 0.4, 0.35, 0.8], cast([0, 0, 1, 1] as Array(Int8))), 10);
select arrayPrAUC([0.1, 0.4, 0.35, 0.8], cast([-1, -1, 1, 1] as Array(Int8))); select floor(arrayPrAUC([0.1, 0.4, 0.35, 0.8], cast([-1, -1, 1, 1] as Array(Int8))), 10);
select arrayPrAUC([0.1, 0.4, 0.35, 0.8], cast(['false', 'false', 'true', 'true'] as Array(Enum8('false' = 0, 'true' = 1)))); select floor(arrayPrAUC([0.1, 0.4, 0.35, 0.8], cast(['false', 'false', 'true', 'true'] as Array(Enum8('false' = 0, 'true' = 1)))), 10);
select arrayPrAUC([0.1, 0.4, 0.35, 0.8], cast(['false', 'false', 'true', 'true'] as Array(Enum8('false' = -1, 'true' = 1)))); select floor(arrayPrAUC([0.1, 0.4, 0.35, 0.8], cast(['false', 'false', 'true', 'true'] as Array(Enum8('false' = -1, 'true' = 1)))), 10);
select arrayPrAUC(cast([10, 40, 35, 80] as Array(UInt8)), [0, 0, 1, 1]); select floor(arrayPrAUC(cast([10, 40, 35, 80] as Array(UInt8)), [0, 0, 1, 1]), 10);
select arrayPrAUC(cast([10, 40, 35, 80] as Array(UInt16)), [0, 0, 1, 1]); select floor(arrayPrAUC(cast([10, 40, 35, 80] as Array(UInt16)), [0, 0, 1, 1]), 10);
select arrayPrAUC(cast([10, 40, 35, 80] as Array(UInt32)), [0, 0, 1, 1]); select floor(arrayPrAUC(cast([10, 40, 35, 80] as Array(UInt32)), [0, 0, 1, 1]), 10);
select arrayPrAUC(cast([10, 40, 35, 80] as Array(UInt64)), [0, 0, 1, 1]); select floor(arrayPrAUC(cast([10, 40, 35, 80] as Array(UInt64)), [0, 0, 1, 1]), 10);
select arrayPrAUC(cast([-10, -40, -35, -80] as Array(Int8)), [0, 0, 1, 1]); select floor(arrayPrAUC(cast([-10, -40, -35, -80] as Array(Int8)), [0, 0, 1, 1]), 10);
select arrayPrAUC(cast([-10, -40, -35, -80] as Array(Int16)), [0, 0, 1, 1]); select floor(arrayPrAUC(cast([-10, -40, -35, -80] as Array(Int16)), [0, 0, 1, 1]), 10);
select arrayPrAUC(cast([-10, -40, -35, -80] as Array(Int32)), [0, 0, 1, 1]); select floor(arrayPrAUC(cast([-10, -40, -35, -80] as Array(Int32)), [0, 0, 1, 1]), 10);
select arrayPrAUC(cast([-10, -40, -35, -80] as Array(Int64)), [0, 0, 1, 1]); select floor(arrayPrAUC(cast([-10, -40, -35, -80] as Array(Int64)), [0, 0, 1, 1]), 10);
select arrayPrAUC(cast([-0.1, -0.4, -0.35, -0.8] as Array(Float32)) , [0, 0, 1, 1]); select floor(arrayPrAUC(cast([-0.1, -0.4, -0.35, -0.8] as Array(Float32)) , [0, 0, 1, 1]), 10);
-- output value correctness test -- output value correctness test
select arrayPrAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]); select floor(arrayPrAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]), 10);
select arrayPrAUC([0.1, 0.4, 0.4, 0.35, 0.8], [0, 0, 1, 1, 1]); select floor(arrayPrAUC([0.1, 0.4, 0.4, 0.35, 0.8], [0, 0, 1, 1, 1]), 10);
select arrayPrAUC([0.1, 0.35, 0.4, 0.8], [1, 0, 1, 0]); select floor(arrayPrAUC([0.1, 0.35, 0.4, 0.8], [1, 0, 1, 0]), 10);
select arrayPrAUC([0.1, 0.35, 0.4, 0.4, 0.8], [1, 0, 1, 0, 0]); select floor(arrayPrAUC([0.1, 0.35, 0.4, 0.4, 0.8], [1, 0, 1, 0, 0]), 10);
select arrayPrAUC([0, 3, 5, 6, 7.5, 8], [1, 0, 1, 0, 0, 0]); select floor(arrayPrAUC([0, 3, 5, 6, 7.5, 8], [1, 0, 1, 0, 0, 0]), 10);
select arrayPrAUC([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1]); select floor(arrayPrAUC([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1]), 10);
select arrayPrAUC([0, 1, 1, 2, 2, 2, 3, 3, 3, 3], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1]); select floor(arrayPrAUC([0, 1, 1, 2, 2, 2, 3, 3, 3, 3], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1]), 10);
-- edge cases -- edge cases
SELECT arrayPrAUC([1], [1]); SELECT floor(arrayPrAUC([1], [1]), 10);
SELECT arrayPrAUC([1], [0]); SELECT floor(arrayPrAUC([1], [0]), 10);
SELECT arrayPrAUC([0], [0]); SELECT floor(arrayPrAUC([0], [0]), 10);
SELECT arrayPrAUC([0], [1]); SELECT floor(arrayPrAUC([0], [1]), 10);
SELECT arrayPrAUC([1, 1], [1, 1]); SELECT floor(arrayPrAUC([1, 1], [1, 1]), 10);
SELECT arrayPrAUC([1, 1], [0, 0]); SELECT floor(arrayPrAUC([1, 1], [0, 0]), 10);
SELECT arrayPrAUC([1, 1], [0, 1]); SELECT floor(arrayPrAUC([1, 1], [0, 1]), 10);
SELECT arrayPrAUC([0, 1], [0, 1]); SELECT floor(arrayPrAUC([0, 1], [0, 1]), 10);
SELECT arrayPrAUC([1, 0], [0, 1]); SELECT floor(arrayPrAUC([1, 0], [0, 1]), 10);
SELECT arrayPrAUC([0, 0, 1], [0, 1, 1]); SELECT floor(arrayPrAUC([0, 0, 1], [0, 1, 1]), 10);
SELECT arrayPrAUC([0, 1, 1], [0, 1, 1]); SELECT floor(arrayPrAUC([0, 1, 1], [0, 1, 1]), 10);
SELECT arrayPrAUC([0, 1, 1], [0, 0, 1]); SELECT floor(arrayPrAUC([0, 1, 1], [0, 0, 1]), 10);
-- negative tests -- negative tests
select arrayPrAUC([], []); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT } select arrayPrAUC([], []); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }