always return Float64

This commit is contained in:
Alexander Gololobov 2022-05-25 16:29:12 +02:00
parent 5df14cd956
commit b065839f44
6 changed files with 40 additions and 31 deletions

View File

@ -145,7 +145,6 @@ public:
case TypeIndex::Int16:
case TypeIndex::Int32:
case TypeIndex::Float32:
return std::make_shared<DataTypeFloat32>();
case TypeIndex::UInt64:
case TypeIndex::Int64:
case TypeIndex::Float64:
@ -164,9 +163,6 @@ public:
{
switch (result_type->getTypeId())
{
case TypeIndex::Float32:
return executeWithResultType<Float32>(arguments, input_rows_count);
break;
case TypeIndex::Float64:
return executeWithResultType<Float64>(arguments, input_rows_count);
break;

View File

@ -102,7 +102,6 @@ public:
case TypeIndex::Int16:
case TypeIndex::Int32:
case TypeIndex::Float32:
return std::make_shared<DataTypeFloat32>();
case TypeIndex::UInt64:
case TypeIndex::Int64:
case TypeIndex::Float64:
@ -125,9 +124,6 @@ public:
switch (result_type->getTypeId())
{
case TypeIndex::Float32:
return executeWithResultType<Float32>(*arr, type, input_rows_count);
break;
case TypeIndex::Float64:
return executeWithResultType<Float64>(*arr, type, input_rows_count);
break;

View File

@ -1,21 +1,22 @@
6
3.7416575
3.7416573867739413
3
0.002585097
0.00258509695694209
\N
nan
0 0 0 0
12
14
21
7.071068
9.165152
12.124355
7.0710678118654755
9.16515138991168
12.12435565298214
2
5
4
0.16847816
0.35846698
0.0741799
0.16847815937970012
0.3584669721282153
0.07417990022744847
6
8
9
@ -28,12 +29,12 @@ nan
2 2 1347.4008312302617
3 1 214.35251339790725
3 2 1342.8856987845243
1 1 218.74643
1 2 1348.2118
2 1 219.28064
2 2 1347.4009
3 1 214.35251
3 2 1342.8857
1 1 218.74642854227358
1 2 1348.2117786164013
2 1 219.28064210048274
2 2 1347.4008312302617
3 1 214.35251339790725
3 2 1342.8856987845243
1 1 218.74642854227358
1 2 1348.2117786164013
2 1 219.28064210048274

View File

@ -6,6 +6,14 @@ SELECT arrayCosineDistance([1, 2, 3], [3, 5, 7]);
SELECT arrayL2Distance([1, 2, 3], NULL);
SELECT arrayCosineDistance([1, 2, 3], [0, 0, 0]);
-- Overflows
WITH CAST([-547274980, 1790553898, 1981517754, 1908431500, 1352428565, -573412550, -552499284, 2096941042], 'Array(Int32)') AS a
SELECT
arrayL1Distance(a,a),
arrayL2Distance(a,a),
arrayLinfDistance(a,a),
arrayCosineDistance(a, a);
DROP TABLE IF EXISTS vec1;
DROP TABLE IF EXISTS vec2;
DROP TABLE IF EXISTS vec2f;

View File

@ -1,17 +1,18 @@
6
7.0710678118654755
2
10803059573 4234902446.7343364 2096941042
1 5
2 2
3 5.196152
4 0
1 11
2 11
3 11
4 11
1 5
2 2
3 5.196152
3 5.196152422706632
4 0
1 11
2 11
3 11
4 11
1 5
2 2
3 5.196152422706632
4 0
1 11
2 11

View File

@ -2,6 +2,13 @@ SELECT arrayL1Norm([1, 2, 3]);
SELECT arrayL2Norm([3., 4., 5.]);
SELECT arrayLinfNorm([0, 0, 2]);
-- Overflows
WITH CAST([-547274980, 1790553898, 1981517754, 1908431500, 1352428565, -573412550, -552499284, 2096941042], 'Array(Int32)') AS a
SELECT
arrayL1Norm(a),
arrayL2Norm(a),
arrayLinfNorm(a);
DROP TABLE IF EXISTS vec1;
DROP TABLE IF EXISTS vec1f;
DROP TABLE IF EXISTS vec1d;