mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
AggregateFunctionTopK: read alphaMap for generic
* the alpha_map vector always (de)serialises the actual version (could empty sometimes) * AggregateFunctionTopK generic variant deserialises it as well instead of ignoring it * AggregateFunctionTopK generic variant clears the array before deserialising refs #1283
This commit is contained in:
parent
6628b5d308
commit
28bb5e25cf
@ -195,7 +195,9 @@ public:
|
||||
{
|
||||
auto & set = this->data(place).value;
|
||||
set.resize(reserved);
|
||||
set.clear();
|
||||
|
||||
// Specialised here because there's no deserialiser for StringRef
|
||||
size_t count = 0;
|
||||
readVarUInt(count, buf);
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
@ -206,6 +208,8 @@ public:
|
||||
set.insert(ref, count, error);
|
||||
arena->rollback(ref.size);
|
||||
}
|
||||
|
||||
set.readAlphaMap(buf);
|
||||
}
|
||||
|
||||
void addImpl(AggregateDataPtr place, const IColumn & column, size_t row_num, Arena * arena) const
|
||||
|
@ -130,6 +130,11 @@ public:
|
||||
return m_capacity;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
return destroyElements();
|
||||
}
|
||||
|
||||
void resize(size_t new_capacity)
|
||||
{
|
||||
counter_list.reserve(new_capacity);
|
||||
@ -255,6 +260,8 @@ public:
|
||||
writeVarUInt(size(), wb);
|
||||
for (auto counter : counter_list)
|
||||
counter->write(wb);
|
||||
|
||||
writeVarUInt(alpha_map.size(), wb);
|
||||
for (auto alpha : alpha_map)
|
||||
writeVarUInt(alpha, wb);
|
||||
}
|
||||
@ -273,7 +280,14 @@ public:
|
||||
push(counter);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < nextAlphaSize(m_capacity); ++i)
|
||||
readAlphaMap(rb);
|
||||
}
|
||||
|
||||
void readAlphaMap(ReadBuffer & rb)
|
||||
{
|
||||
size_t alpha_size = 0;
|
||||
readVarUInt(alpha_size, rb);
|
||||
for (size_t i = 0; i < alpha_size; ++i)
|
||||
{
|
||||
UInt64 alpha = 0;
|
||||
readVarUInt(alpha, rb);
|
||||
|
Loading…
Reference in New Issue
Block a user