From 17b43ca721c48190085b3b930e87960f7a61474f Mon Sep 17 00:00:00 2001 From: Maksim Kita Date: Tue, 8 Dec 2020 13:54:33 +0300 Subject: [PATCH] Fixed tests --- src/Functions/FunctionsConversion.h | 2 +- .../01556_accurate_cast_or_null.reference | 10 ++++++++++ .../0_stateless/01556_accurate_cast_or_null.sql | 12 ++++++++++++ .../01581_to_int256_uint256_inf_nan.reference | 6 ------ .../0_stateless/01581_to_int256_uint256_inf_nan.sql | 10 ---------- .../0_stateless/01581_to_int_inf_nan.reference | 0 tests/queries/0_stateless/01581_to_int_inf_nan.sql | 10 ++++++++++ 7 files changed, 33 insertions(+), 17 deletions(-) delete mode 100644 tests/queries/0_stateless/01581_to_int256_uint256_inf_nan.reference delete mode 100644 tests/queries/0_stateless/01581_to_int256_uint256_inf_nan.sql create mode 100644 tests/queries/0_stateless/01581_to_int_inf_nan.reference create mode 100644 tests/queries/0_stateless/01581_to_int_inf_nan.sql diff --git a/src/Functions/FunctionsConversion.h b/src/Functions/FunctionsConversion.h index 4e8725ef364..82a3772bc8c 100644 --- a/src/Functions/FunctionsConversion.h +++ b/src/Functions/FunctionsConversion.h @@ -226,7 +226,7 @@ struct ConvertImpl { if constexpr (std::is_same_v) { - vec_null_map_to[i] = true; + (*vec_null_map_to)[i] = true; continue; } else diff --git a/tests/queries/0_stateless/01556_accurate_cast_or_null.reference b/tests/queries/0_stateless/01556_accurate_cast_or_null.reference index 93254968e76..4287c755c3f 100644 --- a/tests/queries/0_stateless/01556_accurate_cast_or_null.reference +++ b/tests/queries/0_stateless/01556_accurate_cast_or_null.reference @@ -18,3 +18,13 @@ 1.000000000 \N \N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N diff --git a/tests/queries/0_stateless/01556_accurate_cast_or_null.sql b/tests/queries/0_stateless/01556_accurate_cast_or_null.sql index efde3bf8284..b11ed5939fa 100644 --- a/tests/queries/0_stateless/01556_accurate_cast_or_null.sql +++ b/tests/queries/0_stateless/01556_accurate_cast_or_null.sql @@ -21,3 +21,15 @@ SELECT accurateCastOrNull(1, 'Decimal32(9)'); SELECT accurateCastOrNull(-10, 'Decimal32(9)'); SELECT accurateCastOrNull('123', 'FixedString(2)'); + +SELECT accurateCastOrNull(inf, 'Int64'); +SELECT accurateCastOrNull(inf, 'Int128'); +SELECT accurateCastOrNull(inf, 'Int256'); +SELECT accurateCastOrNull(nan, 'Int64'); +SELECT accurateCastOrNull(nan, 'Int128'); +SELECT accurateCastOrNull(nan, 'Int256'); + +SELECT accurateCastOrNull(inf, 'UInt64'); +SELECT accurateCastOrNull(inf, 'UInt256'); +SELECT accurateCastOrNull(nan, 'UInt64'); +SELECT accurateCastOrNull(nan, 'UInt256'); diff --git a/tests/queries/0_stateless/01581_to_int256_uint256_inf_nan.reference b/tests/queries/0_stateless/01581_to_int256_uint256_inf_nan.reference deleted file mode 100644 index 37883cc6c47..00000000000 --- a/tests/queries/0_stateless/01581_to_int256_uint256_inf_nan.reference +++ /dev/null @@ -1,6 +0,0 @@ --9223372036854775808 -170141183460469231731687303715884105727 --9223372036854775808 -170141183460469231731687303715884105727 -0 -0 diff --git a/tests/queries/0_stateless/01581_to_int256_uint256_inf_nan.sql b/tests/queries/0_stateless/01581_to_int256_uint256_inf_nan.sql deleted file mode 100644 index b28fc80774f..00000000000 --- a/tests/queries/0_stateless/01581_to_int256_uint256_inf_nan.sql +++ /dev/null @@ -1,10 +0,0 @@ -SELECT toInt64(inf); -SELECT toInt128(inf); -SELECT toInt256(inf); -- { serverError 48 } -SELECT toInt64(nan); -SELECT toInt128(nan); -SELECT toInt256(nan); -- { serverError 48 } -SELECT toUInt64(inf); -SELECT toUInt256(inf); -- { serverError 48 } -SELECT toUInt64(nan); -SELECT toUInt256(nan); -- { serverError 48 } diff --git a/tests/queries/0_stateless/01581_to_int_inf_nan.reference b/tests/queries/0_stateless/01581_to_int_inf_nan.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/01581_to_int_inf_nan.sql b/tests/queries/0_stateless/01581_to_int_inf_nan.sql new file mode 100644 index 00000000000..4959b4d61e9 --- /dev/null +++ b/tests/queries/0_stateless/01581_to_int_inf_nan.sql @@ -0,0 +1,10 @@ +SELECT toInt64(inf); -- { serverError 70 } +SELECT toInt128(inf); -- { serverError 70 } +SELECT toInt256(inf); -- { serverError 70 } +SELECT toInt64(nan); -- { serverError 70 } +SELECT toInt128(nan); -- { serverError 70 } +SELECT toInt256(nan); -- { serverError 70 } +SELECT toUInt64(inf); -- { serverError 70 } +SELECT toUInt256(inf); -- { serverError 70 } +SELECT toUInt64(nan); -- { serverError 70 } +SELECT toUInt256(nan); -- { serverError 70 }