mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 01:12:12 +00:00
Devirtualize serialize call in AggregateFunction
This commit is contained in:
parent
d59fe5fd7f
commit
e80920ecd1
@ -176,6 +176,8 @@ public:
|
|||||||
/// Serializes state (to transmit it over the network, for example).
|
/// Serializes state (to transmit it over the network, for example).
|
||||||
virtual void serialize(ConstAggregateDataPtr __restrict place, WriteBuffer & buf, std::optional<size_t> version = std::nullopt) const = 0; /// NOLINT
|
virtual void serialize(ConstAggregateDataPtr __restrict place, WriteBuffer & buf, std::optional<size_t> version = std::nullopt) const = 0; /// NOLINT
|
||||||
|
|
||||||
|
virtual void serializeBatch(const PaddedPODArray<AggregateDataPtr> & data, size_t start, size_t size, WriteBuffer & buf, std::optional<size_t> version = std::nullopt) const = 0; /// NOLINT
|
||||||
|
|
||||||
/// Deserializes state. This function is called only for empty (just created) states.
|
/// Deserializes state. This function is called only for empty (just created) states.
|
||||||
virtual void deserialize(AggregateDataPtr __restrict place, ReadBuffer & buf, std::optional<size_t> version = std::nullopt, Arena * arena = nullptr) const = 0; /// NOLINT
|
virtual void deserialize(AggregateDataPtr __restrict place, ReadBuffer & buf, std::optional<size_t> version = std::nullopt, Arena * arena = nullptr) const = 0; /// NOLINT
|
||||||
|
|
||||||
@ -471,6 +473,12 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void serializeBatch(const PaddedPODArray<AggregateDataPtr> & data, size_t start, size_t size, WriteBuffer & buf, std::optional<size_t> version) const override // NOLINT
|
||||||
|
{
|
||||||
|
for (size_t i = start; i < size; ++i)
|
||||||
|
static_cast<const Derived *>(this)->serialize(data[i], buf, version);
|
||||||
|
}
|
||||||
|
|
||||||
void addBatchSparse(
|
void addBatchSparse(
|
||||||
size_t row_begin,
|
size_t row_begin,
|
||||||
size_t row_end,
|
size_t row_end,
|
||||||
|
@ -60,12 +60,11 @@ void SerializationAggregateFunction::serializeBinaryBulk(const IColumn & column,
|
|||||||
const ColumnAggregateFunction & real_column = typeid_cast<const ColumnAggregateFunction &>(column);
|
const ColumnAggregateFunction & real_column = typeid_cast<const ColumnAggregateFunction &>(column);
|
||||||
const ColumnAggregateFunction::Container & vec = real_column.getData();
|
const ColumnAggregateFunction::Container & vec = real_column.getData();
|
||||||
|
|
||||||
ColumnAggregateFunction::Container::const_iterator it = vec.begin() + offset;
|
size_t end = vec.size();
|
||||||
ColumnAggregateFunction::Container::const_iterator end = limit ? it + limit : vec.end();
|
if (limit)
|
||||||
|
end = std::min(end, limit);
|
||||||
|
|
||||||
end = std::min(end, vec.end());
|
function->serializeBatch(vec, offset, end, ostr, version);
|
||||||
for (; it != end; ++it)
|
|
||||||
function->serialize(*it, ostr, version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerializationAggregateFunction::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double /*avg_value_size_hint*/) const
|
void SerializationAggregateFunction::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double /*avg_value_size_hint*/) const
|
||||||
|
Loading…
Reference in New Issue
Block a user