fix fuzzer

This commit is contained in:
Nikita Mikhaylov 2021-07-09 16:29:23 +00:00
parent 625576796c
commit fa816ab19c
2 changed files with 7 additions and 2 deletions

View File

@ -79,10 +79,13 @@ public:
const Float64 lat = col_lat->getFloat64(row);
if (isNaN(lon) || isNaN(lat))
throw Exception(
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
"Arguments must not be NaN");
if (!(isFinite(lon) && isFinite(lat)))
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
"Arguments must not be infinite");
/// S2 acceptes point as (latitude, longitude)
S2LatLng lat_lng = S2LatLng::FromDegrees(lat, lon);
S2CellId id(lat_lng);

View File

@ -43,6 +43,8 @@ SELECT s2ToGeo(toUInt64(-1));
SELECT s2ToGeo(nan); -- { serverError 43 }
SELECT geoToS2(toFloat64(toUInt64(-1)), toFloat64(toUInt64(-1)));
SELECT geoToS2(nan, nan); -- { serverError 43 }
SELECT geoToS2(-inf, 1.1754943508222875e-38); -- { serverError 43 }
DROP TABLE IF EXISTS s2_indexes;