Update tests

This commit is contained in:
Alexey Milovidov 2021-04-11 00:52:42 +03:00
parent 1f2226b9db
commit d369da6643
2 changed files with 5 additions and 4 deletions

View File

@ -185,6 +185,10 @@ public:
/// Conversion of infinite values to integer is undefined. /// Conversion of infinite values to integer is undefined.
throw Exception("Cannot convert infinite value to integer type", ErrorCodes::CANNOT_CONVERT_TYPE); throw Exception("Cannot convert infinite value to integer type", ErrorCodes::CANNOT_CONVERT_TYPE);
} }
else if (x > std::numeric_limits<T>::max() || x < std::numeric_limits<T>::lowest())
{
throw Exception("Cannot convert out of range floating point value to integer type", ErrorCodes::CANNOT_CONVERT_TYPE);
}
} }
if constexpr (std::is_same_v<Decimal256, T>) if constexpr (std::is_same_v<Decimal256, T>)
@ -193,9 +197,6 @@ public:
} }
else else
{ {
if (x > std::numeric_limits<T>::max() || x < std::numeric_limits<T>::lowest())
throw Exception("Cannot convert out of range floating point value to integer type", ErrorCodes::CANNOT_CONVERT_TYPE);
return T(x); return T(x);
} }
} }

View File

@ -12,7 +12,7 @@ SETTINGS index_granularity = 8192;
INSERT INTO t0 VALUES (0, 0); INSERT INTO t0 VALUES (0, 0);
SELECT t0.c1 FROM t0 WHERE NOT (t0.c1 OR (t0.c0 AND -1524532316)); SELECT t0.c1 FROM t0 WHERE NOT (t0.c1 OR (t0.c0 AND -1524532316));
SELECT t0.c1 FROM t0 WHERE NOT (t0.c1 OR (t0.c0 AND -1.0)); SELECT t0.c1 FROM t0 WHERE NOT (t0.c1 OR (t0.c0 AND -1.0)); -- { serverError 70 }
SELECT t0.c1 FROM t0 WHERE NOT (t0.c1 OR (t0.c0 AND inf)); SELECT t0.c1 FROM t0 WHERE NOT (t0.c1 OR (t0.c0 AND inf));
SELECT t0.c1 FROM t0 WHERE NOT (t0.c1 OR (t0.c0 AND nan)); SELECT t0.c1 FROM t0 WHERE NOT (t0.c1 OR (t0.c0 AND nan));