From e95044f7137f95ba1daafadb81ba43bb320a411d Mon Sep 17 00:00:00 2001 From: Suzy Wang Date: Thu, 13 Apr 2023 13:51:57 -0700 Subject: [PATCH] insert UInt32 Hashvalue in reverse order on big endian machine --- src/AggregateFunctions/UniquesHashSet.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AggregateFunctions/UniquesHashSet.h b/src/AggregateFunctions/UniquesHashSet.h index 075b0897c3a..2abf6ed00d6 100644 --- a/src/AggregateFunctions/UniquesHashSet.h +++ b/src/AggregateFunctions/UniquesHashSet.h @@ -331,7 +331,11 @@ public: void ALWAYS_INLINE insert(Value x) { - HashValue hash_value = hash(x); + HashValue hash_value; + if constexpr (std::endian::native == std::endian::little) + hash_value = hash(x); + else + hash_value = __builtin_bswap32(hash(x)); if (!good(hash_value)) return;