diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-06-29 20:05:13 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-06-29 20:05:13 +0300 |
commit | 7096de40d22e12acbc62478dcb5ab4f5581b4fe9 (patch) | |
tree | e3e573205e0e7ba4a646d7245d4b5a0947b507f8 | |
parent | f5e6392913227cb1a4299c7722690a3d64616255 (diff) | |
download | ydb-7096de40d22e12acbc62478dcb5ab4f5581b4fe9.tar.gz |
debug strings for internal objects
-rw-r--r-- | ydb/core/formats/arrow/serializer/abstract.h | 5 | ||||
-rw-r--r-- | ydb/core/formats/arrow/serializer/batch_only.h | 3 | ||||
-rw-r--r-- | ydb/core/formats/arrow/serializer/full.h | 3 | ||||
-rw-r--r-- | ydb/core/formats/arrow/transformer/abstract.h | 5 | ||||
-rw-r--r-- | ydb/core/formats/arrow/transformer/composite.cpp | 9 | ||||
-rw-r--r-- | ydb/core/formats/arrow/transformer/composite.h | 1 | ||||
-rw-r--r-- | ydb/core/formats/arrow/transformer/dictionary.h | 6 |
7 files changed, 32 insertions, 0 deletions
diff --git a/ydb/core/formats/arrow/serializer/abstract.h b/ydb/core/formats/arrow/serializer/abstract.h index 7fff5a6d29f..1419125aacc 100644 --- a/ydb/core/formats/arrow/serializer/abstract.h +++ b/ydb/core/formats/arrow/serializer/abstract.h @@ -21,10 +21,15 @@ public: class IDeserializer { protected: virtual arrow::Result<std::shared_ptr<arrow::RecordBatch>> DoDeserialize(const TString& data) const = 0; + virtual TString DoDebugString() const = 0; public: using TPtr = std::shared_ptr<IDeserializer>; virtual ~IDeserializer() = default; + TString DebugString() const { + return DoDebugString(); + } + arrow::Result<std::shared_ptr<arrow::RecordBatch>> Deserialize(const TString& data) const { return DoDeserialize(data); } diff --git a/ydb/core/formats/arrow/serializer/batch_only.h b/ydb/core/formats/arrow/serializer/batch_only.h index 5771202d7af..6c99134a297 100644 --- a/ydb/core/formats/arrow/serializer/batch_only.h +++ b/ydb/core/formats/arrow/serializer/batch_only.h @@ -22,6 +22,9 @@ private: const std::shared_ptr<arrow::Schema> Schema; protected: virtual arrow::Result<std::shared_ptr<arrow::RecordBatch>> DoDeserialize(const TString& data) const override; + virtual TString DoDebugString() const override { + return "type=BATCH_PAYLOAD;"; + } public: TBatchPayloadDeserializer(const std::shared_ptr<arrow::Schema> schema) : Schema(schema) { diff --git a/ydb/core/formats/arrow/serializer/full.h b/ydb/core/formats/arrow/serializer/full.h index 7fa063f107b..eb6bdc8cede 100644 --- a/ydb/core/formats/arrow/serializer/full.h +++ b/ydb/core/formats/arrow/serializer/full.h @@ -22,6 +22,9 @@ public: class TFullDataDeserializer: public IDeserializer { protected: virtual arrow::Result<std::shared_ptr<arrow::RecordBatch>> DoDeserialize(const TString& data) const override; + virtual TString DoDebugString() const override { + return "type=FULL_DATA;"; + } public: TFullDataDeserializer() { diff --git a/ydb/core/formats/arrow/transformer/abstract.h b/ydb/core/formats/arrow/transformer/abstract.h index a486e4e2304..6d99379f8b9 100644 --- a/ydb/core/formats/arrow/transformer/abstract.h +++ b/ydb/core/formats/arrow/transformer/abstract.h @@ -9,10 +9,15 @@ namespace NKikimr::NArrow::NTransformation { class ITransformer { protected: virtual std::shared_ptr<arrow::RecordBatch> DoTransform(const std::shared_ptr<arrow::RecordBatch>& batch) const = 0; + virtual TString DoDebugString() const = 0; public: using TPtr = std::shared_ptr<ITransformer>; virtual ~ITransformer() = default; + TString DebugString() const { + return DoDebugString(); + } + std::shared_ptr<arrow::RecordBatch> Transform(const std::shared_ptr<arrow::RecordBatch>& batch) const { return DoTransform(batch); } diff --git a/ydb/core/formats/arrow/transformer/composite.cpp b/ydb/core/formats/arrow/transformer/composite.cpp index 05d11a0034b..624431af56d 100644 --- a/ydb/core/formats/arrow/transformer/composite.cpp +++ b/ydb/core/formats/arrow/transformer/composite.cpp @@ -1,4 +1,5 @@ #include "composite.h" +#include <util/string/builder.h> namespace NKikimr::NArrow::NTransformation { @@ -10,4 +11,12 @@ std::shared_ptr<arrow::RecordBatch> TCompositeTransformer::DoTransform(const std return current; } +TString TCompositeTransformer::DoDebugString() const { + TStringBuilder sb; + for (auto&& i : Transformers) { + sb << "(" << i->DebugString() << ");"; + } + return sb; +} + } diff --git a/ydb/core/formats/arrow/transformer/composite.h b/ydb/core/formats/arrow/transformer/composite.h index a8c526f2aee..70d948a16f9 100644 --- a/ydb/core/formats/arrow/transformer/composite.h +++ b/ydb/core/formats/arrow/transformer/composite.h @@ -8,6 +8,7 @@ private: std::vector<ITransformer::TPtr> Transformers; protected: virtual std::shared_ptr<arrow::RecordBatch> DoTransform(const std::shared_ptr<arrow::RecordBatch>& batch) const override; + virtual TString DoDebugString() const override; public: }; diff --git a/ydb/core/formats/arrow/transformer/dictionary.h b/ydb/core/formats/arrow/transformer/dictionary.h index 5f285b2fd61..a029b956e0f 100644 --- a/ydb/core/formats/arrow/transformer/dictionary.h +++ b/ydb/core/formats/arrow/transformer/dictionary.h @@ -6,12 +6,18 @@ namespace NKikimr::NArrow::NTransformation { class TDictionaryPackTransformer: public ITransformer { protected: virtual std::shared_ptr<arrow::RecordBatch> DoTransform(const std::shared_ptr<arrow::RecordBatch>& batch) const override; + virtual TString DoDebugString() const override { + return "type=DICT_PACK;"; + } public: }; class TDictionaryUnpackTransformer: public ITransformer { protected: virtual std::shared_ptr<arrow::RecordBatch> DoTransform(const std::shared_ptr<arrow::RecordBatch>& batch) const override; + virtual TString DoDebugString() const override { + return "type=DICT_UNPACK;"; + } public: }; |