This commit is contained in:
Alexey Milovidov 2024-11-13 02:50:18 +01:00
parent a4c26e9c79
commit 8a724cd2fa
5 changed files with 16 additions and 11 deletions

View File

@ -311,11 +311,3 @@ constexpr inline auto operator/(BFloat16 a, T b)
{ {
return Float32(a) / b; return Float32(a) / b;
} }
namespace std
{
inline constexpr bool isfinite(BFloat16 x) { return x.isFinite(); }
inline constexpr bool isnan(BFloat16 x) { return x.isNaN(); }
inline constexpr bool signbit(BFloat16 x) { return x.signBit(); }
}

View File

@ -120,7 +120,7 @@ struct ColumnVector<T>::less_stable
if constexpr (is_floating_point<T>) if constexpr (is_floating_point<T>)
{ {
if (unlikely(std::isnan(parent.data[lhs]) && std::isnan(parent.data[rhs]))) if (unlikely(isNaN(parent.data[lhs]) && isNaN(parent.data[rhs])))
{ {
return lhs < rhs; return lhs < rhs;
} }
@ -152,7 +152,7 @@ struct ColumnVector<T>::greater_stable
if constexpr (is_floating_point<T>) if constexpr (is_floating_point<T>)
{ {
if (unlikely(std::isnan(parent.data[lhs]) && std::isnan(parent.data[rhs]))) if (unlikely(isNaN(parent.data[lhs]) && isNaN(parent.data[rhs])))
{ {
return lhs < rhs; return lhs < rhs;
} }

View File

@ -46,3 +46,12 @@ T NaNOrZero()
else else
return {}; return {};
} }
template <typename T>
bool signBit(T x)
{
if constexpr (is_floating_point<T>)
return DecomposedFloat(x).isNegative();
else
return x < 0;
}

View File

@ -551,7 +551,7 @@ void writeJSONNumber(T x, WriteBuffer & ostr, const FormatSettings & settings)
{ {
if constexpr (is_floating_point<T>) if constexpr (is_floating_point<T>)
{ {
if (std::signbit(x)) if (signBit(x))
{ {
if (isNaN(x)) if (isNaN(x))
writeCString("-nan", ostr); writeCString("-nan", ostr);

View File

@ -1,12 +1,16 @@
#pragma once #pragma once
#include <AggregateFunctions/IAggregateFunction_fwd.h> #include <AggregateFunctions/IAggregateFunction_fwd.h>
#include <Common/HashTable/FixedHashMap.h> #include <Common/HashTable/FixedHashMap.h>
#include <Common/HashTable/StringHashMap.h> #include <Common/HashTable/StringHashMap.h>
#include <Common/HashTable/TwoLevelHashMap.h> #include <Common/HashTable/TwoLevelHashMap.h>
#include <Common/HashTable/TwoLevelStringHashMap.h> #include <Common/HashTable/TwoLevelStringHashMap.h>
namespace DB namespace DB
{ {
/** Different data structures that can be used for aggregation /** Different data structures that can be used for aggregation
* For efficiency, the aggregation data itself is put into the pool. * For efficiency, the aggregation data itself is put into the pool.
* Data and pool ownership (states of aggregate functions) * Data and pool ownership (states of aggregate functions)