mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Fix error
This commit is contained in:
parent
c41e37fa8e
commit
5c75a7d661
@ -5,8 +5,9 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
|
||||||
/** \brief Returns value `from` converted to type `To` while retaining bit representation.
|
/** Returns value `from` converted to type `To` while retaining bit representation.
|
||||||
* `To` and `From` must satisfy `CopyConstructible`.
|
* `To` and `From` must satisfy `CopyConstructible`.
|
||||||
|
* In contrast to std::bit_cast can cast types of different width.
|
||||||
*/
|
*/
|
||||||
template <typename To, typename From>
|
template <typename To, typename From>
|
||||||
std::decay_t<To> bit_cast(const From & from)
|
std::decay_t<To> bit_cast(const From & from)
|
||||||
@ -15,13 +16,3 @@ std::decay_t<To> bit_cast(const From & from)
|
|||||||
memcpy(static_cast<void*>(&res), &from, std::min(sizeof(res), sizeof(from)));
|
memcpy(static_cast<void*>(&res), &from, std::min(sizeof(res), sizeof(from)));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Returns value `from` converted to type `To` while retaining bit representation.
|
|
||||||
* `To` and `From` must satisfy `CopyConstructible`.
|
|
||||||
*/
|
|
||||||
template <typename To, typename From>
|
|
||||||
std::decay_t<To> safe_bit_cast(const From & from)
|
|
||||||
{
|
|
||||||
static_assert(sizeof(To) == sizeof(From), "bit cast on types of different width");
|
|
||||||
return bit_cast<To, From>(from);
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <base/bit_cast.h>
|
#include <base/bit_cast.h>
|
||||||
|
|
||||||
|
#include <Common/FieldVisitorDump.h>
|
||||||
#include <Common/FieldVisitorConvertToNumber.h>
|
#include <Common/FieldVisitorConvertToNumber.h>
|
||||||
#include <DataTypes/DataTypeArray.h>
|
#include <DataTypes/DataTypeArray.h>
|
||||||
#include <Columns/ColumnString.h>
|
#include <Columns/ColumnString.h>
|
||||||
@ -920,8 +921,7 @@ private:
|
|||||||
ColumnString::Offset current_dst_default_offset = 0;
|
ColumnString::Offset current_dst_default_offset = 0;
|
||||||
for (size_t i = 0; i < size; ++i)
|
for (size_t i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
T key = src[i];
|
const auto * it = table.find(bit_cast<UInt64>(src[i]));
|
||||||
const auto * it = table.find(key);
|
|
||||||
StringRef ref;
|
StringRef ref;
|
||||||
|
|
||||||
if (it)
|
if (it)
|
||||||
@ -1181,6 +1181,8 @@ private:
|
|||||||
if (key.isNull())
|
if (key.isNull())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
std::cerr << applyVisitor(FieldVisitorDump(), key) << ": " << bitCastToUInt64(key) << "\n";
|
||||||
|
|
||||||
const String & str_to = to[i].get<const String &>();
|
const String & str_to = to[i].get<const String &>();
|
||||||
StringRef ref{cache.string_pool.insert(str_to.data(), str_to.size() + 1), str_to.size() + 1};
|
StringRef ref{cache.string_pool.insert(str_to.data(), str_to.size() + 1), str_to.size() + 1};
|
||||||
table[bitCastToUInt64(key)] = ref;
|
table[bitCastToUInt64(key)] = ref;
|
||||||
|
Loading…
Reference in New Issue
Block a user