diff options
author | nadya73 <nadya73@yandex-team.ru> | 2022-02-10 16:49:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:18 +0300 |
commit | b6e35c760e81fe851ac4da1abc08e6ec8e779c10 (patch) | |
tree | bffcb657a262b70deabd6a12cf65b823c9332150 | |
parent | cb691264f012c552bac85a9fe352baa062cd81dd (diff) | |
download | ydb-b6e35c760e81fe851ac4da1abc08e6ec8e779c10.tar.gz |
Restoring authorship annotation for <nadya73@yandex-team.ru>. Commit 1 of 2.
82 files changed, 551 insertions, 551 deletions
diff --git a/library/cpp/json/yson/json2yson.cpp b/library/cpp/json/yson/json2yson.cpp index f72cb7a9ef..fefa8253a7 100644 --- a/library/cpp/json/yson/json2yson.cpp +++ b/library/cpp/json/yson/json2yson.cpp @@ -47,13 +47,13 @@ namespace NJson2Yson { } } - void SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue, NYson::TYsonWriter* ysonWriter) { + void SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue, NYson::TYsonWriter* ysonWriter) { NYT::TYson2JsonCallbacksAdapter adapter(ysonWriter); WriteJsonValue(inputValue, &adapter); } void SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue, IOutputStream* outputStream) { - NYson::TYsonWriter ysonWriter(outputStream, NYson::EYsonFormat::Binary, ::NYson::EYsonType::Node, false); + NYson::TYsonWriter ysonWriter(outputStream, NYson::EYsonFormat::Binary, ::NYson::EYsonType::Node, false); SerializeJsonValueAsYson(inputValue, &ysonWriter); } @@ -71,7 +71,7 @@ namespace NJson2Yson { bool DeserializeYsonAsJsonValue(IInputStream* inputStream, NJson::TJsonValue* outputValue, bool throwOnError) { NJson::TParserCallbacks parser(*outputValue); NJson2Yson::TJsonBuilder consumer(&parser); - NYson::TYsonParser ysonParser(&consumer, inputStream, ::NYson::EYsonType::Node); + NYson::TYsonParser ysonParser(&consumer, inputStream, ::NYson::EYsonType::Node); try { ysonParser.Parse(); } catch (...) { @@ -89,8 +89,8 @@ namespace NJson2Yson { } void ConvertYson2Json(IInputStream* inputStream, IOutputStream* outputStream) { - NYT::TJsonWriter writer(outputStream, ::NYson::EYsonType::Node, NYT::JF_TEXT, NYT::JAM_ON_DEMAND, NYT::SBF_BOOLEAN); - NYson::TYsonParser ysonParser(&writer, inputStream, ::NYson::EYsonType::Node); + NYT::TJsonWriter writer(outputStream, ::NYson::EYsonType::Node, NYT::JF_TEXT, NYT::JAM_ON_DEMAND, NYT::SBF_BOOLEAN); + NYson::TYsonParser ysonParser(&writer, inputStream, ::NYson::EYsonType::Node); ysonParser.Parse(); } diff --git a/library/cpp/json/yson/json2yson.h b/library/cpp/json/yson/json2yson.h index 758eb6d0cf..15ad98e8e7 100644 --- a/library/cpp/json/yson/json2yson.h +++ b/library/cpp/json/yson/json2yson.h @@ -5,14 +5,14 @@ #include <library/cpp/yson/writer.h> namespace NJson2Yson { - class TJsonBuilderImpl: public NYson::TYsonConsumerBase { + class TJsonBuilderImpl: public NYson::TYsonConsumerBase { public: TJsonBuilderImpl(NJson::TJsonCallbacks* parserCallbacks) : ParserCallbacks_(parserCallbacks) { } - void OnStringScalar(TStringBuf value) override { + void OnStringScalar(TStringBuf value) override { ParserCallbacks_->OnString(value); } @@ -51,7 +51,7 @@ namespace NJson2Yson { ParserCallbacks_->OnOpenMap(); } - void OnKeyedItem(TStringBuf key) override { + void OnKeyedItem(TStringBuf key) override { ParserCallbacks_->OnMapKey(key); } @@ -78,7 +78,7 @@ namespace NJson2Yson { { } - void OnStringScalar(TStringBuf value) override { + void OnStringScalar(TStringBuf value) override { if (AttributesDepth == 0) { TBase::OnStringScalar(value); } @@ -138,7 +138,7 @@ namespace NJson2Yson { } } - void OnKeyedItem(TStringBuf key) override { + void OnKeyedItem(TStringBuf key) override { if (AttributesDepth == 0) { TBase::OnKeyedItem(key); } @@ -172,7 +172,7 @@ namespace NJson2Yson { bool DeserializeYsonAsJsonValue(IInputStream* inputStream, NJson::TJsonValue* outputValue, bool throwOnError = false); bool DeserializeYsonAsJsonValue(TStringBuf str, NJson::TJsonValue* outputValue, bool throwOnError = false); - void SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue, NYson::TYsonWriter* ysonWriter); + void SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue, NYson::TYsonWriter* ysonWriter); void SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue, IOutputStream* outputStream); void SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue, TString& result); TString SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue); diff --git a/library/cpp/yson/consumer.cpp b/library/cpp/yson/consumer.cpp index 40ae452978..f34f862dda 100644 --- a/library/cpp/yson/consumer.cpp +++ b/library/cpp/yson/consumer.cpp @@ -1,13 +1,13 @@ #include "consumer.h" -#include "string.h" +#include "string.h" #include "parser.h" namespace NYson { - + //////////////////////////////////////////////////////////////////////////////// - void TYsonConsumerBase::OnRaw(TStringBuf str, NYT::NYson::EYsonType type) { - ParseYsonStringBuffer(str, this, type); + void TYsonConsumerBase::OnRaw(TStringBuf str, NYT::NYson::EYsonType type) { + ParseYsonStringBuffer(str, this, type); } //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yson/consumer.h b/library/cpp/yson/consumer.h index d5a9d66335..6e37b0eb4e 100644 --- a/library/cpp/yson/consumer.h +++ b/library/cpp/yson/consumer.h @@ -1,13 +1,13 @@ #pragma once -#include <library/cpp/yt/yson/consumer.h> +#include <library/cpp/yt/yson/consumer.h> #include <util/generic/strbuf.h> #include <util/system/defaults.h> namespace NYson { struct TYsonConsumerBase - : public virtual NYT::NYson::IYsonConsumer { - void OnRaw(TStringBuf ysonNode, NYT::NYson::EYsonType type) override; + : public virtual NYT::NYson::IYsonConsumer { + void OnRaw(TStringBuf ysonNode, NYT::NYson::EYsonType type) override; }; } // namespace NYson diff --git a/library/cpp/yson/json/json_writer.cpp b/library/cpp/yson/json/json_writer.cpp index 87481256ec..9058c53b07 100644 --- a/library/cpp/yson/json/json_writer.cpp +++ b/library/cpp/yson/json/json_writer.cpp @@ -13,7 +13,7 @@ namespace NYT { TJsonWriter::TJsonWriter( IOutputStream* output, - ::NYson::EYsonType type, + ::NYson::EYsonType type, EJsonFormat format, EJsonAttributesMode attributesMode, ESerializedBoolFormat booleanFormat) @@ -29,7 +29,7 @@ namespace NYT { TJsonWriter::TJsonWriter( IOutputStream* output, NJson::TJsonWriterConfig config, - ::NYson::EYsonType type, + ::NYson::EYsonType type, EJsonAttributesMode attributesMode, ESerializedBoolFormat booleanFormat) : Output(output) @@ -38,8 +38,8 @@ namespace NYT { , BooleanFormat(booleanFormat) , Depth(0) { - if (Type == ::NYson::EYsonType::MapFragment) { - ythrow ::NYson::TYsonException() << ("Map fragments are not supported by Json"); + if (Type == ::NYson::EYsonType::MapFragment) { + ythrow ::NYson::TYsonException() << ("Map fragments are not supported by Json"); } UnderlyingJsonWriter.Reset(new NJson::TJsonWriter( @@ -84,7 +84,7 @@ namespace NYT { Depth -= 1; - if (Depth == 0 && Type == ::NYson::EYsonType::ListFragment && InAttributesBalance == 0) { + if (Depth == 0 && Type == ::NYson::EYsonType::ListFragment && InAttributesBalance == 0) { JsonWriter->Flush(); Output->Write("\n"); } @@ -97,7 +97,7 @@ namespace NYT { return true; } - void TJsonWriter::OnStringScalar(TStringBuf value) { + void TJsonWriter::OnStringScalar(TStringBuf value) { if (IsWriteAllowed()) { EnterNode(); WriteStringScalar(value); @@ -173,7 +173,7 @@ namespace NYT { } } - void TJsonWriter::OnKeyedItem(TStringBuf name) { + void TJsonWriter::OnKeyedItem(TStringBuf name) { if (IsWriteAllowed()) { if (IsSpecialJsonKey(name)) { WriteStringScalar(TString("$") + name); diff --git a/library/cpp/yson/json/json_writer.h b/library/cpp/yson/json/json_writer.h index d84ac0de53..41de326f7b 100644 --- a/library/cpp/yson/json/json_writer.h +++ b/library/cpp/yson/json/json_writer.h @@ -31,7 +31,7 @@ namespace NYT { public: TJsonWriter( IOutputStream* output, - ::NYson::EYsonType type = ::NYson::EYsonType::Node, + ::NYson::EYsonType type = ::NYson::EYsonType::Node, EJsonFormat format = JF_TEXT, EJsonAttributesMode attributesMode = JAM_ON_DEMAND, ESerializedBoolFormat booleanFormat = SBF_STRING); @@ -39,13 +39,13 @@ namespace NYT { TJsonWriter( IOutputStream* output, NJson::TJsonWriterConfig config, - ::NYson::EYsonType type = ::NYson::EYsonType::Node, + ::NYson::EYsonType type = ::NYson::EYsonType::Node, EJsonAttributesMode attributesMode = JAM_ON_DEMAND, ESerializedBoolFormat booleanFormat = SBF_STRING); void Flush(); - void OnStringScalar(TStringBuf value) override; + void OnStringScalar(TStringBuf value) override; void OnInt64Scalar(i64 value) override; void OnUint64Scalar(ui64 value) override; void OnDoubleScalar(double value) override; @@ -58,7 +58,7 @@ namespace NYT { void OnEndList() override; void OnBeginMap() override; - void OnKeyedItem(TStringBuf key) override; + void OnKeyedItem(TStringBuf key) override; void OnEndMap() override; void OnBeginAttributes() override; @@ -68,7 +68,7 @@ namespace NYT { THolder<NJson::TJsonWriter> UnderlyingJsonWriter; NJson::TJsonWriter* JsonWriter; IOutputStream* Output; - ::NYson::EYsonType Type; + ::NYson::EYsonType Type; EJsonAttributesMode AttributesMode; ESerializedBoolFormat BooleanFormat; diff --git a/library/cpp/yson/json/yson2json_adapter.cpp b/library/cpp/yson/json/yson2json_adapter.cpp index b5e7c49d4d..391c3a4937 100644 --- a/library/cpp/yson/json/yson2json_adapter.cpp +++ b/library/cpp/yson/json/yson2json_adapter.cpp @@ -1,7 +1,7 @@ #include "yson2json_adapter.h" namespace NYT { - TYson2JsonCallbacksAdapter::TYson2JsonCallbacksAdapter(::NYson::TYsonConsumerBase* impl, bool throwException) + TYson2JsonCallbacksAdapter::TYson2JsonCallbacksAdapter(::NYson::TYsonConsumerBase* impl, bool throwException) : NJson::TJsonCallbacks(throwException) , Impl_(impl) { diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp index b39e070718..c6c4b47971 100644 --- a/library/cpp/yson/node/node.cpp +++ b/library/cpp/yson/node/node.cpp @@ -852,13 +852,13 @@ void TNode::CreateAttributes() void TNode::Save(IOutputStream* out) const { - NodeToYsonStream(*this, out, NYson::EYsonFormat::Binary); + NodeToYsonStream(*this, out, NYson::EYsonFormat::Binary); } void TNode::Load(IInputStream* in) { Clear(); - *this = NodeFromYsonStream(in, ::NYson::EYsonType::Node); + *this = NodeFromYsonStream(in, ::NYson::EYsonType::Node); } //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yson/node/node_builder.cpp b/library/cpp/yson/node/node_builder.cpp index b4431bc77a..40807f5b12 100644 --- a/library/cpp/yson/node/node_builder.cpp +++ b/library/cpp/yson/node/node_builder.cpp @@ -9,7 +9,7 @@ TNodeBuilder::TNodeBuilder(TNode* node) Stack_.push(node); } -void TNodeBuilder::OnStringScalar(TStringBuf value) +void TNodeBuilder::OnStringScalar(TStringBuf value) { AddNode(value, true); } @@ -59,7 +59,7 @@ void TNodeBuilder::OnBeginMap() AddNode(TNode::CreateMap(), false); } -void TNodeBuilder::OnKeyedItem(TStringBuf key) +void TNodeBuilder::OnKeyedItem(TStringBuf key) { Stack_.push(&(*Stack_.top())[TString(key)]); } diff --git a/library/cpp/yson/node/node_builder.h b/library/cpp/yson/node/node_builder.h index 69800016e0..8725298e25 100644 --- a/library/cpp/yson/node/node_builder.h +++ b/library/cpp/yson/node/node_builder.h @@ -18,7 +18,7 @@ class TNodeBuilder public: TNodeBuilder(TNode* node); - void OnStringScalar(TStringBuf) override; + void OnStringScalar(TStringBuf) override; void OnInt64Scalar(i64) override; void OnUint64Scalar(ui64) override; void OnDoubleScalar(double) override; @@ -28,7 +28,7 @@ public: void OnListItem() override; void OnEndList() override; void OnBeginMap() override; - void OnKeyedItem(TStringBuf) override; + void OnKeyedItem(TStringBuf) override; void OnEndMap() override; void OnBeginAttributes() override; void OnEndAttributes() override; diff --git a/library/cpp/yson/node/node_io.cpp b/library/cpp/yson/node/node_io.cpp index 294a7f7217..6d581f9b81 100644 --- a/library/cpp/yson/node/node_io.cpp +++ b/library/cpp/yson/node/node_io.cpp @@ -66,14 +66,14 @@ static void WalkJsonTree(const NJson::TJsonValue& jsonValue, NJson::TJsonCallbac Y_UNREACHABLE(); } -static TNode CreateEmptyNodeByType(::NYson::EYsonType type) +static TNode CreateEmptyNodeByType(::NYson::EYsonType type) { TNode result; switch (type) { - case ::NYson::EYsonType::ListFragment: + case ::NYson::EYsonType::ListFragment: result = TNode::CreateList(); break; - case ::NYson::EYsonType::MapFragment: + case ::NYson::EYsonType::MapFragment: result = TNode::CreateMap(); break; default: @@ -82,46 +82,46 @@ static TNode CreateEmptyNodeByType(::NYson::EYsonType type) return result; } -TNode NodeFromYsonString(const TStringBuf input, ::NYson::EYsonType type) +TNode NodeFromYsonString(const TStringBuf input, ::NYson::EYsonType type) { TMemoryInput stream(input); return NodeFromYsonStream(&stream, type); } -TString NodeToYsonString(const TNode& node, NYson::EYsonFormat format) +TString NodeToYsonString(const TNode& node, NYson::EYsonFormat format) { TStringStream stream; NodeToYsonStream(node, &stream, format); return stream.Str(); } -TString NodeToCanonicalYsonString(const TNode& node, NYson::EYsonFormat format) +TString NodeToCanonicalYsonString(const TNode& node, NYson::EYsonFormat format) { TStringStream stream; NodeToCanonicalYsonStream(node, &stream, format); return stream.Str(); } -TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type) +TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type) { TNode result = CreateEmptyNodeByType(type); TNodeBuilder builder(&result); - ::NYson::TYsonParser parser(&builder, input, type); + ::NYson::TYsonParser parser(&builder, input, type); parser.Parse(); return result; } -void NodeToYsonStream(const TNode& node, IOutputStream* output, NYson::EYsonFormat format) +void NodeToYsonStream(const TNode& node, IOutputStream* output, NYson::EYsonFormat format) { - ::NYson::TYsonWriter writer(output, format); + ::NYson::TYsonWriter writer(output, format); TNodeVisitor visitor(&writer); visitor.Visit(node); } -void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, NYson::EYsonFormat format) +void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, NYson::EYsonFormat format) { - ::NYson::TYsonWriter writer(output, format); + ::NYson::TYsonWriter writer(output, format); TNodeVisitor visitor(&writer, /*sortMapKeys*/ true); visitor.Visit(node); } diff --git a/library/cpp/yson/node/node_io.h b/library/cpp/yson/node/node_io.h index 2ad23b658f..d86b9f8bda 100644 --- a/library/cpp/yson/node/node_io.h +++ b/library/cpp/yson/node/node_io.h @@ -12,22 +12,22 @@ namespace NYT { //////////////////////////////////////////////////////////////////////////////// // Parse TNode from string in YSON format -TNode NodeFromYsonString(const TStringBuf input, ::NYson::EYsonType type = ::NYson::EYsonType::Node); +TNode NodeFromYsonString(const TStringBuf input, ::NYson::EYsonType type = ::NYson::EYsonType::Node); // Serialize TNode to string in one of YSON formats with random order of maps' keys (don't use in tests) -TString NodeToYsonString(const TNode& node, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); +TString NodeToYsonString(const TNode& node, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); // Same as the latter, but maps' keys are sorted lexicographically (to be used in tests) -TString NodeToCanonicalYsonString(const TNode& node, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); +TString NodeToCanonicalYsonString(const TNode& node, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); // Parse TNode from stream in YSON format -TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type = ::NYson::EYsonType::Node); +TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type = ::NYson::EYsonType::Node); // Serialize TNode to stream in one of YSON formats with random order of maps' keys (don't use in tests) -void NodeToYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); +void NodeToYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); // Same as the latter, but maps' keys are sorted lexicographically (to be used in tests) -void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); +void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); // Parse TNode from string in JSON format TNode NodeFromJsonString(const TStringBuf input); diff --git a/library/cpp/yson/node/node_visitor.h b/library/cpp/yson/node/node_visitor.h index db25832309..45be709a76 100644 --- a/library/cpp/yson/node/node_visitor.h +++ b/library/cpp/yson/node/node_visitor.h @@ -11,14 +11,14 @@ namespace NYT { class TNodeVisitor { public: - TNodeVisitor(NYson::IYsonConsumer* consumer, bool sortMapKeys = false); + TNodeVisitor(NYson::IYsonConsumer* consumer, bool sortMapKeys = false); void Visit(const TNode& node); void VisitMap(const TNode::TMapType& nodeMap); void VisitList(const TNode::TListType& nodeMap); private: - NYson::IYsonConsumer* Consumer_; + NYson::IYsonConsumer* Consumer_; bool SortMapKeys_; private: diff --git a/library/cpp/yson/node/serialize.cpp b/library/cpp/yson/node/serialize.cpp index aeb467622b..50b836db9c 100644 --- a/library/cpp/yson/node/serialize.cpp +++ b/library/cpp/yson/node/serialize.cpp @@ -8,17 +8,17 @@ namespace NYT { //////////////////////////////////////////////////////////////////////////////// -void Serialize(const TString& value, NYson::IYsonConsumer* consumer) +void Serialize(const TString& value, NYson::IYsonConsumer* consumer) { consumer->OnStringScalar(value); } -void Serialize(const TStringBuf& value, NYson::IYsonConsumer* consumer) +void Serialize(const TStringBuf& value, NYson::IYsonConsumer* consumer) { consumer->OnStringScalar(value); } -void Serialize(const char* value, NYson::IYsonConsumer* consumer) +void Serialize(const char* value, NYson::IYsonConsumer* consumer) { consumer->OnStringScalar(value); } @@ -29,13 +29,13 @@ void Deserialize(TString& value, const TNode& node) } #define SERIALIZE_SIGNED(type) \ -void Serialize(type value, NYson::IYsonConsumer* consumer) \ +void Serialize(type value, NYson::IYsonConsumer* consumer) \ { \ consumer->OnInt64Scalar(static_cast<i64>(value)); \ } #define SERIALIZE_UNSIGNED(type) \ -void Serialize(type value, NYson::IYsonConsumer* consumer) \ +void Serialize(type value, NYson::IYsonConsumer* consumer) \ { \ consumer->OnUint64Scalar(static_cast<ui64>(value)); \ } @@ -65,7 +65,7 @@ void Deserialize(ui64& value, const TNode& node) value = node.AsUint64(); } -void Serialize(double value, NYson::IYsonConsumer* consumer) +void Serialize(double value, NYson::IYsonConsumer* consumer) { consumer->OnDoubleScalar(value); } @@ -75,7 +75,7 @@ void Deserialize(double& value, const TNode& node) value = node.AsDouble(); } -void Serialize(bool value, NYson::IYsonConsumer* consumer) +void Serialize(bool value, NYson::IYsonConsumer* consumer) { consumer->OnBooleanScalar(value); } @@ -85,7 +85,7 @@ void Deserialize(bool& value, const TNode& node) value = node.AsBool(); } -void Serialize(const TNode& node, NYson::IYsonConsumer* consumer) +void Serialize(const TNode& node, NYson::IYsonConsumer* consumer) { TNodeVisitor visitor(consumer); visitor.Visit(node); diff --git a/library/cpp/yson/node/serialize.h b/library/cpp/yson/node/serialize.h index 99b598a44c..d8a48031a6 100644 --- a/library/cpp/yson/node/serialize.h +++ b/library/cpp/yson/node/serialize.h @@ -2,43 +2,43 @@ #include "node.h" -namespace NYT { - +namespace NYT { + namespace NYson { struct IYsonConsumer; } // namespace NYson //////////////////////////////////////////////////////////////////////////////// -void Serialize(const TString& value, NYson::IYsonConsumer* consumer); -void Serialize(const TStringBuf& value, NYson::IYsonConsumer* consumer); -void Serialize(const char* value, NYson::IYsonConsumer* consumer); +void Serialize(const TString& value, NYson::IYsonConsumer* consumer); +void Serialize(const TStringBuf& value, NYson::IYsonConsumer* consumer); +void Serialize(const char* value, NYson::IYsonConsumer* consumer); void Deserialize(TString& value, const TNode& node); -void Serialize(signed char value, NYson::IYsonConsumer* consumer); -void Serialize(short value, NYson::IYsonConsumer* consumer); -void Serialize(int value, NYson::IYsonConsumer* consumer); -void Serialize(long value, NYson::IYsonConsumer* consumer); -void Serialize(long long value, NYson::IYsonConsumer* consumer); +void Serialize(signed char value, NYson::IYsonConsumer* consumer); +void Serialize(short value, NYson::IYsonConsumer* consumer); +void Serialize(int value, NYson::IYsonConsumer* consumer); +void Serialize(long value, NYson::IYsonConsumer* consumer); +void Serialize(long long value, NYson::IYsonConsumer* consumer); void Deserialize(i64& value, const TNode& node); -void Serialize(unsigned char value, NYson::IYsonConsumer* consumer); -void Serialize(unsigned short value, NYson::IYsonConsumer* consumer); -void Serialize(unsigned int value, NYson::IYsonConsumer* consumer); -void Serialize(unsigned long value, NYson::IYsonConsumer* consumer); -void Serialize(unsigned long long value, NYson::IYsonConsumer* consumer); +void Serialize(unsigned char value, NYson::IYsonConsumer* consumer); +void Serialize(unsigned short value, NYson::IYsonConsumer* consumer); +void Serialize(unsigned int value, NYson::IYsonConsumer* consumer); +void Serialize(unsigned long value, NYson::IYsonConsumer* consumer); +void Serialize(unsigned long long value, NYson::IYsonConsumer* consumer); void Deserialize(ui64& value, const TNode& node); -void Serialize(double value, NYson::IYsonConsumer* consumer); +void Serialize(double value, NYson::IYsonConsumer* consumer); void Deserialize(double& value, const TNode& node); -void Serialize(bool value, NYson::IYsonConsumer* consumer); +void Serialize(bool value, NYson::IYsonConsumer* consumer); void Deserialize(bool& value, const TNode& node); -void Serialize(const TNode& node, NYson::IYsonConsumer* consumer); +void Serialize(const TNode& node, NYson::IYsonConsumer* consumer); void Deserialize(TNode& value, const TNode& node); -void Serialize(const THashMap<TString, TString>& renameColumns, NYson::IYsonConsumer* consumer); +void Serialize(const THashMap<TString, TString>& renameColumns, NYson::IYsonConsumer* consumer); //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yson/parser.cpp b/library/cpp/yson/parser.cpp index 783f9b9047..4290017e27 100644 --- a/library/cpp/yson/parser.cpp +++ b/library/cpp/yson/parser.cpp @@ -12,7 +12,7 @@ namespace NYson { class TYsonParser::TImpl { public: TImpl( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, IInputStream* stream, EYsonType type, bool enableLinePositionInfo, @@ -27,7 +27,7 @@ namespace NYson { void Parse() { TBuffer buffer(64 << 10); - ParseYsonStreamImpl<NYT::NYson::IYsonConsumer, TStreamReader>( + ParseYsonStreamImpl<NYT::NYson::IYsonConsumer, TStreamReader>( TStreamReader(Stream_, buffer.Data(), buffer.Capacity()), Consumer_, Type_, @@ -36,7 +36,7 @@ namespace NYson { } private: - NYT::NYson::IYsonConsumer* Consumer_; + NYT::NYson::IYsonConsumer* Consumer_; IInputStream* Stream_; EYsonType Type_; bool EnableLinePositionInfo_; @@ -46,7 +46,7 @@ namespace NYson { //////////////////////////////////////////////////////////////////////////////// TYsonParser::TYsonParser( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, IInputStream* stream, EYsonType type, bool enableLinePositionInfo, @@ -70,17 +70,17 @@ namespace NYson { public: TImpl( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, bool enableLinePositionInfo, TMaybe<ui64> memoryLimit) : Impl( enableLinePositionInfo - ? static_cast<TStatelessYsonParserImplBase*>(new TStatelessYsonParserImpl<NYT::NYson::IYsonConsumer, true>(consumer, memoryLimit)) - : static_cast<TStatelessYsonParserImplBase*>(new TStatelessYsonParserImpl<NYT::NYson::IYsonConsumer, false>(consumer, memoryLimit))) + ? static_cast<TStatelessYsonParserImplBase*>(new TStatelessYsonParserImpl<NYT::NYson::IYsonConsumer, true>(consumer, memoryLimit)) + : static_cast<TStatelessYsonParserImplBase*>(new TStatelessYsonParserImpl<NYT::NYson::IYsonConsumer, false>(consumer, memoryLimit))) { } - void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node) { + void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node) { Impl->Parse(data, type); } }; @@ -88,7 +88,7 @@ namespace NYson { //////////////////////////////////////////////////////////////////////////////// TStatelessYsonParser::TStatelessYsonParser( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, bool enableLinePositionInfo, TMaybe<ui64> memoryLimit) : Impl(new TImpl(consumer, enableLinePositionInfo, memoryLimit)) @@ -106,11 +106,11 @@ namespace NYson { void ParseYsonStringBuffer( const TStringBuf& buffer, - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, EYsonType type, bool enableLinePositionInfo, TMaybe<ui64> memoryLimit) { - ParseYsonStreamImpl<NYT::NYson::IYsonConsumer, TStringReader>( + ParseYsonStreamImpl<NYT::NYson::IYsonConsumer, TStringReader>( TStringReader(buffer.begin(), buffer.end()), consumer, type, @@ -123,7 +123,7 @@ namespace NYson { class TYsonListParser::TImpl { public: TImpl( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, IInputStream* stream, bool enableLinePositionInfo, TMaybe<ui64> memoryLimit = Nothing()) @@ -140,14 +140,14 @@ namespace NYson { if (!Impl_) { Impl_.Reset( EnableLinePositionInfo_ - ? static_cast<TYsonListParserImplBase*>(new TYsonListParserImpl<NYT::NYson::IYsonConsumer, TStreamReader, true>(Reader_, Consumer_, MemoryLimit_)) - : static_cast<TYsonListParserImplBase*>(new TYsonListParserImpl<NYT::NYson::IYsonConsumer, TStreamReader, false>(Reader_, Consumer_, MemoryLimit_))); + ? static_cast<TYsonListParserImplBase*>(new TYsonListParserImpl<NYT::NYson::IYsonConsumer, TStreamReader, true>(Reader_, Consumer_, MemoryLimit_)) + : static_cast<TYsonListParserImplBase*>(new TYsonListParserImpl<NYT::NYson::IYsonConsumer, TStreamReader, false>(Reader_, Consumer_, MemoryLimit_))); } return Impl_->Parse(); } private: - NYT::NYson::IYsonConsumer* Consumer_; + NYT::NYson::IYsonConsumer* Consumer_; IInputStream* Stream_; bool EnableLinePositionInfo_; TMaybe<ui64> MemoryLimit_; @@ -159,7 +159,7 @@ namespace NYson { //////////////////////////////////////////////////////////////////////////////// TYsonListParser::TYsonListParser( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, IInputStream* stream, bool enableLinePositionInfo, TMaybe<ui64> memoryLimit) diff --git a/library/cpp/yson/parser.h b/library/cpp/yson/parser.h index dce35a8cd4..f9d9423e3b 100644 --- a/library/cpp/yson/parser.h +++ b/library/cpp/yson/parser.h @@ -7,19 +7,19 @@ class IInputStream; -namespace NYT::NYson { -struct IYsonConsumer; -} // namespace NYT::NYson - +namespace NYT::NYson { +struct IYsonConsumer; +} // namespace NYT::NYson + namespace NYson { //////////////////////////////////////////////////////////////////////////////// class TYsonParser { public: TYsonParser( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, IInputStream* stream, - EYsonType type = ::NYson::EYsonType::Node, + EYsonType type = ::NYson::EYsonType::Node, bool enableLinePositionInfo = false, TMaybe<ui64> memoryLimit = Nothing()); @@ -37,13 +37,13 @@ namespace NYson { class TStatelessYsonParser { public: TStatelessYsonParser( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, bool enableLinePositionInfo = false, TMaybe<ui64> memoryLimit = Nothing()); ~TStatelessYsonParser(); - void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node); + void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node); private: class TImpl; @@ -55,7 +55,7 @@ namespace NYson { class TYsonListParser { public: TYsonListParser( - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, IInputStream* stream, bool enableLinePositionInfo = false, TMaybe<ui64> memoryLimit = Nothing()); @@ -73,8 +73,8 @@ namespace NYson { void ParseYsonStringBuffer( const TStringBuf& buffer, - NYT::NYson::IYsonConsumer* consumer, - EYsonType type = ::NYson::EYsonType::Node, + NYT::NYson::IYsonConsumer* consumer, + EYsonType type = ::NYson::EYsonType::Node, bool enableLinePositionInfo = false, TMaybe<ui64> memoryLimit = Nothing()); diff --git a/library/cpp/yson/parser_detail.h b/library/cpp/yson/parser_detail.h index 44223caf12..32c1f7fa84 100644 --- a/library/cpp/yson/parser_detail.h +++ b/library/cpp/yson/parser_detail.h @@ -22,15 +22,15 @@ namespace NYson { void DoParse(EYsonType ysonType) { switch (ysonType) { - case ::NYson::EYsonType::Node: + case ::NYson::EYsonType::Node: ParseNode<true>(); break; - case ::NYson::EYsonType::ListFragment: + case ::NYson::EYsonType::ListFragment: ParseListFragment<true>(EndSymbol); break; - case ::NYson::EYsonType::MapFragment: + case ::NYson::EYsonType::MapFragment: ParseMapFragment<true>(EndSymbol); break; @@ -305,7 +305,7 @@ namespace NYson { template <class TConsumer, class TBlockStream> void ParseYsonStreamImpl( const TBlockStream& blockStream, - NYT::NYson::IYsonConsumer* consumer, + NYT::NYson::IYsonConsumer* consumer, EYsonType parsingMode, bool enableLinePositionInfo, TMaybe<ui64> memoryLimit) { @@ -322,7 +322,7 @@ namespace NYson { class TStatelessYsonParserImplBase { public: - virtual void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node) = 0; + virtual void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node) = 0; virtual ~TStatelessYsonParserImplBase() { } @@ -341,7 +341,7 @@ namespace NYson { { } - void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node) override { + void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node) override { Parser.SetBuffer(data.begin(), data.end()); Parser.DoParse(type); } diff --git a/library/cpp/yson/public.h b/library/cpp/yson/public.h index 1ed793592b..284e72ad4f 100644 --- a/library/cpp/yson/public.h +++ b/library/cpp/yson/public.h @@ -3,18 +3,18 @@ #include <library/cpp/yt/misc/enum.h> #include <util/generic/yexception.h> -#include <library/cpp/yt/yson_string/public.h> -#include <library/cpp/yt/yson/public.h> - +#include <library/cpp/yt/yson_string/public.h> +#include <library/cpp/yt/yson/public.h> + namespace NYson { - + //////////////////////////////////////////////////////////////////////////////// - using NYT::NYson::EYsonFormat; - using NYT::NYson::EYsonType; - - class TYsonStringBuf; + using NYT::NYson::EYsonFormat; + using NYT::NYson::EYsonType; + class TYsonStringBuf; + struct TYsonConsumerBase; class TYsonWriter; diff --git a/library/cpp/yson/string-inl.h b/library/cpp/yson/string-inl.h index 92e9ab4531..a730079387 100644 --- a/library/cpp/yson/string-inl.h +++ b/library/cpp/yson/string-inl.h @@ -1,57 +1,57 @@ -#pragma once - -#ifndef STRING_INL_H_ -#error "Direct inclusion of this file is not allowed, include string.h" -// For the sake of sane code completion. -#include "string.h" -#endif - -#include <util/str_stl.h> - -namespace NYson { - -//////////////////////////////////////////////////////////////////////////////// - -namespace NDetail { - -template <typename TLeft, typename TRight> -bool Equals(const TLeft& lhs, const TRight& rhs) -{ - auto lhsNull = !lhs.operator bool(); - auto rhsNull = !rhs.operator bool(); - if (lhsNull != rhsNull) { - return false; - } - if (lhsNull && rhsNull) { - return true; - } - return - lhs.AsStringBuf() == rhs.AsStringBuf() && - lhs.GetType() == rhs.GetType(); -} - -} // namespace NDetail - -inline bool operator == (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs) -{ - return NDetail::Equals(lhs, rhs); -} - -inline bool operator != (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs) -{ - return !(lhs == rhs); -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYson - -//! A hasher for TYsonStringBuf -template <> -struct THash<NYson::TYsonStringBuf> -{ - size_t operator () (const NYson::TYsonStringBuf& str) const - { - return THash<TStringBuf>()(str.AsStringBuf()); - } -}; +#pragma once + +#ifndef STRING_INL_H_ +#error "Direct inclusion of this file is not allowed, include string.h" +// For the sake of sane code completion. +#include "string.h" +#endif + +#include <util/str_stl.h> + +namespace NYson { + +//////////////////////////////////////////////////////////////////////////////// + +namespace NDetail { + +template <typename TLeft, typename TRight> +bool Equals(const TLeft& lhs, const TRight& rhs) +{ + auto lhsNull = !lhs.operator bool(); + auto rhsNull = !rhs.operator bool(); + if (lhsNull != rhsNull) { + return false; + } + if (lhsNull && rhsNull) { + return true; + } + return + lhs.AsStringBuf() == rhs.AsStringBuf() && + lhs.GetType() == rhs.GetType(); +} + +} // namespace NDetail + +inline bool operator == (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs) +{ + return NDetail::Equals(lhs, rhs); +} + +inline bool operator != (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs) +{ + return !(lhs == rhs); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYson + +//! A hasher for TYsonStringBuf +template <> +struct THash<NYson::TYsonStringBuf> +{ + size_t operator () (const NYson::TYsonStringBuf& str) const + { + return THash<TStringBuf>()(str.AsStringBuf()); + } +}; diff --git a/library/cpp/yson/writer.cpp b/library/cpp/yson/writer.cpp index 054459f9f5..f7b9a63225 100644 --- a/library/cpp/yson/writer.cpp +++ b/library/cpp/yson/writer.cpp @@ -155,17 +155,17 @@ namespace NYson { } bool TYsonWriter::IsTopLevelFragmentContext() const { - return Depth == 0 && (Type == ::NYson::EYsonType::ListFragment || Type == ::NYson::EYsonType::MapFragment); + return Depth == 0 && (Type == ::NYson::EYsonType::ListFragment || Type == ::NYson::EYsonType::MapFragment); } void TYsonWriter::EndNode() { if (IsTopLevelFragmentContext()) { ETokenType separatorToken = - Type == ::NYson::EYsonType::ListFragment + Type == ::NYson::EYsonType::ListFragment ? ListItemSeparatorToken : KeyedItemSeparatorToken; Stream->Write(TokenTypeToChar(separatorToken)); - if (Format == EYsonFormat::Text || Format == EYsonFormat::Pretty) { + if (Format == EYsonFormat::Text || Format == EYsonFormat::Pretty) { Stream->Write('\n'); } } @@ -183,7 +183,7 @@ namespace NYson { Stream->Write(TokenTypeToChar(separatorToken)); } - if (Format == EYsonFormat::Pretty) { + if (Format == EYsonFormat::Pretty) { Stream->Write('\n'); WriteIndent(); } @@ -194,7 +194,7 @@ namespace NYson { void TYsonWriter::EndCollection(ETokenType endToken) { --Depth; - if (Format == EYsonFormat::Pretty && !BeforeFirstItem) { + if (Format == EYsonFormat::Pretty && !BeforeFirstItem) { Stream->Write('\n'); WriteIndent(); } @@ -203,7 +203,7 @@ namespace NYson { } void TYsonWriter::WriteStringScalar(const TStringBuf& value) { - if (Format == EYsonFormat::Binary) { + if (Format == EYsonFormat::Binary) { Stream->Write(NDetail::StringMarker); WriteVarInt32(Stream, static_cast<i32>(value.length())); Stream->Write(value.begin(), value.length()); @@ -214,13 +214,13 @@ namespace NYson { } } - void TYsonWriter::OnStringScalar(TStringBuf value) { + void TYsonWriter::OnStringScalar(TStringBuf value) { WriteStringScalar(value); EndNode(); } void TYsonWriter::OnInt64Scalar(i64 value) { - if (Format == EYsonFormat::Binary) { + if (Format == EYsonFormat::Binary) { Stream->Write(NDetail::Int64Marker); WriteVarInt64(Stream, value); } else { @@ -230,7 +230,7 @@ namespace NYson { } void TYsonWriter::OnUint64Scalar(ui64 value) { - if (Format == EYsonFormat::Binary) { + if (Format == EYsonFormat::Binary) { Stream->Write(NDetail::Uint64Marker); WriteVarUInt64(Stream, value); } else { @@ -241,7 +241,7 @@ namespace NYson { } void TYsonWriter::OnDoubleScalar(double value) { - if (Format == EYsonFormat::Binary) { + if (Format == EYsonFormat::Binary) { Stream->Write(NDetail::DoubleMarker); Stream->Write(&value, sizeof(double)); } else { @@ -255,7 +255,7 @@ namespace NYson { } void TYsonWriter::OnBooleanScalar(bool value) { - if (Format == EYsonFormat::Binary) { + if (Format == EYsonFormat::Binary) { Stream->Write(value ? NDetail::TrueMarker : NDetail::FalseMarker); } else { Stream->Write(value ? "%true" : "%false"); @@ -285,16 +285,16 @@ namespace NYson { BeginCollection(BeginMapToken); } - void TYsonWriter::OnKeyedItem(TStringBuf key) { + void TYsonWriter::OnKeyedItem(TStringBuf key) { CollectionItem(KeyedItemSeparatorToken); WriteStringScalar(key); - if (Format == NYson::EYsonFormat::Pretty) { + if (Format == NYson::EYsonFormat::Pretty) { Stream->Write(' '); } Stream->Write(TokenTypeToChar(KeyValueSeparatorToken)); - if (Format == NYson::EYsonFormat::Pretty) { + if (Format == NYson::EYsonFormat::Pretty) { Stream->Write(' '); } @@ -312,12 +312,12 @@ namespace NYson { void TYsonWriter::OnEndAttributes() { EndCollection(EndAttributesToken); - if (Format == NYson::EYsonFormat::Pretty) { + if (Format == NYson::EYsonFormat::Pretty) { Stream->Write(' '); } } - void TYsonWriter::OnRaw(TStringBuf yson, EYsonType type) { + void TYsonWriter::OnRaw(TStringBuf yson, EYsonType type) { if (EnableRaw) { Stream->Write(yson); BeforeFirstItem = false; diff --git a/library/cpp/yson/writer.h b/library/cpp/yson/writer.h index 40f5d7d501..7e61d783d4 100644 --- a/library/cpp/yson/writer.h +++ b/library/cpp/yson/writer.h @@ -27,11 +27,11 @@ namespace NYson { public: TYsonWriter( IOutputStream* stream, - EYsonFormat format = EYsonFormat::Binary, - EYsonType type = ::NYson::EYsonType::Node, + EYsonFormat format = EYsonFormat::Binary, + EYsonType type = ::NYson::EYsonType::Node, bool enableRaw = false); - void OnStringScalar(TStringBuf value) override; + void OnStringScalar(TStringBuf value) override; void OnInt64Scalar(i64 value) override; void OnUint64Scalar(ui64 value) override; void OnDoubleScalar(double value) override; @@ -43,13 +43,13 @@ namespace NYson { void OnEndList() override; void OnBeginMap() override; - void OnKeyedItem(TStringBuf key) override; + void OnKeyedItem(TStringBuf key) override; void OnEndMap() override; void OnBeginAttributes() override; void OnEndAttributes() override; - void OnRaw(TStringBuf yson, EYsonType type = ::NYson::EYsonType::Node) override; + void OnRaw(TStringBuf yson, EYsonType type = ::NYson::EYsonType::Node) override; TState State() const; void Reset(const TState& state); @@ -81,8 +81,8 @@ namespace NYson { void ReformatYsonStream( IInputStream* input, IOutputStream* output, - EYsonFormat format = EYsonFormat::Binary, - EYsonType type = ::NYson::EYsonType::Node); + EYsonFormat format = EYsonFormat::Binary, + EYsonType type = ::NYson::EYsonType::Node); //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yson/ya.make b/library/cpp/yson/ya.make index c55a189b10..f5d00f564a 100644 --- a/library/cpp/yson/ya.make +++ b/library/cpp/yson/ya.make @@ -5,11 +5,11 @@ OWNER( g:yt ) -PEERDIR( +PEERDIR( library/cpp/yt/misc - library/cpp/yt/yson -) - + library/cpp/yt/yson +) + SRCS( consumer.cpp lexer.cpp diff --git a/library/cpp/yt/memory/new-inl.h b/library/cpp/yt/memory/new-inl.h index 0a84818516..fea43ca64c 100644 --- a/library/cpp/yt/memory/new-inl.h +++ b/library/cpp/yt/memory/new-inl.h @@ -103,11 +103,11 @@ Y_FORCE_INLINE void* AllignedMalloc(size_t size, size_t allignment) #endif } -template <class... Args> -Y_FORCE_INLINE void CustomInitialize(Args... args) -{ - Y_UNUSED(args...); -} +template <class... Args> +Y_FORCE_INLINE void CustomInitialize(Args... args) +{ + Y_UNUSED(args...); +} template <class T> Y_FORCE_INLINE auto CustomInitialize(T* ptr) -> decltype(&T::InitializeRefCounted, void()) diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp index 7440ac3fdd..6969448dc9 100644 --- a/library/cpp/yt/string/string.cpp +++ b/library/cpp/yt/string/string.cpp @@ -65,7 +65,7 @@ TString CamelCaseToUnderscoreCase(TStringBuf str) TString TrimLeadingWhitespaces(const TString& str) { - for (int i = 0; i < static_cast<int>(str.size()); ++i) { + for (int i = 0; i < static_cast<int>(str.size()); ++i) { if (str[i] != ' ') { return str.substr(i); } diff --git a/library/cpp/yt/ya.make b/library/cpp/yt/ya.make index f4d43806f4..d80b98d9e4 100644 --- a/library/cpp/yt/ya.make +++ b/library/cpp/yt/ya.make @@ -5,7 +5,7 @@ RECURSE( misc string system - yson + yson yson_string ) diff --git a/library/cpp/yt/yson/consumer.cpp b/library/cpp/yt/yson/consumer.cpp index 9b68ee8a22..d3aec4aa5e 100644 --- a/library/cpp/yt/yson/consumer.cpp +++ b/library/cpp/yt/yson/consumer.cpp @@ -1,16 +1,16 @@ -#include "consumer.h" - -#include <library/cpp/yt/yson_string/string.h> - -namespace NYT::NYson { - -//////////////////////////////////////////////////////////////////////////////// - +#include "consumer.h" + +#include <library/cpp/yt/yson_string/string.h> + +namespace NYT::NYson { + +//////////////////////////////////////////////////////////////////////////////// + void IYsonConsumer::OnRaw(const TYsonStringBuf& yson) { - OnRaw(yson.AsStringBuf(), yson.GetType()); -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT::NYson + OnRaw(yson.AsStringBuf(), yson.GetType()); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NYson diff --git a/library/cpp/yt/yson/consumer.h b/library/cpp/yt/yson/consumer.h index ea5f586b91..ce295ad608 100644 --- a/library/cpp/yt/yson/consumer.h +++ b/library/cpp/yt/yson/consumer.h @@ -1,111 +1,111 @@ -#pragma once - -#include <util/generic/strbuf.h> - -#include <util/system/defaults.h> - -#include <library/cpp/yt/yson_string/public.h> - -namespace NYT::NYson { - -//////////////////////////////////////////////////////////////////////////////// - -//! A SAX-like interface for parsing a YSON stream. +#pragma once + +#include <util/generic/strbuf.h> + +#include <util/system/defaults.h> + +#include <library/cpp/yt/yson_string/public.h> + +namespace NYT::NYson { + +//////////////////////////////////////////////////////////////////////////////// + +//! A SAX-like interface for parsing a YSON stream. struct IYsonConsumer { virtual ~IYsonConsumer() = default; - - //! The current item is a string scalar (IStringNode). - /*! - * \param value A scalar value. - */ - virtual void OnStringScalar(TStringBuf value) = 0; - - //! The current item is an integer scalar (IInt64Node). - /*! - * \param value A scalar value. - */ - virtual void OnInt64Scalar(i64 value) = 0; - - //! The current item is an integer scalar (IUint64Node). - /*! - * \param value A scalar value. - */ - virtual void OnUint64Scalar(ui64 scalar) = 0; - - //! The current item is an FP scalar (IDoubleNode). - /*! - * \param value A scalar value. - */ - virtual void OnDoubleScalar(double value) = 0; - - //! The current item is an boolean scalar (IBooleanNode). - /*! - * \param value A scalar value. - */ - virtual void OnBooleanScalar(bool value) = 0; - - //! The current item is an entity (IEntityNode). - virtual void OnEntity() = 0; - - //! Starts a list (IListNode). - /*! - * The events describing a list are raised as follows: - * - #OnBeginList - * - For each item: #OnListItem followed by the description of the item - * - #OnEndList - */ - virtual void OnBeginList() = 0; - - //! Designates a list item. - virtual void OnListItem() = 0; - - //! Ends the current list. - virtual void OnEndList() = 0; - - //! Starts a map (IMapNode). - /*! - * The events describing a map are raised as follows: - * - #OnBeginMap - * - For each item: #OnKeyedItem followed by the description of the item - * - #OnEndMap - */ - virtual void OnBeginMap() = 0; - - //! Designates a keyed item (in map or in attributes). - /*! - * \param key Item key in the map. - */ - virtual void OnKeyedItem(TStringBuf key) = 0; - - //! Ends the current map. - virtual void OnEndMap() = 0; - - //! Starts attributes. - /*! - * An arbitrary node may be preceeded by attributes. - * - * The events describing attributes are raised as follows: - * - #OnBeginAttributes - * - For each item: #OnKeyedItem followed by the description of the item - * - #OnEndAttributes - */ - virtual void OnBeginAttributes() = 0; - - //! Ends the current attribute list. - virtual void OnEndAttributes() = 0; - - //! Inserts YSON-serialized node or fragment. - /*! - * \param yson Serialized data. - * \param type Type of data. - */ - virtual void OnRaw(TStringBuf yson, EYsonType type) = 0; - - // Extension methods. - void OnRaw(const TYsonStringBuf& yson); -}; - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT::NYson + + //! The current item is a string scalar (IStringNode). + /*! + * \param value A scalar value. + */ + virtual void OnStringScalar(TStringBuf value) = 0; + + //! The current item is an integer scalar (IInt64Node). + /*! + * \param value A scalar value. + */ + virtual void OnInt64Scalar(i64 value) = 0; + + //! The current item is an integer scalar (IUint64Node). + /*! + * \param value A scalar value. + */ + virtual void OnUint64Scalar(ui64 scalar) = 0; + + //! The current item is an FP scalar (IDoubleNode). + /*! + * \param value A scalar value. + */ + virtual void OnDoubleScalar(double value) = 0; + + //! The current item is an boolean scalar (IBooleanNode). + /*! + * \param value A scalar value. + */ + virtual void OnBooleanScalar(bool value) = 0; + + //! The current item is an entity (IEntityNode). + virtual void OnEntity() = 0; + + //! Starts a list (IListNode). + /*! + * The events describing a list are raised as follows: + * - #OnBeginList + * - For each item: #OnListItem followed by the description of the item + * - #OnEndList + */ + virtual void OnBeginList() = 0; + + //! Designates a list item. + virtual void OnListItem() = 0; + + //! Ends the current list. + virtual void OnEndList() = 0; + + //! Starts a map (IMapNode). + /*! + * The events describing a map are raised as follows: + * - #OnBeginMap + * - For each item: #OnKeyedItem followed by the description of the item + * - #OnEndMap + */ + virtual void OnBeginMap() = 0; + + //! Designates a keyed item (in map or in attributes). + /*! + * \param key Item key in the map. + */ + virtual void OnKeyedItem(TStringBuf key) = 0; + + //! Ends the current map. + virtual void OnEndMap() = 0; + + //! Starts attributes. + /*! + * An arbitrary node may be preceeded by attributes. + * + * The events describing attributes are raised as follows: + * - #OnBeginAttributes + * - For each item: #OnKeyedItem followed by the description of the item + * - #OnEndAttributes + */ + virtual void OnBeginAttributes() = 0; + + //! Ends the current attribute list. + virtual void OnEndAttributes() = 0; + + //! Inserts YSON-serialized node or fragment. + /*! + * \param yson Serialized data. + * \param type Type of data. + */ + virtual void OnRaw(TStringBuf yson, EYsonType type) = 0; + + // Extension methods. + void OnRaw(const TYsonStringBuf& yson); +}; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NYson diff --git a/library/cpp/yt/yson/public.h b/library/cpp/yt/yson/public.h index 68cdcd38c1..d68c0558e2 100644 --- a/library/cpp/yt/yson/public.h +++ b/library/cpp/yt/yson/public.h @@ -1,11 +1,11 @@ -#pragma once - -namespace NYT::NYson { - -//////////////////////////////////////////////////////////////////////////////// - -struct IYsonConsumer; - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT::NYson +#pragma once + +namespace NYT::NYson { + +//////////////////////////////////////////////////////////////////////////////// + +struct IYsonConsumer; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NYson diff --git a/library/cpp/yt/yson/ya.make b/library/cpp/yt/yson/ya.make index d914352c4b..8aa894d953 100644 --- a/library/cpp/yt/yson/ya.make +++ b/library/cpp/yt/yson/ya.make @@ -1,11 +1,11 @@ -LIBRARY() - -SRCS( - consumer.cpp -) - -PEERDIR( - library/cpp/yt/yson_string -) - -END() +LIBRARY() + +SRCS( + consumer.cpp +) + +PEERDIR( + library/cpp/yt/yson_string +) + +END() diff --git a/tools/ya.make b/tools/ya.make index 51a6b8b426..84515be7f5 100644 --- a/tools/ya.make +++ b/tools/ya.make @@ -152,8 +152,8 @@ RECURSE( testlangmodel thresher titleseq_index_print - tokenize - tokenize/tests + tokenize + tokenize/tests tomaparsertest trans_str triecompiler diff --git a/ydb/core/kqp/host/kqp_host.cpp b/ydb/core/kqp/host/kqp_host.cpp index 44af6d1168..0fd2a3c399 100644 --- a/ydb/core/kqp/host/kqp_host.cpp +++ b/ydb/core/kqp/host/kqp_host.cpp @@ -98,7 +98,7 @@ void FillAstAndPlan(IKqpHost::TQueryResult& queryResult, TExprNode* queryRoot, T queryResult.QueryAst = astStream.Str(); TStringStream planStream; - NYson::TYsonWriter writer(&planStream, NYson::EYsonFormat::Binary); + NYson::TYsonWriter writer(&planStream, NYson::EYsonFormat::Binary); planBuilder.Clear(); planBuilder.WritePlan(writer, queryRoot); queryResult.QueryPlan = planStream.Str(); @@ -112,7 +112,7 @@ void FillAstAndPlan(IKqpHost::TQueryResult& queryResult, const NKikimrKqp::TPrep if (queryResult.QueryPlan.empty()) { TStringStream planStream; - NYson::TYsonWriter writer(&planStream, NYson::EYsonFormat::Binary); + NYson::TYsonWriter writer(&planStream, NYson::EYsonFormat::Binary); writer.OnEntity(); queryResult.QueryPlan = planStream.Str(); } diff --git a/ydb/core/kqp/provider/yql_kikimr_datasink.cpp b/ydb/core/kqp/provider/yql_kikimr_datasink.cpp index 035d6b7701..6e245a6bcb 100644 --- a/ydb/core/kqp/provider/yql_kikimr_datasink.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_datasink.cpp @@ -446,7 +446,7 @@ public: return false; } - bool CollectDiagnostics(NYson::TYsonWriter& writer) override { + bool CollectDiagnostics(NYson::TYsonWriter& writer) override { auto& execResults = SessionCtx->Query().Results; if (!std::find_if(execResults.begin(), execResults.end(), [] (const auto& pair) { return pair.second.Profile; })) diff --git a/ydb/core/kqp/provider/yql_kikimr_exec.cpp b/ydb/core/kqp/provider/yql_kikimr_exec.cpp index ad360fcaeb..64688613a3 100644 --- a/ydb/core/kqp/provider/yql_kikimr_exec.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_exec.cpp @@ -286,9 +286,9 @@ public: auto clusters = Gateway->GetClusters(); Sort(clusters); - auto ysonFormat = (NYson::EYsonFormat)FromString<ui32>(input->Child(0)->Content()); + auto ysonFormat = (NYson::EYsonFormat)FromString<ui32>(input->Child(0)->Content()); TStringStream out; - NYson::TYsonWriter writer(&out, ysonFormat); + NYson::TYsonWriter writer(&out, ysonFormat); writer.OnBeginList(); for (auto& cluster : clusters) { @@ -337,7 +337,7 @@ private: TExprNode::TPtr resultNode; if (fillSettings.Format == IDataProvider::EResultFormat::Yson) { - NYson::EYsonFormat ysonFormat = NCommon::GetYsonFormat(fillSettings); + NYson::EYsonFormat ysonFormat = NCommon::GetYsonFormat(fillSettings); auto yson = KqpResultToYson(*protoValue, ysonFormat, ctx); if (!yson) { diff --git a/ydb/core/kqp/provider/yql_kikimr_provider.cpp b/ydb/core/kqp/provider/yql_kikimr_provider.cpp index 635d164827..f992c5e728 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_provider.cpp @@ -228,7 +228,7 @@ bool TKikimrTableDescription::DoesExist() const { return Metadata->DoesExist; } -void TKikimrTableDescription::ToYson(NYson::TYsonWriter& writer) const { +void TKikimrTableDescription::ToYson(NYson::TYsonWriter& writer) const { YQL_ENSURE(Metadata); auto& meta = *Metadata; diff --git a/ydb/core/kqp/provider/yql_kikimr_provider.h b/ydb/core/kqp/provider/yql_kikimr_provider.h index 6903e6f193..955cad147a 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider.h +++ b/ydb/core/kqp/provider/yql_kikimr_provider.h @@ -188,7 +188,7 @@ public: TMaybe<TString> RelativePath; bool Load(TExprContext& ctx, bool withVirtualColumns = false); - void ToYson(NYson::TYsonWriter& writer) const; + void ToYson(NYson::TYsonWriter& writer) const; TMaybe<ui32> GetKeyColumnIndex(const TString& name) const; const TTypeAnnotationNode* GetColumnType(const TString& name) const; diff --git a/ydb/core/kqp/provider/yql_kikimr_results.cpp b/ydb/core/kqp/provider/yql_kikimr_results.cpp index 8ec93f416d..263f912ed6 100644 --- a/ydb/core/kqp/provider/yql_kikimr_results.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_results.cpp @@ -347,7 +347,7 @@ TVector<NKikimrMiniKQL::TResult*> UnpackKikimrRunResult(const NKikimrMiniKQL::TR return results; } -void KikimrResultToYson(const TStringStream& stream, NYson::TYsonWriter& writer, const NKikimrMiniKQL::TResult& result, +void KikimrResultToYson(const TStringStream& stream, NYson::TYsonWriter& writer, const NKikimrMiniKQL::TResult& result, const TVector<TString>& columnHints, const IDataProvider::TFillSettings& fillSettings, bool& truncated) { truncated = false; @@ -797,7 +797,7 @@ bool CheckKqpResultType(const NKikimrMiniKQL::TResult& kqpResult, const TTypeAnn return true; } -TMaybe<TString> KqpResultToYson(const NKikimrMiniKQL::TResult& kqpResult, const NYson::EYsonFormat& ysonFormat, +TMaybe<TString> KqpResultToYson(const NKikimrMiniKQL::TResult& kqpResult, const NYson::EYsonFormat& ysonFormat, TExprContext& ctx) { YQL_ENSURE(kqpResult.GetType().GetKind() == NKikimrMiniKQL::ETypeKind::Struct); @@ -810,7 +810,7 @@ TMaybe<TString> KqpResultToYson(const NKikimrMiniKQL::TResult& kqpResult, const dataResult.MutableValue()->CopyFrom(kqpResult.GetValue().GetStruct(0)); TStringStream out; - NYson::TYsonWriter writer(&out, ysonFormat, ::NYson::EYsonType::Node, true); + NYson::TYsonWriter writer(&out, ysonFormat, ::NYson::EYsonType::Node, true); writer.OnBeginMap(); writer.OnKeyedItem("Type"); @@ -890,7 +890,7 @@ TMaybe<TString> GetTableListResult(const IKikimrGateway::TListPathResult& res, std::unique_ptr<NKikimrMiniKQL::TResult> packedResult(KikimrResultToProto(result, {}, fillSettings, nullptr)); if (fillSettings.Format == IDataProvider::EResultFormat::Yson) { - NYson::EYsonFormat ysonFormat = NCommon::GetYsonFormat(fillSettings); + NYson::EYsonFormat ysonFormat = NCommon::GetYsonFormat(fillSettings); auto yson = KqpResultToYson(*packedResult, ysonFormat, ctx); if (!yson) { return Nothing(); @@ -912,7 +912,7 @@ TMaybe<TString> GetTableMetadataResult(const TKikimrTableDescription& table, const IDataProvider::TFillSettings& fillSettings, TExprContext& ctx) { TStringStream out; - NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Binary); + NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Binary); table.ToYson(writer); auto metaYson = out.Str(); @@ -927,7 +927,7 @@ TMaybe<TString> GetTableMetadataResult(const TKikimrTableDescription& table, std::unique_ptr<NKikimrMiniKQL::TResult> packedResult(KikimrResultToProto(result, {}, fillSettings, nullptr)); if (fillSettings.Format == IDataProvider::EResultFormat::Yson) { - NYson::EYsonFormat ysonFormat = NCommon::GetYsonFormat(fillSettings); + NYson::EYsonFormat ysonFormat = NCommon::GetYsonFormat(fillSettings); auto yson = KqpResultToYson(*packedResult, ysonFormat, ctx); if (!yson) { return Nothing(); @@ -994,7 +994,7 @@ void TransformerStatsFromProto(const NKikimrKqp::TTransformProfile& proto, IGrap } } -void KikimrReadOpStatsToYson(const NKikimrQueryStats::TReadOpStats& opStats, NYson::TYsonWriter& writer) { +void KikimrReadOpStatsToYson(const NKikimrQueryStats::TReadOpStats& opStats, NYson::TYsonWriter& writer) { writer.OnBeginMap(); writer.OnKeyedItem("Count"); writer.OnUint64Scalar(opStats.GetCount()); @@ -1005,7 +1005,7 @@ void KikimrReadOpStatsToYson(const NKikimrQueryStats::TReadOpStats& opStats, NYs writer.OnEndMap(); } -void KikimrWriteOpStatsToYson(const NKikimrQueryStats::TWriteOpStats& opStats, NYson::TYsonWriter& writer) { +void KikimrWriteOpStatsToYson(const NKikimrQueryStats::TWriteOpStats& opStats, NYson::TYsonWriter& writer) { writer.OnBeginMap(); writer.OnKeyedItem("Count"); writer.OnUint64Scalar(opStats.GetCount()); @@ -1016,7 +1016,7 @@ void KikimrWriteOpStatsToYson(const NKikimrQueryStats::TWriteOpStats& opStats, N writer.OnEndMap(); } -void KikimrTxStatsToYson(const NKikimrQueryStats::TTxStats& txStats, NYson::TYsonWriter& writer) { +void KikimrTxStatsToYson(const NKikimrQueryStats::TTxStats& txStats, NYson::TYsonWriter& writer) { writer.OnBeginMap(); writer.OnKeyedItem("TableAccessStats"); @@ -1069,7 +1069,7 @@ void KikimrTxStatsToYson(const NKikimrQueryStats::TTxStats& txStats, NYson::TYso writer.OnEndMap(); } -void KikimrProfileToYson(const NKikimrKqp::TKqlProfile& kqlProfile, NYson::TYsonWriter& writer) { +void KikimrProfileToYson(const NKikimrKqp::TKqlProfile& kqlProfile, NYson::TYsonWriter& writer) { writer.OnBeginMap(); if (kqlProfile.HasQuery()) { writer.OnKeyedItem("Query"); @@ -1110,7 +1110,7 @@ void KikimrProfileToYson(const NKikimrKqp::TKqlProfile& kqlProfile, NYson::TYson writer.OnEndMap(); } -void KikimrProfileToYson(const NKikimrKqp::TQueryProfile& queryProfile, NYson::TYsonWriter& writer) { +void KikimrProfileToYson(const NKikimrKqp::TQueryProfile& queryProfile, NYson::TYsonWriter& writer) { writer.OnBeginMap(); writer.OnKeyedItem("TransformStats"); diff --git a/ydb/core/kqp/provider/yql_kikimr_results.h b/ydb/core/kqp/provider/yql_kikimr_results.h index c3460f8a07..3c684de6c0 100644 --- a/ydb/core/kqp/provider/yql_kikimr_results.h +++ b/ydb/core/kqp/provider/yql_kikimr_results.h @@ -12,7 +12,7 @@ void GetKikimrUnpackedRunResult(const NKikimrMiniKQL::TResult& runResult, ui32 i TVector<NKikimrMiniKQL::TResult*> UnpackKikimrRunResult(const NKikimrMiniKQL::TResult& runResult, google::protobuf::Arena* arena); -void KikimrResultToYson(const TStringStream& stream, NYson::TYsonWriter& writer, const NKikimrMiniKQL::TResult& result, +void KikimrResultToYson(const TStringStream& stream, NYson::TYsonWriter& writer, const NKikimrMiniKQL::TResult& result, const TVector<TString>& columnHints, const IDataProvider::TFillSettings& fillSettings, bool& truncated); NKikimrMiniKQL::TResult* KikimrResultToProto(const NKikimrMiniKQL::TResult& result, const TVector<TString>& columnHints, @@ -27,7 +27,7 @@ TExprNode::TPtr ParseKikimrProtoValue(const NKikimrMiniKQL::TType& type, const N bool CheckKqpResultType(const NKikimrMiniKQL::TResult& kqpResult, const TTypeAnnotationNode& expectedType, TExprContext& ctx); -TMaybe<TString> KqpResultToYson(const NKikimrMiniKQL::TResult& kqpResult, const NYson::EYsonFormat& ysonFormat, +TMaybe<TString> KqpResultToYson(const NKikimrMiniKQL::TResult& kqpResult, const NYson::EYsonFormat& ysonFormat, TExprContext& ctx); TMaybe<TString> GetTableListResult(const IKikimrGateway::TListPathResult& res, @@ -42,7 +42,7 @@ void TransformerStatsToProto(const TString& name, const IGraphTransformer::TStat void TransformerStatsFromProto(const NKikimrKqp::TTransformProfile& proto, IGraphTransformer::TStatistics& stats, TString& name); -void KikimrProfileToYson(const NKikimrKqp::TKqlProfile& kqlProfile, NYson::TYsonWriter& writer); -void KikimrProfileToYson(const NKikimrKqp::TQueryProfile& profile, NYson::TYsonWriter& writer); +void KikimrProfileToYson(const NKikimrKqp::TKqlProfile& kqlProfile, NYson::TYsonWriter& writer); +void KikimrProfileToYson(const NKikimrKqp::TQueryProfile& profile, NYson::TYsonWriter& writer); } // namespace NYql diff --git a/ydb/core/kqp/ut/common/kqp_ut_common.cpp b/ydb/core/kqp/ut/common/kqp_ut_common.cpp index 9bc7889f92..cd7aa1b7a6 100644 --- a/ydb/core/kqp/ut/common/kqp_ut_common.cpp +++ b/ydb/core/kqp/ut/common/kqp_ut_common.cpp @@ -412,7 +412,7 @@ void TKikimrRunner::Initialize(const TKikimrSettings& settings) { TString ReformatYson(const TString& yson) { TStringStream ysonInput(yson); TStringStream output; - NYson::ReformatYsonStream(&ysonInput, &output, NYson::EYsonFormat::Text); + NYson::ReformatYsonStream(&ysonInput, &output, NYson::EYsonFormat::Text); return output.Str(); } @@ -422,7 +422,7 @@ void CompareYson(const TString& expected, const TString& actual) { void CompareYson(const TString& expected, const NKikimrMiniKQL::TResult& actual) { TStringStream ysonStream; - NYson::TYsonWriter writer(&ysonStream, NYson::EYsonFormat::Text); + NYson::TYsonWriter writer(&ysonStream, NYson::EYsonFormat::Text); NYql::IDataProvider::TFillSettings fillSettings; bool truncated; KikimrResultToYson(ysonStream, writer, actual, {}, fillSettings, truncated); @@ -524,7 +524,7 @@ TDataQueryResult ExecQueryAndTestResult(TSession& session, const TString& query, return result; } -void FillProfile(NYdb::NTable::TScanQueryPart& streamPart, NYson::TYsonWriter& writer, TVector<TString>* profiles, +void FillProfile(NYdb::NTable::TScanQueryPart& streamPart, NYson::TYsonWriter& writer, TVector<TString>* profiles, ui32 profileIndex) { Y_UNUSED(streamPart); @@ -533,7 +533,7 @@ void FillProfile(NYdb::NTable::TScanQueryPart& streamPart, NYson::TYsonWriter& w Y_UNUSED(profileIndex); } -void FillProfile(NYdb::NExperimental::TStreamPart& streamPart, NYson::TYsonWriter& writer, TVector<TString>* profiles, +void FillProfile(NYdb::NExperimental::TStreamPart& streamPart, NYson::TYsonWriter& writer, TVector<TString>* profiles, ui32 profileIndex) { if (streamPart.HasProfile()) { @@ -549,7 +549,7 @@ void FillProfile(NYdb::NExperimental::TStreamPart& streamPart, NYson::TYsonWrite } } -void PrintResultSet(const NYdb::TResultSet& resultSet, NYson::TYsonWriter& writer) { +void PrintResultSet(const NYdb::TResultSet& resultSet, NYson::TYsonWriter& writer) { auto columns = resultSet.GetColumnsMeta(); NYdb::TResultSetParser parser(resultSet); @@ -567,7 +567,7 @@ void PrintResultSet(const NYdb::TResultSet& resultSet, NYson::TYsonWriter& write template<typename TIterator> TString StreamResultToYsonImpl(TIterator& it, TVector<TString>* profiles) { TStringStream out; - NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Text, ::NYson::EYsonType::Node, true); + NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Text, ::NYson::EYsonType::Node, true); writer.OnBeginList(); ui32 profileIndex = 0; @@ -603,7 +603,7 @@ TString StreamResultToYson(NYdb::NTable::TScanQueryPartIterator& it) { TString StreamResultToYson(NYdb::NScripting::TYqlResultPartIterator& it) { TStringStream out; - NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Text, ::NYson::EYsonType::Node, true); + NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Text, ::NYson::EYsonType::Node, true); writer.OnBeginList(); ui32 currentIndex = 0; @@ -643,7 +643,7 @@ TCollectedStreamResult CollectStreamResultImpl(TIterator& it) { TCollectedStreamResult res; TStringStream out; - NYson::TYsonWriter resultSetWriter(&out, NYson::EYsonFormat::Text, ::NYson::EYsonType::Node, true); + NYson::TYsonWriter resultSetWriter(&out, NYson::EYsonFormat::Text, ::NYson::EYsonType::Node, true); resultSetWriter.OnBeginList(); for (;;) { diff --git a/ydb/core/sys_view/ut_kqp.cpp b/ydb/core/sys_view/ut_kqp.cpp index 5e90eb5992..38a56d7e0c 100644 --- a/ydb/core/sys_view/ut_kqp.cpp +++ b/ydb/core/sys_view/ut_kqp.cpp @@ -124,7 +124,7 @@ private: public: TYsonFieldChecker(const TString& ysonString, size_t fieldCount) { - Root = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); + Root = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); UNIT_ASSERT(Root.IsList()); UNIT_ASSERT_VALUES_EQUAL(Root.AsList().size(), 1); @@ -891,7 +891,7 @@ Y_UNIT_TEST_SUITE(SystemView) { UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString()); ysonString = NKqp::StreamResultToYson(it); - auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); + auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); UNIT_ASSERT(node.IsList()); rowCount = node.AsList().size(); @@ -947,7 +947,7 @@ Y_UNIT_TEST_SUITE(SystemView) { UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString()); ysonString = NKqp::StreamResultToYson(it); - auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); + auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); UNIT_ASSERT(node.IsList()); rowCount = node.AsList().size(); @@ -1000,7 +1000,7 @@ Y_UNIT_TEST_SUITE(SystemView) { UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString()); ysonString = NKqp::StreamResultToYson(it); - auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); + auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); UNIT_ASSERT(node.IsList()); rowCount = node.AsList().size(); @@ -1052,7 +1052,7 @@ Y_UNIT_TEST_SUITE(SystemView) { UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString()); ysonString = NKqp::StreamResultToYson(it); - auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); + auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); UNIT_ASSERT(node.IsList()); rowCount = node.AsList().size(); @@ -1088,7 +1088,7 @@ Y_UNIT_TEST_SUITE(SystemView) { UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString()); auto ysonString = NKqp::StreamResultToYson(it); - auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); + auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); UNIT_ASSERT(node.IsList()); rowCount = node.AsList().size(); @@ -1728,7 +1728,7 @@ Y_UNIT_TEST_SUITE(SystemView) { UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString()); ysonString = NKqp::StreamResultToYson(it); - auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); + auto node = NYT::NodeFromYsonString(ysonString, ::NYson::EYsonType::Node); UNIT_ASSERT(node.IsList()); rowCount = node.AsList().size(); diff --git a/ydb/core/tx/datashard/datashard_ut_kqp.cpp b/ydb/core/tx/datashard/datashard_ut_kqp.cpp index d3145951a4..0498928cbe 100644 --- a/ydb/core/tx/datashard/datashard_ut_kqp.cpp +++ b/ydb/core/tx/datashard/datashard_ut_kqp.cpp @@ -23,7 +23,7 @@ namespace { TString ReformatYson(const TString& yson) { TStringStream ysonInput(yson); TStringStream output; - NYson::ReformatYsonStream(&ysonInput, &output, NYson::EYsonFormat::Text); + NYson::ReformatYsonStream(&ysonInput, &output, NYson::EYsonFormat::Text); return output.Str(); } @@ -160,7 +160,7 @@ private: SendRequest(*Server->GetRuntime(), client, MakeStreamRequest(client, Query, true)); TStringStream out; - NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Text, ::NYson::EYsonType::Node, true); + NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Text, ::NYson::EYsonType::Node, true); writer.OnBeginList(); while (true) { diff --git a/ydb/core/yq/libs/result_formatter/result_formatter.cpp b/ydb/core/yq/libs/result_formatter/result_formatter.cpp index 394832b7e5..286b7890a0 100644 --- a/ydb/core/yq/libs/result_formatter/result_formatter.cpp +++ b/ydb/core/yq/libs/result_formatter/result_formatter.cpp @@ -346,7 +346,7 @@ TString FormatSchema(const YandexQuery::Schema& schema) typedColumns.emplace_back(c.name(), typeAnnotation); } - return NYql::NCommon::WriteTypeToYson(MakeStructType(typedColumns, ctx), NYson::EYsonFormat::Text); + return NYql::NCommon::WriteTypeToYson(MakeStructType(typedColumns, ctx), NYson::EYsonFormat::Text); } void FormatResultSet(NJson::TJsonValue& root, const NYdb::TResultSet& resultSet) diff --git a/ydb/library/yql/core/facade/yql_facade.cpp b/ydb/library/yql/core/facade/yql_facade.cpp index b74abc1c34..627c418216 100644 --- a/ydb/library/yql/core/facade/yql_facade.cpp +++ b/ydb/library/yql/core/facade/yql_facade.cpp @@ -246,8 +246,8 @@ TProgram::TProgram( , Modules_(modules) , ExprRoot_(nullptr) , SessionId_(sessionId) - , ResultFormat_(NYson::EYsonFormat::Binary) - , OutputFormat_(NYson::EYsonFormat::Pretty) + , ResultFormat_(NYson::EYsonFormat::Binary) + , OutputFormat_(NYson::EYsonFormat::Pretty) , EnableRangeComputeFor_(enableRangeComputeFor) { if (SessionId_.empty()) { @@ -271,7 +271,7 @@ TProgram::~TProgram() { } } -void TProgram::ConfigureYsonResultFormat(NYson::EYsonFormat format) { +void TProgram::ConfigureYsonResultFormat(NYson::EYsonFormat format) { ResultFormat_ = format; OutputFormat_ = format; } @@ -1026,7 +1026,7 @@ TMaybe<TString> TProgram::GetQueryPlan() { TStringStream planStream; planStream.Reserve(DEFAULT_PLAN_BUF_SIZE); - NYson::TYsonWriter writer(&planStream, OutputFormat_); + NYson::TYsonWriter writer(&planStream, OutputFormat_); PlanBuilder_->WritePlan(writer, ExprRoot_); return planStream.Str(); @@ -1049,7 +1049,7 @@ TMaybe<TString> TProgram::GetDiagnostics() { } TStringStream out; - NYson::TYsonWriter writer(&out, DiagnosticFormat_.GetOrElse(ResultFormat_)); + NYson::TYsonWriter writer(&out, DiagnosticFormat_.GetOrElse(ResultFormat_)); writer.OnBeginMap(); writer.OnKeyedItem("Write"); @@ -1093,7 +1093,7 @@ TMaybe<TString> TProgram::GetTasksInfo() { bool hasTasks = false; TStringStream out; - NYson::TYsonWriter writer(&out, ResultFormat_); + NYson::TYsonWriter writer(&out, ResultFormat_); writer.OnBeginMap(); writer.OnKeyedItem("Write"); @@ -1125,7 +1125,7 @@ TMaybe<TString> TProgram::GetStatistics(bool totalOnly) { } TStringStream out; - NYson::TYsonWriter writer(&out); + NYson::TYsonWriter writer(&out); // Header writer.OnBeginMap(); writer.OnKeyedItem("ExecutionStatistics"); @@ -1135,7 +1135,7 @@ TMaybe<TString> TProgram::GetStatistics(bool totalOnly) { bool hasStatistics = false; for (auto& datasink : TypeCtx_->DataSinks) { TStringStream providerOut; - NYson::TYsonWriter providerWriter(&providerOut); + NYson::TYsonWriter providerWriter(&providerOut); if (datasink->CollectStatistics(providerWriter, totalOnly)) { writer.OnKeyedItem(datasink->GetName()); writer.OnRaw(providerOut.Str()); @@ -1175,11 +1175,11 @@ TMaybe<TString> TProgram::GetDiscoveredData() { } TStringStream out; - NYson::TYsonWriter writer(&out); + NYson::TYsonWriter writer(&out); writer.OnBeginMap(); for (auto& datasource: TypeCtx_->DataSources) { TStringStream providerOut; - NYson::TYsonWriter providerWriter(&providerOut); + NYson::TYsonWriter providerWriter(&providerOut); if (datasource->CollectDiscoveredData(providerWriter)) { writer.OnKeyedItem(datasource->GetName()); writer.OnRaw(providerOut.Str()); @@ -1234,7 +1234,7 @@ TString TProgram::ResultsAsString() const { return ""; TStringStream resultOut; - NYson::TYsonWriter yson(&resultOut, OutputFormat_); + NYson::TYsonWriter yson(&resultOut, OutputFormat_); yson.OnBeginList(); for (const auto& result: Results()) { yson.OnListItem(); diff --git a/ydb/library/yql/core/facade/yql_facade.h b/ydb/library/yql/core/facade/yql_facade.h index 1f8f47681d..25628a2c73 100644 --- a/ydb/library/yql/core/facade/yql_facade.h +++ b/ydb/library/yql/core/facade/yql_facade.h @@ -208,7 +208,7 @@ public: TMaybe<TString> GetQueryAst(); TMaybe<TString> GetQueryPlan(); - void SetDiagnosticFormat(NYson::EYsonFormat format) { + void SetDiagnosticFormat(NYson::EYsonFormat format) { DiagnosticFormat_ = format; } @@ -222,13 +222,13 @@ public: TMaybe<TString> GetDiscoveredData(); TString ResultsAsString() const; - void ConfigureYsonResultFormat(NYson::EYsonFormat format); + void ConfigureYsonResultFormat(NYson::EYsonFormat format); inline IOutputStream* ExprStream() const { return ExprStream_; } inline IOutputStream* PlanStream() const { return PlanStream_; } - NYson::EYsonFormat GetResultFormat() const { return ResultFormat_; } - NYson::EYsonFormat GetOutputFormat() const { return OutputFormat_; } + NYson::EYsonFormat GetResultFormat() const { return ResultFormat_; } + NYson::EYsonFormat GetOutputFormat() const { return OutputFormat_; } void SetValidateOptions(NUdf::EValidateMode validateMode); void SetDisableNativeUdfSupport(bool disable); @@ -368,9 +368,9 @@ private: TAutoPtr<IGraphTransformer> Transformer_; TIntrusivePtr<TResultProviderConfig> ResultProviderConfig_; bool SupportsResultPosition_ = false; - NYson::EYsonFormat ResultFormat_; - NYson::EYsonFormat OutputFormat_; - TMaybe<NYson::EYsonFormat> DiagnosticFormat_; + NYson::EYsonFormat ResultFormat_; + NYson::EYsonFormat OutputFormat_; + TMaybe<NYson::EYsonFormat> DiagnosticFormat_; NUdf::EValidateMode ValidateMode_ = NUdf::EValidateMode::None; bool DisableNativeUdfSupport_ = false; bool UseTableMetaFromGraph_ = false; diff --git a/ydb/library/yql/core/services/yql_eval_expr.cpp b/ydb/library/yql/core/services/yql_eval_expr.cpp index 811f22a605..68b353179c 100644 --- a/ydb/library/yql/core/services/yql_eval_expr.cpp +++ b/ydb/library/yql/core/services/yql_eval_expr.cpp @@ -959,7 +959,7 @@ IGraphTransformer::TStatus EvaluateExpression(const TExprNode::TPtr& input, TExp .Value(TString()) .Build() .FormatDetails() - .Value(ToString((ui32)NYson::EYsonFormat::Binary)) + .Value(ToString((ui32)NYson::EYsonFormat::Binary)) .Build() .Settings().Build() .Format() diff --git a/ydb/library/yql/core/services/yql_out_transformers.cpp b/ydb/library/yql/core/services/yql_out_transformers.cpp index d8363095f8..0502e19730 100644 --- a/ydb/library/yql/core/services/yql_out_transformers.cpp +++ b/ydb/library/yql/core/services/yql_out_transformers.cpp @@ -36,11 +36,11 @@ IGraphTransformer::TStatus TPlanOutputTransformer::operator()( Y_UNUSED(ctx); output = input; if (DirectOut_) { - NYson::TYsonWriter writer(DirectOut_, OutputFormat_); + NYson::TYsonWriter writer(DirectOut_, OutputFormat_); Builder_.WritePlan(writer, input); } else { TNullOutput null; - NYson::TYsonWriter writer(&null, OutputFormat_); + NYson::TYsonWriter writer(&null, OutputFormat_); Builder_.WritePlan(writer, input); } diff --git a/ydb/library/yql/core/services/yql_out_transformers.h b/ydb/library/yql/core/services/yql_out_transformers.h index d90f88cd99..9dcc1d47c2 100644 --- a/ydb/library/yql/core/services/yql_out_transformers.h +++ b/ydb/library/yql/core/services/yql_out_transformers.h @@ -41,7 +41,7 @@ public: TPlanOutputTransformer( IOutputStream* directOut, IPlanBuilder& builder, - NYson::EYsonFormat outputFormat) + NYson::EYsonFormat outputFormat) : DirectOut_(directOut) , Builder_(builder) , OutputFormat_(outputFormat) @@ -53,7 +53,7 @@ public: static TAutoPtr <IGraphTransformer> Sync( IOutputStream* directOut, IPlanBuilder& builder, - NYson::EYsonFormat outputFormat) + NYson::EYsonFormat outputFormat) { return CreateFunctorTransformer(TPlanOutputTransformer(directOut, builder, outputFormat)); } @@ -61,7 +61,7 @@ public: private: IOutputStream* DirectOut_; IPlanBuilder& Builder_; - NYson::EYsonFormat OutputFormat_; + NYson::EYsonFormat OutputFormat_; }; class TExprLogTransformer { diff --git a/ydb/library/yql/core/services/yql_plan.cpp b/ydb/library/yql/core/services/yql_plan.cpp index 4d7cfffaf5..329c3abd2a 100644 --- a/ydb/library/yql/core/services/yql_plan.cpp +++ b/ydb/library/yql/core/services/yql_plan.cpp @@ -112,7 +112,7 @@ struct TProviderInfo { using TProviderInfoMap = TMap<TString, TProviderInfo>; -void WriteProviders(const TString& tag, const TProviderInfoMap& providers, NYson::TYsonWriter& writer) { +void WriteProviders(const TString& tag, const TProviderInfoMap& providers, NYson::TYsonWriter& writer) { writer.OnKeyedItem(tag); writer.OnBeginList(); for (auto& p : providers) { @@ -184,7 +184,7 @@ public: : Types_(types) {} - void WritePlan(NYson::TYsonWriter& writer, const TExprNode::TPtr& root) override { + void WritePlan(NYson::TYsonWriter& writer, const TExprNode::TPtr& root) override { if (!root) { return; } @@ -624,7 +624,7 @@ public: YQL_ENSURE(false, "Expected either datasource or sink"); } - void WritePins(const TString& tag, const TVector<TPinInfo>& pins, NYson::TYsonWriter& writer, + void WritePins(const TString& tag, const TVector<TPinInfo>& pins, NYson::TYsonWriter& writer, TVector<TPinAttrs>& pinAttrs, TProviderInfoMap& providers) { if (!pins.empty()) { UpdateProviders(providers, pins); diff --git a/ydb/library/yql/core/services/yql_plan.h b/ydb/library/yql/core/services/yql_plan.h index 608c54fb8e..1724832142 100644 --- a/ydb/library/yql/core/services/yql_plan.h +++ b/ydb/library/yql/core/services/yql_plan.h @@ -10,7 +10,7 @@ class IPlanBuilder { public: virtual ~IPlanBuilder() {}; virtual void Clear() = 0; - virtual void WritePlan(NYson::TYsonWriter& writer, const TExprNode::TPtr& root) = 0; + virtual void WritePlan(NYson::TYsonWriter& writer, const TExprNode::TPtr& root) = 0; }; TAutoPtr<IPlanBuilder> CreatePlanBuilder(TTypeAnnotationContext& types); diff --git a/ydb/library/yql/core/yql_data_provider.h b/ydb/library/yql/core/yql_data_provider.h index 3ffbdc041d..da3ba9f9bc 100644 --- a/ydb/library/yql/core/yql_data_provider.h +++ b/ydb/library/yql/core/yql_data_provider.h @@ -46,16 +46,16 @@ class IPlanFormatter { public: virtual ~IPlanFormatter() {} - virtual void WriteDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; + virtual void WriteDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; // returns visibility of node virtual bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) = 0; virtual void GetResultDependencies(const TExprNode::TPtr& node, TExprNode::TListType& children, bool compact) = 0; virtual void GetInputs(const TExprNode& node, TVector<TPinInfo>& inputs) = 0; virtual void GetOutputs(const TExprNode& node, TVector<TPinInfo>& outputs) = 0; virtual TString GetProviderPath(const TExprNode& node) = 0; - virtual void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; - virtual void WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; - virtual void WritePinDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; + virtual void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; + virtual void WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; + virtual void WritePinDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; virtual TString GetOperationDisplayName(const TExprNode& node) = 0; }; @@ -154,10 +154,10 @@ public: //-- finalizing virtual IGraphTransformer& GetFinalizingTransformer() = 0; - virtual bool CollectDiagnostics(NYson::TYsonWriter& writer) = 0; - virtual bool GetTasksInfo(NYson::TYsonWriter& writer) = 0; - virtual bool CollectStatistics(NYson::TYsonWriter& writer, bool totalOnly) = 0; - virtual bool CollectDiscoveredData(NYson::TYsonWriter& writer) = 0; + virtual bool CollectDiagnostics(NYson::TYsonWriter& writer) = 0; + virtual bool GetTasksInfo(NYson::TYsonWriter& writer) = 0; + virtual bool CollectStatistics(NYson::TYsonWriter& writer, bool totalOnly) = 0; + virtual bool CollectDiscoveredData(NYson::TYsonWriter& writer) = 0; //-- plan virtual IGraphTransformer& GetPlanInfoTransformer() = 0; @@ -209,7 +209,7 @@ struct TDataProviderInfo { std::function<TFutureStatus(const TString& cluster, ESourceSyntax sourceSyntax, const TString& sourceCode, - const NYson::EYsonFormat& outputFormat, const NYson::EYsonFormat& resultFormat, + const NYson::EYsonFormat& outputFormat, const NYson::EYsonFormat& resultFormat, const IPipelineConfigurator* pipelineConf, TIntrusivePtr<TTypeAnnotationContext> typeCtx, TExprNode::TPtr& root, TExprContext& ctx, diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_weakmember.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_weakmember.cpp index e27d397bfd..fe82aac328 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_weakmember.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_weakmember.cpp @@ -42,7 +42,7 @@ public: MKQL_ENSURE(size <= std::numeric_limits<i32>::max(), "TryWeakMemberFromDict: Unable to fit string to i32"); TUnboxedValueStream stringStream; stringStream.DoWrite(&NYson::NDetail::StringMarker, 1); - NYson::WriteVarInt32(&stringStream, size); + NYson::WriteVarInt32(&stringStream, size); stringStream.DoWrite(ref.Data(), size); return stringStream.Value(); } else if (SchemeType == NUdf::EDataSlot::String) { diff --git a/ydb/library/yql/minikql/mkql_type_ops.cpp b/ydb/library/yql/minikql/mkql_type_ops.cpp index d559bb108c..642f5aa0b5 100644 --- a/ydb/library/yql/minikql/mkql_type_ops.cpp +++ b/ydb/library/yql/minikql/mkql_type_ops.cpp @@ -1855,7 +1855,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe TMemoryInput stringRefStream(binPayload.Data(), binPayload.Size()); ui64 value; - const size_t read = NYson::ReadVarUInt64(&stringRefStream, &value); + const size_t read = NYson::ReadVarUInt64(&stringRefStream, &value); if (read != binPayload.Size()) { return NUdf::TUnboxedValuePod(); } @@ -1874,7 +1874,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe TMemoryInput stringRefStream(binPayload.Data(), binPayload.Size()); i64 value; - const size_t read = NYson::ReadVarInt64(&stringRefStream, &value); + const size_t read = NYson::ReadVarInt64(&stringRefStream, &value); if (read != binPayload.Size()) { return NUdf::TUnboxedValuePod(); } @@ -1909,7 +1909,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe TMemoryInput stringRefStream(binPayload.Data(), binPayload.Size()); i32 value; - const size_t read = NYson::ReadVarInt32(&stringRefStream, &value); + const size_t read = NYson::ReadVarInt32(&stringRefStream, &value); binPayload = binPayload.Substring(read, binPayload.Size() - read); const size_t strLen = value; if (strLen != binPayload.Size()) { diff --git a/ydb/library/yql/providers/common/codec/yql_codec.cpp b/ydb/library/yql/providers/common/codec/yql_codec.cpp index 7587e188fa..4657da0719 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec.cpp +++ b/ydb/library/yql/providers/common/codec/yql_codec.cpp @@ -238,7 +238,7 @@ void WriteYsonValueImpl(TYsonResultWriter& writer, const NUdf::TUnboxedValuePod& } } -void WriteYsonValue(NYson::TYsonConsumerBase& writer, const NUdf::TUnboxedValuePod& value, TType* type, +void WriteYsonValue(NYson::TYsonConsumerBase& writer, const NUdf::TUnboxedValuePod& value, TType* type, const TVector<ui32>* structPositions) { TYsonResultWriter resultWriter(writer); @@ -246,9 +246,9 @@ void WriteYsonValue(NYson::TYsonConsumerBase& writer, const NUdf::TUnboxedValueP } TString WriteYsonValue(const NUdf::TUnboxedValuePod& value, TType* type, const TVector<ui32>* structPositions, - NYson::EYsonFormat format) { + NYson::EYsonFormat format) { TStringStream str; - NYson::TYsonWriter writer(&str, format); + NYson::TYsonWriter writer(&str, format); WriteYsonValue(writer, value, type, structPositions); return str.Str(); } @@ -882,7 +882,7 @@ NUdf::TUnboxedValue ReadYsonValue(TType* type, return NUdf::TUnboxedValue(MakeString(NUdf::TStringRef(yson))); } - TString decodedYson = DecodeRestrictedYson(TStringBuf(yson.data(), yson.size()), NYson::EYsonFormat::Text); + TString decodedYson = DecodeRestrictedYson(TStringBuf(yson.data(), yson.size()), NYson::EYsonFormat::Text); return NUdf::TUnboxedValue(MakeString(NUdf::TStringRef(decodedYson))); } @@ -1286,12 +1286,12 @@ TMaybe<NUdf::TUnboxedValue> ParseYsonValue(const THolderFactory& holderFactory, TMaybe<NUdf::TUnboxedValue> ParseYsonNode(const THolderFactory& holderFactory, const NYT::TNode& node, TType* type, IOutputStream* err) { - return ParseYsonValue(holderFactory, NYT::NodeToYsonString(node, NYson::EYsonFormat::Binary), type, err, true); + return ParseYsonValue(holderFactory, NYT::NodeToYsonString(node, NYson::EYsonFormat::Binary), type, err, true); } TMaybe<NUdf::TUnboxedValue> ParseYsonNodeInResultFormat(const THolderFactory& holderFactory, const NYT::TNode& node, TType* type, IOutputStream* err) { - return ParseYsonValue(holderFactory, NYT::NodeToYsonString(node, NYson::EYsonFormat::Binary), type, err, false); + return ParseYsonValue(holderFactory, NYT::NodeToYsonString(node, NYson::EYsonFormat::Binary), type, err, false); } extern "C" void ReadYsonContainerValue(TType* type, const NKikimr::NMiniKQL::THolderFactory& holderFactory, diff --git a/ydb/library/yql/providers/common/codec/yql_codec.h b/ydb/library/yql/providers/common/codec/yql_codec.h index 512e01224c..7465750412 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec.h +++ b/ydb/library/yql/providers/common/codec/yql_codec.h @@ -25,7 +25,7 @@ namespace NYql { namespace NCommon { void WriteYsonValue( - NYson::TYsonConsumerBase& writer, + NYson::TYsonConsumerBase& writer, const NKikimr::NUdf::TUnboxedValuePod& value, NKikimr::NMiniKQL::TType* type, const TVector<ui32>* structPositions = nullptr @@ -35,7 +35,7 @@ TString WriteYsonValue( const NKikimr::NUdf::TUnboxedValuePod& value, NKikimr::NMiniKQL::TType* type, const TVector<ui32>* structPositions = nullptr, - NYson::EYsonFormat format = NYson::EYsonFormat::Binary + NYson::EYsonFormat format = NYson::EYsonFormat::Binary ); TMaybe<TVector<ui32>> CreateStructPositions( diff --git a/ydb/library/yql/providers/common/codec/yql_codec_buf.h b/ydb/library/yql/providers/common/codec/yql_codec_buf.h index d951a9010d..73d4344f11 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec_buf.h +++ b/ydb/library/yql/providers/common/codec/yql_codec_buf.h @@ -123,19 +123,19 @@ public: ui64 ReadVarUI64Slow(char cmd); i64 ReadVarI64() { - return NYson::ZigZagDecode64(ReadVarUI64()); + return NYson::ZigZagDecode64(ReadVarUI64()); } i32 ReadVarI32() { - return NYson::ZigZagDecode32(ReadVarUI32()); + return NYson::ZigZagDecode32(ReadVarUI32()); } i64 CopyVarI64(TVector<char>& yson) { - return NYson::ZigZagDecode64(CopyVarUI64(yson)); + return NYson::ZigZagDecode64(CopyVarUI64(yson)); } i32 CopyVarI32(TVector<char>& yson) { - return NYson::ZigZagDecode32(CopyVarUI32(yson)); + return NYson::ZigZagDecode32(CopyVarUI32(yson)); } TStringBuf ReadYtString(ui32 lookAhead = 0); @@ -235,11 +235,11 @@ public: } void WriteVarI32(i32 value) { - WriteVarUI32(NYson::ZigZagEncode32(value)); + WriteVarUI32(NYson::ZigZagEncode32(value)); } void WriteVarI64(i64 value) { - WriteVarUI64(NYson::ZigZagEncode64(value)); + WriteVarUI64(NYson::ZigZagEncode64(value)); } void WriteVarUI32(ui32 value); diff --git a/ydb/library/yql/providers/common/codec/yql_codec_results.h b/ydb/library/yql/providers/common/codec/yql_codec_results.h index e34d2a3a68..c29b82651e 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec_results.h +++ b/ydb/library/yql/providers/common/codec/yql_codec_results.h @@ -16,7 +16,7 @@ public: static constexpr TStringBuf VoidString = "Void"; public: - explicit TYsonResultWriter(NYson::TYsonConsumerBase& writer) + explicit TYsonResultWriter(NYson::TYsonConsumerBase& writer) : Writer(writer) { } @@ -91,7 +91,7 @@ private: } private: - NYson::TYsonConsumerBase& Writer; + NYson::TYsonConsumerBase& Writer; }; } } diff --git a/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp b/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp index 08b4521748..628bea3044 100644 --- a/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp +++ b/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp @@ -16,13 +16,13 @@ namespace NYql { namespace NCommon { namespace { -class TRestrictedYsonFormatter : public NYson::TYsonConsumerBase { +class TRestrictedYsonFormatter : public NYson::TYsonConsumerBase { public: TRestrictedYsonFormatter(TYsonResultWriter& writer) : Writer(writer) { } - void OnStringScalar(TStringBuf value) override { + void OnStringScalar(TStringBuf value) override { Open(); Type(TStringBuf("string")); @@ -125,7 +125,7 @@ public: AfterAttributes = false; } - void OnKeyedItem(TStringBuf key) override { + void OnKeyedItem(TStringBuf key) override { if (key.StartsWith('$')) { Writer.OnKeyedItem(TString("$") + key); } else { @@ -197,7 +197,7 @@ TString DecodeRestrictedBinaryString(const TString& data) { return res; } -void DecodeRestrictedYson(const NYT::TNode& node, NYson::TYsonConsumerBase& writer) { +void DecodeRestrictedYson(const NYT::TNode& node, NYson::TYsonConsumerBase& writer) { switch (node.GetType()) { case NYT::TNode::String: writer.OnStringScalar(node.AsString()); @@ -301,12 +301,12 @@ void DecodeRestrictedYson(const NYT::TNode& node, NYson::TYsonConsumerBase& writ void EncodeRestrictedYson(TYsonResultWriter& writer, const TStringBuf& yson) { TRestrictedYsonFormatter formatter(writer); - NYson::ParseYsonStringBuffer(yson, &formatter); + NYson::ParseYsonStringBuffer(yson, &formatter); } -TString EncodeRestrictedYson(const NYT::TNode& node, NYson::EYsonFormat format) { +TString EncodeRestrictedYson(const NYT::TNode& node, NYson::EYsonFormat format) { TStringStream stream; - NYson::TYsonWriter writer(&stream, format); + NYson::TYsonWriter writer(&stream, format); TYsonResultWriter resultWriter(writer); TRestrictedYsonFormatter formatter(resultWriter); NYT::TNodeVisitor visitor(&formatter); @@ -314,9 +314,9 @@ TString EncodeRestrictedYson(const NYT::TNode& node, NYson::EYsonFormat format) return stream.Str(); } -TString DecodeRestrictedYson(const TStringBuf& yson, NYson::EYsonFormat format) { +TString DecodeRestrictedYson(const TStringBuf& yson, NYson::EYsonFormat format) { TStringStream stream; - NYson::TYsonWriter writer(&stream, format); + NYson::TYsonWriter writer(&stream, format); auto node = NYT::NodeFromYsonString(yson); DecodeRestrictedYson(node, writer); return stream.Str(); diff --git a/ydb/library/yql/providers/common/codec/yql_restricted_yson.h b/ydb/library/yql/providers/common/codec/yql_restricted_yson.h index 0d0f7568d6..d0f6050a7d 100644 --- a/ydb/library/yql/providers/common/codec/yql_restricted_yson.h +++ b/ydb/library/yql/providers/common/codec/yql_restricted_yson.h @@ -18,11 +18,11 @@ void EncodeRestrictedYson( TString EncodeRestrictedYson( const NYT::TNode& node, - NYson::EYsonFormat format = NYson::EYsonFormat::Binary); + NYson::EYsonFormat format = NYson::EYsonFormat::Binary); TString DecodeRestrictedYson( const TStringBuf& yson, - NYson::EYsonFormat format = NYson::EYsonFormat::Binary); + NYson::EYsonFormat format = NYson::EYsonFormat::Binary); } } diff --git a/ydb/library/yql/providers/common/codec/yql_restricted_yson_ut.cpp b/ydb/library/yql/providers/common/codec/yql_restricted_yson_ut.cpp index aee6715a93..08622ac454 100644 --- a/ydb/library/yql/providers/common/codec/yql_restricted_yson_ut.cpp +++ b/ydb/library/yql/providers/common/codec/yql_restricted_yson_ut.cpp @@ -10,7 +10,7 @@ namespace NYql { namespace { TString FormatNode(const NYT::TNode& node) { TStringStream stream; - NYson::TYsonWriter writer(&stream, NYson::EYsonFormat::Text); + NYson::TYsonWriter writer(&stream, NYson::EYsonFormat::Text); const auto sortMapKeys = true; NYT::TNodeVisitor visitor(&writer, sortMapKeys); visitor.Visit(node); @@ -27,9 +27,9 @@ TString Normalize(const TString& yson) { Y_UNIT_TEST_SUITE(TRestrictedYson) { void RunTest(const NYT::TNode& node, const TString& expectedNodeStr, const TString& expectedEncodedStr) { UNIT_ASSERT_VALUES_EQUAL(FormatNode(node), expectedNodeStr); - TString encoded = NCommon::EncodeRestrictedYson(node, NYson::EYsonFormat::Text); + TString encoded = NCommon::EncodeRestrictedYson(node, NYson::EYsonFormat::Text); UNIT_ASSERT_VALUES_EQUAL(Normalize(encoded), expectedEncodedStr); - TString decoded = NCommon::DecodeRestrictedYson(TStringBuf(encoded), NYson::EYsonFormat::Text); + TString decoded = NCommon::DecodeRestrictedYson(TStringBuf(encoded), NYson::EYsonFormat::Text); UNIT_ASSERT_VALUES_EQUAL(FormatNode(node), Normalize(decoded)); } diff --git a/ydb/library/yql/providers/common/provider/yql_data_provider_impl.cpp b/ydb/library/yql/providers/common/provider/yql_data_provider_impl.cpp index 8de3d57fd3..f5cff15a71 100644 --- a/ydb/library/yql/providers/common/provider/yql_data_provider_impl.cpp +++ b/ydb/library/yql/providers/common/provider/yql_data_provider_impl.cpp @@ -6,7 +6,7 @@ namespace NYql { -void TPlanFormatterBase::WriteDetails(const TExprNode& node, NYson::TYsonWriter& writer) { +void TPlanFormatterBase::WriteDetails(const TExprNode& node, NYson::TYsonWriter& writer) { Y_UNUSED(node); Y_UNUSED(writer); } @@ -39,17 +39,17 @@ TString TPlanFormatterBase::GetProviderPath(const TExprNode& node) { return TString(); } -void TPlanFormatterBase::WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) { +void TPlanFormatterBase::WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) { Y_UNUSED(node); Y_UNUSED(writer); } -void TPlanFormatterBase::WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) { +void TPlanFormatterBase::WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) { Y_UNUSED(node); Y_UNUSED(writer); } -void TPlanFormatterBase::WritePinDetails(const TExprNode& node, NYson::TYsonWriter& writer) { +void TPlanFormatterBase::WritePinDetails(const TExprNode& node, NYson::TYsonWriter& writer) { Y_UNUSED(node); Y_UNUSED(writer); } @@ -253,23 +253,23 @@ IGraphTransformer& TDataProviderBase::GetFinalizingTransformer() { return NullTransformer_; } -bool TDataProviderBase::CollectDiagnostics(NYson::TYsonWriter& writer) { +bool TDataProviderBase::CollectDiagnostics(NYson::TYsonWriter& writer) { Y_UNUSED(writer); return false; } -bool TDataProviderBase::GetTasksInfo(NYson::TYsonWriter& writer) { +bool TDataProviderBase::GetTasksInfo(NYson::TYsonWriter& writer) { Y_UNUSED(writer); return false; } -bool TDataProviderBase::CollectStatistics(NYson::TYsonWriter& writer, bool totalOnly) { +bool TDataProviderBase::CollectStatistics(NYson::TYsonWriter& writer, bool totalOnly) { Y_UNUSED(writer); Y_UNUSED(totalOnly); return false; } -bool TDataProviderBase::CollectDiscoveredData(NYson::TYsonWriter& writer) { +bool TDataProviderBase::CollectDiscoveredData(NYson::TYsonWriter& writer) { Y_UNUSED(writer); return false; } diff --git a/ydb/library/yql/providers/common/provider/yql_data_provider_impl.h b/ydb/library/yql/providers/common/provider/yql_data_provider_impl.h index 242a39877e..6b8bd6e956 100644 --- a/ydb/library/yql/providers/common/provider/yql_data_provider_impl.h +++ b/ydb/library/yql/providers/common/provider/yql_data_provider_impl.h @@ -12,15 +12,15 @@ public: TPlanFormatterBase() = default; ~TPlanFormatterBase() = default; - void WriteDetails(const TExprNode& node, NYson::TYsonWriter& writer) override; + void WriteDetails(const TExprNode& node, NYson::TYsonWriter& writer) override; bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override; void GetResultDependencies(const TExprNode::TPtr& node, TExprNode::TListType& children, bool compact) override; void GetInputs(const TExprNode& node, TVector<TPinInfo>& inputs) override; void GetOutputs(const TExprNode& node, TVector<TPinInfo>& outputs) override; TString GetProviderPath(const TExprNode& node) override; - void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) override; - void WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) override; - void WritePinDetails(const TExprNode& node, NYson::TYsonWriter& writer) override; + void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) override; + void WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) override; + void WritePinDetails(const TExprNode& node, NYson::TYsonWriter& writer) override; TString GetOperationDisplayName(const TExprNode& node) override; }; @@ -74,10 +74,10 @@ public: void GetRequiredChildren(const TExprNode& node, TExprNode::TListType& children) override; IGraphTransformer& GetCallableExecutionTransformer() override; IGraphTransformer& GetFinalizingTransformer() override; - bool CollectDiagnostics(NYson::TYsonWriter& writer) override; - bool GetTasksInfo(NYson::TYsonWriter& writer) override; - bool CollectStatistics(NYson::TYsonWriter& writer, bool totalOnly) override; - bool CollectDiscoveredData(NYson::TYsonWriter& writer) override; + bool CollectDiagnostics(NYson::TYsonWriter& writer) override; + bool GetTasksInfo(NYson::TYsonWriter& writer) override; + bool CollectStatistics(NYson::TYsonWriter& writer, bool totalOnly) override; + bool CollectDiscoveredData(NYson::TYsonWriter& writer) override; IPlanFormatter& GetPlanFormatter() override; ITrackableNodeProcessor& GetTrackableNodeProcessor() override; IGraphTransformer& GetPlanInfoTransformer() override; diff --git a/ydb/library/yql/providers/common/provider/yql_provider.cpp b/ydb/library/yql/providers/common/provider/yql_provider.cpp index aa782ee93f..900399f5d3 100644 --- a/ydb/library/yql/providers/common/provider/yql_provider.cpp +++ b/ydb/library/yql/providers/common/provider/yql_provider.cpp @@ -143,9 +143,9 @@ IDataProvider::TFillSettings GetFillSettings(const TExprNode& node) { return fillSettings; } -NYson::EYsonFormat GetYsonFormat(const IDataProvider::TFillSettings& fillSettings) { +NYson::EYsonFormat GetYsonFormat(const IDataProvider::TFillSettings& fillSettings) { YQL_ENSURE(fillSettings.Format == IDataProvider::EResultFormat::Yson); - return (NYson::EYsonFormat)FromString<ui32>(fillSettings.FormatDetails); + return (NYson::EYsonFormat)FromString<ui32>(fillSettings.FormatDetails); } TWriteTableSettings ParseWriteTableSettings(TExprList node, TExprContext& ctx) { @@ -367,7 +367,7 @@ TVector<TString> GetStructFields(const TTypeAnnotationNode* type) { void TransformerStatsToYson(const TString& name, const IGraphTransformer::TStatistics& stats, - NYson::TYsonWriter& writer) + NYson::TYsonWriter& writer) { writer.OnBeginMap(); @@ -678,7 +678,7 @@ bool FreezeUsedFilesSync(const TExprNode& node, TUserDataTable& files, const TTy return true; } -void WriteColumns(NYson::TYsonWriter& writer, const TExprBase& columns) { +void WriteColumns(NYson::TYsonWriter& writer, const TExprBase& columns) { if (auto maybeList = columns.Maybe<TCoAtomList>()) { writer.OnBeginList(); for (const auto& column : maybeList.Cast()) { @@ -719,7 +719,7 @@ bool IsFlowOrStream(const TExprNode* node) { return kind == ETypeAnnotationKind::Stream || kind == ETypeAnnotationKind::Flow; } -void WriteStream(NYson::TYsonWriter& writer, const TExprNode* node, const TExprNode* source) { +void WriteStream(NYson::TYsonWriter& writer, const TExprNode* node, const TExprNode* source) { if (node == source) { return; } @@ -827,7 +827,7 @@ void WriteStream(NYson::TYsonWriter& writer, const TExprNode* node, const TExprN writer.OnEndMap(); } -void WriteStreams(NYson::TYsonWriter& writer, TStringBuf name, const NNodes::TCoLambda& lambda) { +void WriteStreams(NYson::TYsonWriter& writer, TStringBuf name, const NNodes::TCoLambda& lambda) { writer.OnKeyedItem(name); writer.OnBeginList(); WriteStream(writer, lambda.Body().Raw(), lambda.Args().Size() > 0 ? lambda.Args().Arg(0).Raw() : nullptr); @@ -939,7 +939,7 @@ double GetDataReplicationFactor(const TExprNode& lambda, TExprContext& ctx) { return GetDataReplicationFactor(1.0, lambda.Child(1), lambda.Head().ChildrenSize() > 0 ? lambda.Head().Child(0) : nullptr, ctx); } -void WriteStatistics(NYson::TYsonWriter& writer, bool totalOnly, const THashMap<ui32, TOperationStatistics>& statistics) { +void WriteStatistics(NYson::TYsonWriter& writer, bool totalOnly, const THashMap<ui32, TOperationStatistics>& statistics) { if (statistics.empty()) { return; } diff --git a/ydb/library/yql/providers/common/provider/yql_provider.h b/ydb/library/yql/providers/common/provider/yql_provider.h index 9e80cfd135..eeeec1823b 100644 --- a/ydb/library/yql/providers/common/provider/yql_provider.h +++ b/ydb/library/yql/providers/common/provider/yql_provider.h @@ -94,7 +94,7 @@ TCommitSettings ParseCommitSettings(NNodes::TCoCommit node, TExprContext& ctx); TString FullTableName(const TStringBuf& cluster, const TStringBuf& table); IDataProvider::TFillSettings GetFillSettings(const TExprNode& node); -NYson::EYsonFormat GetYsonFormat(const IDataProvider::TFillSettings& fillSettings); +NYson::EYsonFormat GetYsonFormat(const IDataProvider::TFillSettings& fillSettings); TVector<TString> GetStructFields(const TTypeAnnotationNode* type); diff --git a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp index 0bbaf5c339..c336efa57f 100644 --- a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp +++ b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp @@ -233,12 +233,12 @@ public: } }; -void SaveStructTypeToYson(NYson::TYsonConsumerBase& writer, const TStructExprType* type, const TMaybe<TVector<TString>>& columns, const TStructMemberMapper& mapper) { +void SaveStructTypeToYson(NYson::TYsonConsumerBase& writer, const TStructExprType* type, const TMaybe<TVector<TString>>& columns, const TStructMemberMapper& mapper) { TExprTypeSaver<TYqlTypeYsonSaverImpl> saver(writer); saver.SaveStructType(type, columns, mapper); } -void WriteTypeToYson(NYson::TYsonConsumerBase& writer, const TTypeAnnotationNode* type) { +void WriteTypeToYson(NYson::TYsonConsumerBase& writer, const TTypeAnnotationNode* type) { TExprTypeSaver<TYqlTypeYsonSaverImpl> saver(writer); saver.Save(type); } @@ -250,9 +250,9 @@ NYT::TNode TypeToYsonNode(const TTypeAnnotationNode* type) { return res; } -TString WriteTypeToYson(const TTypeAnnotationNode* type, NYson::EYsonFormat format) { +TString WriteTypeToYson(const TTypeAnnotationNode* type, NYson::EYsonFormat format) { TStringStream stream; - NYson::TYsonWriter writer(&stream, format); + NYson::TYsonWriter writer(&stream, format); WriteTypeToYson(writer, type); return stream.Str(); } @@ -411,7 +411,7 @@ const TTypeAnnotationNode* ParseOrderAwareTypeFromYson(const NYT::TNode& node, T return DoLoadTypeFromYson(loader, node, 0).GetOrElse(nullptr); } -void WriteResOrPullType(NYson::TYsonConsumerBase& writer,const TTypeAnnotationNode* type, const TVector<TString>& columns) { +void WriteResOrPullType(NYson::TYsonConsumerBase& writer,const TTypeAnnotationNode* type, const TVector<TString>& columns) { if (columns.empty() || type->GetKind() != ETypeAnnotationKind::List || type->Cast<TListExprType>()->GetItemType()->GetKind() != ETypeAnnotationKind::Struct) { diff --git a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h index 397063052f..9afaf975b3 100644 --- a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h +++ b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h @@ -23,20 +23,20 @@ namespace NCommon { // empty return value means "remove member" using TStructMemberMapper = std::function<TMaybe<TStringBuf> (TStringBuf member)>; -void WriteTypeToYson(NYson::TYsonConsumerBase& writer, const TTypeAnnotationNode* type); +void WriteTypeToYson(NYson::TYsonConsumerBase& writer, const TTypeAnnotationNode* type); // saves in columns order -void SaveStructTypeToYson(NYson::TYsonConsumerBase& writer, const TStructExprType* type, const TMaybe<TVector<TString>>& columns = {}, const TStructMemberMapper& mapper = {}); +void SaveStructTypeToYson(NYson::TYsonConsumerBase& writer, const TStructExprType* type, const TMaybe<TVector<TString>>& columns = {}, const TStructMemberMapper& mapper = {}); NYT::TNode TypeToYsonNode(const TTypeAnnotationNode* type); -TString WriteTypeToYson(const TTypeAnnotationNode* type, NYT::NYson::EYsonFormat format = NYT::NYson::EYsonFormat::Binary); +TString WriteTypeToYson(const TTypeAnnotationNode* type, NYT::NYson::EYsonFormat format = NYT::NYson::EYsonFormat::Binary); const TTypeAnnotationNode* ParseTypeFromYson(const TStringBuf yson, TExprContext& ctx, const TPosition& pos = TPosition()); const TTypeAnnotationNode* ParseOrderAwareTypeFromYson(const TStringBuf yson, TVector<TString>& topLevelColumns, TExprContext& ctx, const TPosition& pos = TPosition()); const TTypeAnnotationNode* ParseTypeFromYson(const NYT::TNode& node, TExprContext& ctx, const TPosition& pos = TPosition()); const TTypeAnnotationNode* ParseOrderAwareTypeFromYson(const NYT::TNode& node, TVector<TString>& topLevelColumns, TExprContext& ctx, const TPosition& pos = TPosition()); -void WriteResOrPullType(NYson::TYsonConsumerBase& writer, const TTypeAnnotationNode* type, +void WriteResOrPullType(NYson::TYsonConsumerBase& writer, const TTypeAnnotationNode* type, const TVector<TString>& columns); } // namespace NCommon diff --git a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp index 0a34105714..1daeddd97a 100644 --- a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp +++ b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp @@ -143,7 +143,7 @@ public: } }; -void WriteTypeToYson(NYson::TYsonConsumerBase& writer, const NKikimr::NMiniKQL::TType* type) { +void WriteTypeToYson(NYson::TYsonConsumerBase& writer, const NKikimr::NMiniKQL::TType* type) { TRuntimeTypeSaver<TYqlTypeYsonSaverImpl> saver(writer); saver.Save(type); } @@ -155,9 +155,9 @@ NYT::TNode TypeToYsonNode(const NKikimr::NMiniKQL::TType* type) { return res; } -TString WriteTypeToYson(const NKikimr::NMiniKQL::TType* type, NYson::EYsonFormat format) { +TString WriteTypeToYson(const NKikimr::NMiniKQL::TType* type, NYson::EYsonFormat format) { TStringStream stream; - NYson::TYsonWriter writer(&stream, format); + NYson::TYsonWriter writer(&stream, format); WriteTypeToYson(writer, type); return stream.Str(); } diff --git a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.h b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.h index 9a21a1f388..534362cad5 100644 --- a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.h +++ b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.h @@ -23,9 +23,9 @@ namespace NCommon { struct TCodecContext; -void WriteTypeToYson(NYson::TYsonConsumerBase& writer, const NKikimr::NMiniKQL::TType* type); +void WriteTypeToYson(NYson::TYsonConsumerBase& writer, const NKikimr::NMiniKQL::TType* type); NYT::TNode TypeToYsonNode(const NKikimr::NMiniKQL::TType* type); -TString WriteTypeToYson(const NKikimr::NMiniKQL::TType* type, NYT::NYson::EYsonFormat format = NYT::NYson::EYsonFormat::Binary); +TString WriteTypeToYson(const NKikimr::NMiniKQL::TType* type, NYT::NYson::EYsonFormat format = NYT::NYson::EYsonFormat::Binary); NKikimr::NMiniKQL::TType* ParseTypeFromYson(const TStringBuf yson, NKikimr::NMiniKQL::TProgramBuilder& builder, IOutputStream& err); NKikimr::NMiniKQL::TType* ParseTypeFromYson(const NYT::TNode& node, NKikimr::NMiniKQL::TProgramBuilder& builder, IOutputStream& err); diff --git a/ydb/library/yql/providers/common/schema/parser/yql_type_parser.h b/ydb/library/yql/providers/common/schema/parser/yql_type_parser.h index a3116efb14..625327602e 100644 --- a/ydb/library/yql/providers/common/schema/parser/yql_type_parser.h +++ b/ydb/library/yql/providers/common/schema/parser/yql_type_parser.h @@ -14,7 +14,7 @@ namespace NCommon { class TYqlTypeYsonSaverBase { public: - typedef NYson::TYsonConsumerBase TConsumer; + typedef NYson::TYsonConsumerBase TConsumer; TYqlTypeYsonSaverBase(TConsumer& writer) : Writer(writer) @@ -35,7 +35,7 @@ protected: void SaveResourceType(const TStringBuf& tag); protected: - NYson::TYsonConsumerBase& Writer; + NYson::TYsonConsumerBase& Writer; }; diff --git a/ydb/library/yql/providers/config/yql_config_provider.cpp b/ydb/library/yql/providers/config/yql_config_provider.cpp index 6952e96cf0..64e83d6b5a 100644 --- a/ydb/library/yql/providers/config/yql_config_provider.cpp +++ b/ydb/library/yql/providers/config/yql_config_provider.cpp @@ -44,7 +44,7 @@ namespace { IDataProvider::TFillSettings fillSettings = NCommon::GetFillSettings(*input); YQL_ENSURE(fillSettings.Format == IDataProvider::EResultFormat::Yson); - NYson::EYsonFormat ysonFormat = NCommon::GetYsonFormat(fillSettings); + NYson::EYsonFormat ysonFormat = NCommon::GetYsonFormat(fillSettings); auto nodeToPull = input->Child(0)->Child(0); if (nodeToPull->IsCallable(ConfReadName)) { @@ -52,7 +52,7 @@ namespace { auto tag = key->Child(0)->Child(0)->Content(); if (tag == "data_sinks" || tag == "data_sources") { TStringStream out; - NYson::TYsonWriter writer(&out, ysonFormat); + NYson::TYsonWriter writer(&out, ysonFormat); writer.OnBeginMap(); writer.OnKeyedItem("Data"); writer.OnBeginList(); @@ -399,7 +399,7 @@ namespace { return false; } - void WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) override { + void WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) override { YQL_ENSURE(node.IsCallable(RightName)); writer.OnKeyedItem("PullOperation"); diff --git a/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp b/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp index 8759f44221..91990bc848 100644 --- a/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp +++ b/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp @@ -242,7 +242,7 @@ private: if (NCommon::HasResOrPullOption(resOrPull, "type")) { TStringStream typeYson; - NYson::TYsonWriter typeWriter(&typeYson); + NYson::TYsonWriter typeWriter(&typeYson); NCommon::WriteResOrPullType(typeWriter, resOrPullInput.GetTypeAnn(), *columns); *type = typeYson.Str(); } @@ -597,7 +597,7 @@ private: YQL_ENSURE(state->TypeCtx->AvailablePureResultDataSources.front() != DqProviderName); TStringStream out; - NYson::TYsonWriter writer((IOutputStream*)&out); + NYson::TYsonWriter writer((IOutputStream*)&out); writer.OnBeginMap(); writer.OnKeyedItem("FallbackProvider"); writer.OnRaw(state->TypeCtx->AvailablePureResultDataSources.front()); @@ -750,7 +750,7 @@ private: input->SetState(TExprNode::EState::ExecutionComplete); TStringStream out; - NYson::TYsonWriter writer((IOutputStream*)&out); + NYson::TYsonWriter writer((IOutputStream*)&out); writer.OnBeginMap(); if (type) { writer.OnKeyedItem("Type"); @@ -1085,7 +1085,7 @@ private: input->SetState(TExprNode::EState::ExecutionComplete); TStringStream out; - NYson::TYsonWriter writer((IOutputStream*)&out, NCommon::GetYsonFormat(fillSettings), ::NYson::EYsonType::Node, false); + NYson::TYsonWriter writer((IOutputStream*)&out, NCommon::GetYsonFormat(fillSettings), ::NYson::EYsonType::Node, false); writer.OnBeginMap(); if (type) { writer.OnKeyedItem("Type"); diff --git a/ydb/library/yql/providers/dq/provider/yql_dq_datasink.cpp b/ydb/library/yql/providers/dq/provider/yql_dq_datasink.cpp index a8b5e598a0..f1aa9ff612 100644 --- a/ydb/library/yql/providers/dq/provider/yql_dq_datasink.cpp +++ b/ydb/library/yql/providers/dq/provider/yql_dq_datasink.cpp @@ -34,7 +34,7 @@ public: , RecaptureTransformer([state] () { return CreateDqsRecaptureTransformer(state); }) { } - bool CollectStatistics(NYson::TYsonWriter& writer, bool totalOnly) override { + bool CollectStatistics(NYson::TYsonWriter& writer, bool totalOnly) override { auto statistics = [&]() { TGuard<TMutex> lock(State->Mutex); return State->Statistics; @@ -256,7 +256,7 @@ public: return TPlanFormatterBase::GetOperationDisplayName(node); } - void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) override { + void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) override { if (auto maybeStage = TMaybeNode<TDqStageBase>(&node)) { writer.OnKeyedItem("Streams"); writer.OnBeginMap(); diff --git a/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp b/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp index 2341b28ad4..3168f483ec 100644 --- a/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp +++ b/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp @@ -107,7 +107,7 @@ public: Yql::DqsProto::ExecuteQueryResult queryResult; resp.operation().result().UnpackTo(&queryResult); result.Data = queryResult.yson().empty() - ? NYdb::FormatResultSetYson(queryResult.result(), NYson::EYsonFormat::Binary) + ? NYdb::FormatResultSetYson(queryResult.result(), NYson::EYsonFormat::Binary) : queryResult.yson(); result.Issues.AddIssues(issues); result.SetSuccess(); diff --git a/ydb/library/yql/providers/pq/provider/yql_pq_datasink_execution.cpp b/ydb/library/yql/providers/pq/provider/yql_pq_datasink_execution.cpp index da27cb195a..5115b8d163 100644 --- a/ydb/library/yql/providers/pq/provider/yql_pq_datasink_execution.cpp +++ b/ydb/library/yql/providers/pq/provider/yql_pq_datasink_execution.cpp @@ -46,7 +46,7 @@ public: .Value(TString("0")) .Build() .FormatDetails() - .Value(ToString((ui32)NYson::EYsonFormat::Binary)) + .Value(ToString((ui32)NYson::EYsonFormat::Binary)) .Build() .Settings() .Build() diff --git a/ydb/library/yql/providers/pq/provider/yql_pq_ut.cpp b/ydb/library/yql/providers/pq/provider/yql_pq_ut.cpp index 4127452d12..f1b5dd1a7c 100644 --- a/ydb/library/yql/providers/pq/provider/yql_pq_ut.cpp +++ b/ydb/library/yql/providers/pq/provider/yql_pq_ut.cpp @@ -125,7 +125,7 @@ bool RunPqProgram( factory.SetModules(moduleResolver); TProgramPtr program = factory.Create("program", code); - program->ConfigureYsonResultFormat(NYson::EYsonFormat::Text); + program->ConfigureYsonResultFormat(NYson::EYsonFormat::Text); Cerr << "Parse SQL..." << Endl; NSQLTranslation::TTranslationSettings sqlSettings; diff --git a/ydb/library/yql/providers/result/provider/yql_result_provider.cpp b/ydb/library/yql/providers/result/provider/yql_result_provider.cpp index 13bfd5e0f7..aacc23e85d 100644 --- a/ydb/library/yql/providers/result/provider/yql_result_provider.cpp +++ b/ydb/library/yql/providers/result/provider/yql_result_provider.cpp @@ -28,8 +28,8 @@ namespace { class TYsonResultWriter : public IResultWriter { public: - TYsonResultWriter(NYson::EYsonFormat format) - : Writer(new NYson::TYsonWriter(&PartialStream, format, ::NYson::EYsonType::Node, true)) + TYsonResultWriter(NYson::EYsonFormat format) + : Writer(new NYson::TYsonWriter(&PartialStream, format, ::NYson::EYsonType::Node, true)) {} void Init(bool discard, const TString& label, TMaybe<TPosition> pos) override { @@ -90,7 +90,7 @@ namespace { private: TStringStream PartialStream; - TAutoPtr<NYson::TYsonWriter> Writer; + TAutoPtr<NYson::TYsonWriter> Writer; bool Discard = false; }; @@ -286,7 +286,7 @@ namespace { if (input.Maybe<TResIf>()) { if (input.Ref().HasResult()) { auto resultYsonString = input.Ref().GetResult().Content(); - auto resultNode = NYT::NodeFromYsonString(TString(resultYsonString), ::NYson::EYsonType::Node); + auto resultNode = NYT::NodeFromYsonString(TString(resultYsonString), ::NYson::EYsonType::Node); YQL_ENSURE(resultNode.IsMap()); auto resultBoolNode = resultNode.AsMap()["Data"]; YQL_ENSURE(resultBoolNode.IsBool()); @@ -395,7 +395,7 @@ namespace { } else if (input.Ref().HasResult()) { // parse list auto resultYsonString = input.Ref().GetResult().Content(); - auto resultNode = NYT::NodeFromYsonString(TString(resultYsonString), ::NYson::EYsonType::Node); + auto resultNode = NYT::NodeFromYsonString(TString(resultYsonString), ::NYson::EYsonType::Node); YQL_ENSURE(resultNode.IsMap()); auto resultDataNode = resultNode.AsMap()["Data"]; @@ -517,7 +517,7 @@ namespace { fillSettings.AllResultsBytesLimit.Clear(); discard = fillSettings.Discard = false; fillSettings.Format = IDataProvider::EResultFormat::Yson; - fillSettings.FormatDetails = ToString((ui32)NYson::EYsonFormat::Binary); + fillSettings.FormatDetails = ToString((ui32)NYson::EYsonFormat::Binary); fillSettings.RowsLimitPerWrite.Clear(); rowsLimit.Clear(); } @@ -1412,7 +1412,7 @@ namespace { return false; } - void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) override { + void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) override { if (auto resPull = TMaybeNode<TResPull>(&node)) { auto dataSourceName = resPull.Cast().DelegatedSource().Value(); auto dataSource = Config->Types.DataSourceMap.FindPtr(dataSourceName); @@ -1461,7 +1461,7 @@ namespace { }; } -TIntrusivePtr<IResultWriter> CreateYsonResultWriter(NYson::EYsonFormat format) { +TIntrusivePtr<IResultWriter> CreateYsonResultWriter(NYson::EYsonFormat format) { return MakeIntrusive<TYsonResultWriter>(format); } diff --git a/ydb/library/yql/providers/result/provider/yql_result_provider.h b/ydb/library/yql/providers/result/provider/yql_result_provider.h index ee5bb5a9f6..0bbace8eb5 100644 --- a/ydb/library/yql/providers/result/provider/yql_result_provider.h +++ b/ydb/library/yql/providers/result/provider/yql_result_provider.h @@ -19,7 +19,7 @@ public: virtual ui64 Size() = 0; }; -TIntrusivePtr<IResultWriter> CreateYsonResultWriter(NYson::EYsonFormat format); +TIntrusivePtr<IResultWriter> CreateYsonResultWriter(NYson::EYsonFormat format); struct TResultProviderConfig : TThrRefBase { using TResultWriterFactory = std::function<TIntrusivePtr<IResultWriter>()>; diff --git a/ydb/library/yql/providers/solomon/provider/yql_solomon_datasink_execution.cpp b/ydb/library/yql/providers/solomon/provider/yql_solomon_datasink_execution.cpp index e3048498c7..ab06a84cdf 100644 --- a/ydb/library/yql/providers/solomon/provider/yql_solomon_datasink_execution.cpp +++ b/ydb/library/yql/providers/solomon/provider/yql_solomon_datasink_execution.cpp @@ -58,7 +58,7 @@ private: .Value(TString("0")) .Build() .FormatDetails() - .Value(ToString((ui32)NYson::EYsonFormat::Binary)) + .Value(ToString((ui32)NYson::EYsonFormat::Binary)) .Build() .Settings() .Build() diff --git a/ydb/library/yql/providers/ydb/provider/yql_ydb_exec.cpp b/ydb/library/yql/providers/ydb/provider/yql_ydb_exec.cpp index e798551e6e..e9ac085811 100644 --- a/ydb/library/yql/providers/ydb/provider/yql_ydb_exec.cpp +++ b/ydb/library/yql/providers/ydb/provider/yql_ydb_exec.cpp @@ -34,7 +34,7 @@ public: const auto& cluster = TString(read.DataSource().Cluster().Value()); TStringStream out; - NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Binary); + NYson::TYsonWriter writer(&out, NYson::EYsonFormat::Binary); MetaToYson(cluster, table, State_, writer); node.Ptr()->SetResult(ctx.NewAtom(node.Pos(), out.Str())); diff --git a/ydb/library/yql/providers/ydb/provider/yql_ydb_provider_impl.cpp b/ydb/library/yql/providers/ydb/provider/yql_ydb_provider_impl.cpp index 80a9e5c14d..dff69c59ca 100644 --- a/ydb/library/yql/providers/ydb/provider/yql_ydb_provider_impl.cpp +++ b/ydb/library/yql/providers/ydb/provider/yql_ydb_provider_impl.cpp @@ -71,7 +71,7 @@ bool TYdbKey::Extract(const TExprNode& key, TExprContext& ctx) { return true; } -void MetaToYson(const TString& cluster, const TString& table, TYdbState::TPtr state, NYson::TYsonWriter& writer) { +void MetaToYson(const TString& cluster, const TString& table, TYdbState::TPtr state, NYson::TYsonWriter& writer) { const auto& meta = state->Tables[std::make_pair(cluster, table)]; writer.OnBeginMap(); writer.OnKeyedItem("Data"); diff --git a/ydb/library/yql/providers/ydb/provider/yql_ydb_provider_impl.h b/ydb/library/yql/providers/ydb/provider/yql_ydb_provider_impl.h index 454c019d58..e0fdc66669 100644 --- a/ydb/library/yql/providers/ydb/provider/yql_ydb_provider_impl.h +++ b/ydb/library/yql/providers/ydb/provider/yql_ydb_provider_impl.h @@ -24,7 +24,7 @@ THolder<IGraphTransformer> CreateYdbLogicalOptProposalTransformer(TYdbState::TPt THolder<IGraphTransformer> CreateYdbPhysicalOptProposalTransformer(TYdbState::TPtr state); THolder<IGraphTransformer> CreateYdbSourceCallableExecutionTransformer(TYdbState::TPtr state); -void MetaToYson(const TString& cluster, const TString& table, TYdbState::TPtr state, NYson::TYsonWriter& writer); +void MetaToYson(const TString& cluster, const TString& table, TYdbState::TPtr state, NYson::TYsonWriter& writer); class TYdbKey { public: diff --git a/ydb/public/lib/yson_value/ydb_yson_value.cpp b/ydb/public/lib/yson_value/ydb_yson_value.cpp index c855acf0a7..c9bde983da 100644 --- a/ydb/public/lib/yson_value/ydb_yson_value.cpp +++ b/ydb/public/lib/yson_value/ydb_yson_value.cpp @@ -7,7 +7,7 @@ namespace NYdb { -static void PrimitiveValueToYson(EPrimitiveType type, TValueParser& parser, NYson::TYsonWriter& writer) +static void PrimitiveValueToYson(EPrimitiveType type, TValueParser& parser, NYson::TYsonWriter& writer) { switch (type) { case EPrimitiveType::Bool: @@ -87,7 +87,7 @@ static void PrimitiveValueToYson(EPrimitiveType type, TValueParser& parser, NYso } } -static void FormatValueYsonInternal(TValueParser& parser, NYson::TYsonWriter& writer) +static void FormatValueYsonInternal(TValueParser& parser, NYson::TYsonWriter& writer) { switch (parser.GetKind()) { case TTypeParser::ETypeKind::Primitive: @@ -184,23 +184,23 @@ static void FormatValueYsonInternal(TValueParser& parser, NYson::TYsonWriter& wr } } -void FormatValueYson(const TValue& value, NYson::TYsonWriter& writer) +void FormatValueYson(const TValue& value, NYson::TYsonWriter& writer) { TValueParser parser(value); FormatValueYsonInternal(parser, writer); } -TString FormatValueYson(const TValue& value, NYson::EYsonFormat ysonFormat) +TString FormatValueYson(const TValue& value, NYson::EYsonFormat ysonFormat) { TStringStream out; - NYson::TYsonWriter writer(&out, ysonFormat, ::NYson::EYsonType::Node, true); + NYson::TYsonWriter writer(&out, ysonFormat, ::NYson::EYsonType::Node, true); FormatValueYson(value, writer); return out.Str(); } -void FormatResultSetYson(const TResultSet& result, NYson::TYsonWriter& writer) +void FormatResultSetYson(const TResultSet& result, NYson::TYsonWriter& writer) { auto columns = result.GetColumnsMeta(); @@ -220,10 +220,10 @@ void FormatResultSetYson(const TResultSet& result, NYson::TYsonWriter& writer) writer.OnEndList(); } -TString FormatResultSetYson(const TResultSet& result, NYson::EYsonFormat ysonFormat) +TString FormatResultSetYson(const TResultSet& result, NYson::EYsonFormat ysonFormat) { TStringStream out; - NYson::TYsonWriter writer(&out, ysonFormat, ::NYson::EYsonType::Node, true); + NYson::TYsonWriter writer(&out, ysonFormat, ::NYson::EYsonType::Node, true); FormatResultSetYson(result, writer); diff --git a/ydb/public/lib/yson_value/ydb_yson_value.h b/ydb/public/lib/yson_value/ydb_yson_value.h index c20bdf35e7..0d6a438ecb 100644 --- a/ydb/public/lib/yson_value/ydb_yson_value.h +++ b/ydb/public/lib/yson_value/ydb_yson_value.h @@ -10,12 +10,12 @@ namespace NYdb { -void FormatValueYson(const TValue& value, NYson::TYsonWriter& writer); +void FormatValueYson(const TValue& value, NYson::TYsonWriter& writer); -TString FormatValueYson(const TValue& value, NYson::EYsonFormat ysonFormat = NYson::EYsonFormat::Text); +TString FormatValueYson(const TValue& value, NYson::EYsonFormat ysonFormat = NYson::EYsonFormat::Text); -void FormatResultSetYson(const TResultSet& result, NYson::TYsonWriter& writer); +void FormatResultSetYson(const TResultSet& result, NYson::TYsonWriter& writer); -TString FormatResultSetYson(const TResultSet& result, NYson::EYsonFormat ysonFormat = NYson::EYsonFormat::Text); +TString FormatResultSetYson(const TResultSet& result, NYson::EYsonFormat ysonFormat = NYson::EYsonFormat::Text); } // namespace NYdb |