Skip to content

Commit 04cdd1c

Browse files
ermolovdKamil Khamitov
authored andcommitted
Helper to print debug text yson
commit_hash:9bf2720c07d72769345cd76b6023c066c475b025
1 parent f9f813f commit 04cdd1c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

yt/cpp/mapreduce/interface/serialize.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include "common.h"
99

10+
#include <library/cpp/yson/writer.h>
11+
1012
#include <library/cpp/type_info/fwd.h>
1113

1214
namespace NYT::NYson {
@@ -85,6 +87,17 @@ void Deserialize(TGUID& value, const TNode& node);
8587
void Serialize(const NTi::TTypePtr& type, NYT::NYson::IYsonConsumer* consumer);
8688
void Deserialize(NTi::TTypePtr& type, const TNode& node);
8789

90+
template <typename T>
91+
TString ToYsonText(const T& value)
92+
{
93+
TStringStream out;
94+
::NYson::TYsonWriter writer(&out, ::NYson::EYsonFormat::Text);
95+
96+
Serialize(value, &writer);
97+
98+
return out.Str();
99+
}
100+
88101
////////////////////////////////////////////////////////////////////////////////
89102

90103
} // namespace NYT

0 commit comments

Comments
 (0)