Remove heavy header

This commit is contained in:
Raúl Marín 2024-12-02 13:45:49 +01:00
parent 8ecdfb9bc2
commit 4f22469537
4 changed files with 18 additions and 13 deletions

View File

@ -162,13 +162,11 @@ void SerializationInfo::deserializeFromKindsBinary(ReadBuffer & in)
kind = *maybe_kind;
}
Poco::JSON::Object SerializationInfo::toJSON() const
void SerializationInfo::toJSON(Poco::JSON::Object & object) const
{
Poco::JSON::Object object;
object.set(KEY_KIND, ISerialization::kindToString(kind));
object.set(KEY_NUM_DEFAULTS, data.num_defaults);
object.set(KEY_NUM_ROWS, data.num_rows);
return object;
}
void SerializationInfo::fromJSON(const Poco::JSON::Object & object)
@ -276,7 +274,8 @@ void SerializationInfoByName::writeJSON(WriteBuffer & out) const
Poco::JSON::Array column_infos;
for (const auto & [name, info] : *this)
{
auto info_json = info->toJSON();
Poco::JSON::Object info_json;
info->toJSON(info_json);
info_json.set(KEY_NAME, name);
column_infos.add(std::move(info_json)); /// NOLINT
}

View File

@ -4,8 +4,10 @@
#include <DataTypes/Serializations/ISerialization.h>
#include <DataTypes/Serializations/SerializationInfoSettings.h>
#include <Poco/JSON/Object.h>
namespace Poco::JSON
{
class Object;
}
namespace DB
{
@ -67,7 +69,7 @@ public:
virtual void serialializeKindBinary(WriteBuffer & out) const;
virtual void deserializeFromKindsBinary(ReadBuffer & in);
virtual Poco::JSON::Object toJSON() const;
virtual void toJSON(Poco::JSON::Object & object) const;
virtual void fromJSON(const Poco::JSON::Object & object);
void setKind(ISerialization::Kind kind_) { kind = kind_; }

View File

@ -3,6 +3,8 @@
#include <Columns/ColumnTuple.h>
#include <Common/assert_cast.h>
#include <Poco/JSON/Object.h>
namespace DB
{
@ -151,15 +153,17 @@ void SerializationInfoTuple::deserializeFromKindsBinary(ReadBuffer & in)
elem->deserializeFromKindsBinary(in);
}
Poco::JSON::Object SerializationInfoTuple::toJSON() const
void SerializationInfoTuple::toJSON(Poco::JSON::Object & object) const
{
auto object = SerializationInfo::toJSON();
SerializationInfo::toJSON(object);
Poco::JSON::Array subcolumns;
for (const auto & elem : elems)
subcolumns.add(elem->toJSON());
{
Poco::JSON::Object sub_column_json;
elem->toJSON(sub_column_json);
subcolumns.add(sub_column_json);
}
object.set("subcolumns", subcolumns);
return object;
}
void SerializationInfoTuple::fromJSON(const Poco::JSON::Object & object)

View File

@ -29,7 +29,7 @@ public:
void serialializeKindBinary(WriteBuffer & out) const override;
void deserializeFromKindsBinary(ReadBuffer & in) override;
Poco::JSON::Object toJSON() const override;
void toJSON(Poco::JSON::Object & object) const override;
void fromJSON(const Poco::JSON::Object & object) override;
const MutableSerializationInfoPtr & getElementInfo(size_t i) const { return elems[i]; }