Serialization

This commit is contained in:
achimbab 2021-01-28 16:11:32 +09:00
parent e93caefd62
commit 994e01e0ab
2 changed files with 10 additions and 6 deletions

View File

@ -223,25 +223,28 @@ public:
void serialize(ConstAggregateDataPtr place, WriteBuffer & buf) const override
{
writeVarUInt(data(place).value.size(), buf);
writeBinary(data(place).sorted, buf);
auto & value = data(place).value;
writeVarUInt(value.size(), buf);
for (auto & node : value)
node->write(buf);
}
void deserialize(AggregateDataPtr place, ReadBuffer & buf, Arena * arena) const override
{
UInt64 elems;
readVarUInt(elems, buf);
readBinary(data(place).sorted, buf);
if (unlikely(elems == 0))
UInt64 size;
readVarUInt(size, buf);
if (unlikely(size == 0))
return;
auto & value = data(place).value;
value.resize(elems, arena);
for (UInt64 i = 0; i < elems; ++i)
value.resize(size, arena);
for (UInt64 i = 0; i < size; ++i)
value[i] = Node::read(buf, arena);
}

View File

@ -42,6 +42,7 @@ SRCS(
AggregateFunctionResample.cpp
AggregateFunctionRetention.cpp
AggregateFunctionSequenceMatch.cpp
AggregateFunctionSequenceNextNode.cpp
AggregateFunctionSimpleLinearRegression.cpp
AggregateFunctionSimpleState.cpp
AggregateFunctionState.cpp