aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorermolovd <ermolovd@yandex-team.com>2023-09-19 09:34:23 +0300
committerermolovd <ermolovd@yandex-team.com>2023-09-19 09:54:05 +0300
commita2668d31f6f18029eb3c9c525d3b38a7fb7f6859 (patch)
tree51ae080824b808f941a4a9e03bbb26b36df3883c
parent11536ca6ed95f3aca890e6ff4ff3774024d1a876 (diff)
downloadydb-a2668d31f6f18029eb3c9c525d3b38a7fb7f6859.tar.gz
Debug printing for NYT::TTableSchema
-rw-r--r--yt/cpp/mapreduce/interface/common.cpp6
-rw-r--r--yt/cpp/mapreduce/interface/common.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/yt/cpp/mapreduce/interface/common.cpp b/yt/cpp/mapreduce/interface/common.cpp
index 590fac3a05..31c5990e6b 100644
--- a/yt/cpp/mapreduce/interface/common.cpp
+++ b/yt/cpp/mapreduce/interface/common.cpp
@@ -15,7 +15,6 @@
namespace NYT {
-using ::google::protobuf::FieldDescriptor;
using ::google::protobuf::Descriptor;
////////////////////////////////////////////////////////////////////////////////
@@ -499,6 +498,11 @@ bool operator==(const TTableSchema& lhs, const TTableSchema& rhs)
lhs.UniqueKeys() == rhs.UniqueKeys();
}
+void PrintTo(const TTableSchema& schema, std::ostream* out)
+{
+ (*out) << NodeToYsonString(schema.ToNode(), NYson::EYsonFormat::Pretty);
+}
+
////////////////////////////////////////////////////////////////////////////////
TKeyBound::TKeyBound(ERelation relation, TKey key)
diff --git a/yt/cpp/mapreduce/interface/common.h b/yt/cpp/mapreduce/interface/common.h
index 2b48e98459..6d0543b718 100644
--- a/yt/cpp/mapreduce/interface/common.h
+++ b/yt/cpp/mapreduce/interface/common.h
@@ -762,6 +762,9 @@ public:
/// Check for equality of all columns and all schema attributes
bool operator==(const TTableSchema& lhs, const TTableSchema& rhs);
+// Pretty printer for unittests
+void PrintTo(const TTableSchema& schema, std::ostream* out);
+
/// Create table schema by protobuf message descriptor
TTableSchema CreateTableSchema(
const ::google::protobuf::Descriptor& messageDescriptor,