diff --git a/cpp-ch/local-engine/Functions/SparkFunctionHashingExtended.h b/cpp-ch/local-engine/Functions/SparkFunctionHashingExtended.h index 82d678aa2a4e..57bf00ba9904 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionHashingExtended.h +++ b/cpp-ch/local-engine/Functions/SparkFunctionHashingExtended.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace DB { @@ -200,14 +201,14 @@ class SparkFunctionAnyHash : public IFunction { if constexpr (std::is_same_v) { - if (n == -0.0f) [[unlikely]] + if (n == -0.0f || isNaN(n)) [[unlikely]] return applyNumber(0, seed); else return Impl::apply(reinterpret_cast(&n), sizeof(n), seed); } else { - if (n == -0.0) [[unlikely]] + if (n == -0.0 || isNaN(n)) [[unlikely]] return applyNumber(0, seed); else return Impl::apply(reinterpret_cast(&n), sizeof(n), seed);