diff options
author | omgronny <omgronny@yandex-team.com> | 2024-09-04 13:52:05 +0300 |
---|---|---|
committer | omgronny <omgronny@yandex-team.com> | 2024-09-04 14:08:32 +0300 |
commit | d539a0375a47697c169702a9aa18306b2c70bb3f (patch) | |
tree | 5173d536eb8e2f2715b11ade4f33baa2ba910450 | |
parent | 83821418bcb3ec50ab74e93b6024c46226038ee5 (diff) | |
download | ydb-d539a0375a47697c169702a9aa18306b2c70bb3f.tar.gz |
Finally fix grut UDF build
ad0e6d3b81f675c3cfed923d10c1dab6235de947
-rw-r--r-- | yt/yt/core/ytree/convert-inl.h | 25 | ||||
-rw-r--r-- | yt/yt/core/ytree/convert.h | 11 | ||||
-rw-r--r-- | yt/yt/core/ytree/tree_builder.cpp | 2 | ||||
-rw-r--r-- | yt/yt/core/ytree/tree_builder.h | 10 |
4 files changed, 40 insertions, 8 deletions
diff --git a/yt/yt/core/ytree/convert-inl.h b/yt/yt/core/ytree/convert-inl.h index 2b67d693a9..2deb79c6f0 100644 --- a/yt/yt/core/ytree/convert-inl.h +++ b/yt/yt/core/ytree/convert-inl.h @@ -99,14 +99,12 @@ NYson::TYsonProducer ConvertToProducer(T&& value) //////////////////////////////////////////////////////////////////////////////// template <class T> -INodePtr ConvertToNode( +INodePtr DoConvertToNode( const T& value, - INodeFactory* factory, - int treeSizeLimit) + std::unique_ptr<ITreeBuilder> builder) { auto type = GetYsonType(value); - auto builder = CreateBuilderFromFactory(factory, treeSizeLimit); builder->BeginTree(); switch (type) { @@ -136,6 +134,25 @@ INodePtr ConvertToNode( return builder->EndTree(); } +template <class T> +INodePtr ConvertToNode( + const T& value, + int treeSizeLimit, + INodeFactory* factory) +{ + auto builder = CreateBuilderFromFactory(factory, treeSizeLimit); + return DoConvertToNode(value, std::move(builder)); +} + +template <class T> +INodePtr ConvertToNode( + const T& value, + INodeFactory* factory) +{ + auto builder = CreateBuilderFromFactory(factory); + return DoConvertToNode(value, std::move(builder)); +} + //////////////////////////////////////////////////////////////////////////////// template <class T> diff --git a/yt/yt/core/ytree/convert.h b/yt/yt/core/ytree/convert.h index 383d9bb945..8d21d1f8ca 100644 --- a/yt/yt/core/ytree/convert.h +++ b/yt/yt/core/ytree/convert.h @@ -33,11 +33,18 @@ namespace NYT::NYTree { template <class T> NYson::TYsonProducer ConvertToProducer(T&& value); +// COMPAT(omgronny): There are two different functions for creating a builder +// due to UDFs that depend on this code. template <class T> INodePtr ConvertToNode( const T& value, - INodeFactory* factory = GetEphemeralNodeFactory(), - int treeSizeLimit = std::numeric_limits<int>::max()); + int treeSizeLimit, + INodeFactory* factory = GetEphemeralNodeFactory()); + +template <class T> +INodePtr ConvertToNode( + const T& value, + INodeFactory* factory = GetEphemeralNodeFactory()); template <class T> IAttributeDictionaryPtr ConvertToAttributes(const T& value); diff --git a/yt/yt/core/ytree/tree_builder.cpp b/yt/yt/core/ytree/tree_builder.cpp index 2cbdcd2da7..624afba232 100644 --- a/yt/yt/core/ytree/tree_builder.cpp +++ b/yt/yt/core/ytree/tree_builder.cpp @@ -189,7 +189,7 @@ std::unique_ptr<ITreeBuilder> CreateBuilderFromFactory( std::unique_ptr<ITreeBuilder> CreateBuilderFromFactory( INodeFactory* factory) { - return CreateBuilderFromFactory(factory, std::numeric_limits<int>::max()); + return CreateBuilderFromFactory(std::move(factory), std::numeric_limits<int>::max()); } //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/ytree/tree_builder.h b/yt/yt/core/ytree/tree_builder.h index 17e8ca830e..2af4d56a8d 100644 --- a/yt/yt/core/ytree/tree_builder.h +++ b/yt/yt/core/ytree/tree_builder.h @@ -31,14 +31,22 @@ struct ITreeBuilder virtual void OnNode(INodePtr node) = 0; }; -//! Creates a builder that makes explicit calls to the factory. +// COMPAT(omgronny): There are two different functions for creating a builder +// due to UDFs that depend on this code. +//! Creates a builder that makes explicit calls to the factory with limit of tree size. /*! * \param factory A factory used for materializing the nodes. + * + * \param treeSizeLimit The maximum size of the tree. */ std::unique_ptr<ITreeBuilder> CreateBuilderFromFactory( INodeFactory* factory, int treeSizeLimit); +//! Creates a builder that makes explicit calls to the factory. +/*! + * \param factory A factory used for materializing the nodes. + */ std::unique_ptr<ITreeBuilder> CreateBuilderFromFactory(INodeFactory* factory); //////////////////////////////////////////////////////////////////////////////// |