mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-24 10:40:49 +00:00
Review fixes.
This commit is contained in:
parent
a70a9e5383
commit
1a37afa3d1
@ -293,9 +293,9 @@ void ColumnAggregateFunction::updateWeakHash32(WeakHash32 & hash) const
|
||||
|
||||
auto & hash_data = hash.getData();
|
||||
|
||||
std::vector<UInt8> v;
|
||||
for (size_t i = 0; i < s; ++i)
|
||||
{
|
||||
std::vector<UInt8> v;
|
||||
WriteBufferFromVector<std::vector<UInt8>> wbuf(v);
|
||||
func->serialize(data[i], wbuf);
|
||||
wbuf.finalize();
|
||||
|
@ -77,9 +77,9 @@ void ColumnDecimal<T>::updateWeakHash32(WeakHash32 & hash) const
|
||||
throw Exception("Size of WeakHash32 does not match size of column: column size is " + std::to_string(s) +
|
||||
", hash size is " + std::to_string(hash.getData().size()), ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
const T * begin = &data[0];
|
||||
const T * begin = data.data();
|
||||
const T * end = begin + s;
|
||||
UInt32 * hash_data = &hash.getData()[0];
|
||||
UInt32 * hash_data = hash.getData().data();
|
||||
|
||||
while (begin < end)
|
||||
{
|
||||
|
@ -112,8 +112,8 @@ void ColumnFixedString::updateWeakHash32(WeakHash32 & hash) const
|
||||
throw Exception("Size of WeakHash32 does not match size of column: column size is " + std::to_string(s) +
|
||||
", hash size is " + std::to_string(hash.getData().size()), ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
const UInt8 * pos = &chars[0];
|
||||
UInt32 * hash_data = &hash.getData()[0];
|
||||
const UInt8 * pos = chars.data();
|
||||
UInt32 * hash_data = hash.getData().data();
|
||||
|
||||
for (size_t row = 0; row < s; ++row)
|
||||
{
|
||||
|
@ -74,14 +74,15 @@ void ColumnString::updateWeakHash32(WeakHash32 & hash) const
|
||||
throw Exception("Size of WeakHash32 does not match size of column: column size is " + std::to_string(s) +
|
||||
", hash size is " + std::to_string(hash.getData().size()), ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
const UInt8 * pos = &chars[0];
|
||||
UInt32 * hash_data = &hash.getData()[0];
|
||||
const UInt8 * pos = chars.data();
|
||||
UInt32 * hash_data = hash.getData().data();
|
||||
Offset prev_offset = 0;
|
||||
|
||||
for (auto & offset : offsets)
|
||||
{
|
||||
auto str_size = offset - prev_offset;
|
||||
*hash_data = ::updateWeakHash32(pos, str_size, *hash_data);
|
||||
/// Skip last zero byte.
|
||||
*hash_data = ::updateWeakHash32(pos, str_size - 1, *hash_data);
|
||||
|
||||
pos += str_size;
|
||||
prev_offset = offset;
|
||||
|
@ -63,9 +63,9 @@ void ColumnVector<T>::updateWeakHash32(WeakHash32 & hash) const
|
||||
throw Exception("Size of WeakHash32 does not match size of column: column size is " + std::to_string(s) +
|
||||
", hash size is " + std::to_string(hash.getData().size()), ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
const T * begin = &data[0];
|
||||
const T * begin = data.data();
|
||||
const T * end = begin + s;
|
||||
UInt32 * hash_data = &hash.getData()[0];
|
||||
UInt32 * hash_data = hash.getData().data();
|
||||
|
||||
while (begin < end)
|
||||
{
|
||||
|
@ -75,11 +75,11 @@ template <typename T>
|
||||
inline typename std::enable_if<(sizeof(T) > sizeof(DB::UInt64)), DB::UInt64>::type
|
||||
intHashCRC32(const T & x, DB::UInt64 updated_value)
|
||||
{
|
||||
auto * begin64 = reinterpret_cast<const UInt64 *>(&x);
|
||||
auto * begin = reinterpret_cast<const char *>(&x);
|
||||
for (size_t i = 0; i < sizeof(T); i += sizeof(UInt64))
|
||||
{
|
||||
updated_value = intHashCRC32(*begin64, updated_value);
|
||||
++begin64;
|
||||
updated_value = intHashCRC32(unalignedLoad<DB::UInt64>(begin), updated_value);
|
||||
begin += sizeof(DB::UInt64);
|
||||
}
|
||||
|
||||
return updated_value;
|
||||
|
Loading…
Reference in New Issue
Block a user