aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorermolovd <ermolovd@yandex-team.com>2025-02-27 12:09:32 +0300
committerermolovd <ermolovd@yandex-team.com>2025-02-27 12:25:21 +0300
commitd8421ced20cf7734d41d29a3209c87f93485faad (patch)
tree5b9aab05d166ef7a56f4515ca5ef243a04c9ba53
parent2a1e325926612288fe075e175c3a051449d75221 (diff)
downloadydb-d8421ced20cf7734d41d29a3209c87f93485faad.tar.gz
Helper to print debug text yson
commit_hash:9bf2720c07d72769345cd76b6023c066c475b025
-rw-r--r--yt/cpp/mapreduce/interface/serialize.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/interface/serialize.h b/yt/cpp/mapreduce/interface/serialize.h
index 223dd446ba..6127b808c7 100644
--- a/yt/cpp/mapreduce/interface/serialize.h
+++ b/yt/cpp/mapreduce/interface/serialize.h
@@ -7,6 +7,8 @@
#include "common.h"
+#include <library/cpp/yson/writer.h>
+
#include <library/cpp/type_info/fwd.h>
namespace NYT::NYson {
@@ -85,6 +87,17 @@ void Deserialize(TGUID& value, const TNode& node);
void Serialize(const NTi::TTypePtr& type, NYT::NYson::IYsonConsumer* consumer);
void Deserialize(NTi::TTypePtr& type, const TNode& node);
+template <typename T>
+TString ToYsonText(const T& value)
+{
+ TStringStream out;
+ ::NYson::TYsonWriter writer(&out, ::NYson::EYsonFormat::Text);
+
+ Serialize(value, &writer);
+
+ return out.Str();
+}
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT