diff options
| author | atarasov5 <[email protected]> | 2025-05-14 14:41:50 +0300 |
|---|---|---|
| committer | atarasov5 <[email protected]> | 2025-05-14 14:56:21 +0300 |
| commit | 1565ceee67746697db75e898d9f6ebb51232bc5f (patch) | |
| tree | a7851e1c17965654194ae5a9d000b50223348db2 /yql/essentials/minikql/computation/mkql_computation_node_holders.h | |
| parent | 75945316e2777e65ff19c9aafc661efbecad682a (diff) | |
YQL-19765: Store IHash, ICompare, IEquate by type value instead of pointer
commit_hash:9e278f075e1a9c899d4ef9c137eee25958597358
Diffstat (limited to 'yql/essentials/minikql/computation/mkql_computation_node_holders.h')
| -rw-r--r-- | yql/essentials/minikql/computation/mkql_computation_node_holders.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/yql/essentials/minikql/computation/mkql_computation_node_holders.h b/yql/essentials/minikql/computation/mkql_computation_node_holders.h index 23219cc5aa1..1eb4468a98b 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_holders.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_holders.h @@ -7,6 +7,7 @@ #include <yql/essentials/minikql/aligned_page_pool.h> #include <yql/essentials/minikql/compact_hash.h> +#include <yql/essentials/minikql/mkql_node_serialization.h> #include <yql/essentials/minikql/mkql_type_ops.h> #include <yql/essentials/minikql/mkql_type_builder.h> @@ -613,10 +614,10 @@ template <class IFace> class TTypeOperationsRegistry { using TValuePtr = typename IFace::TPtr; public: - IFace* FindOrEmplace(const TType& type) { - auto it = Registry.find(type); + IFace* FindOrEmplace(TType& type) const { + const TString serializedType = SerializeNode(&type, NodeStack); + auto it = Registry.find(serializedType); if (it == Registry.end()) { - TTypeBase tb(type); TValuePtr ptr; if constexpr (std::is_same_v<IFace, NUdf::IHash>) { ptr = MakeHashImpl(&type); @@ -627,14 +628,15 @@ public: } else { static_assert(TDependentFalse<IFace>, "unexpected type"); } - auto p = std::make_pair((const TTypeBase)type, ptr); - it = Registry.insert(p).first; + auto p = std::make_pair(std::move(serializedType), std::move(ptr)); + it = Registry.insert(std::move(p)).first; } return it->second.Get(); } private: - THashMap<TTypeBase, TValuePtr, THasherTType, TEqualTType> Registry; + mutable std::vector<TNode*> NodeStack; + mutable THashMap<TString, TValuePtr> Registry; }; class TDirectArrayHolderInplace : public TComputationValue<TDirectArrayHolderInplace> { @@ -862,9 +864,9 @@ public: NUdf::TUnboxedValuePod NewVectorHolder() const; NUdf::TUnboxedValuePod NewTemporaryVectorHolder() const; - const NUdf::IHash* GetHash(const TType& type, bool useIHash) const; - const NUdf::IEquate* GetEquate(const TType& type, bool useIHash) const; - const NUdf::ICompare* GetCompare(const TType& type, bool useIHash) const; + const NUdf::IHash* GetHash(TType& type, bool useIHash) const; + const NUdf::IEquate* GetEquate(TType& type, bool useIHash) const; + const NUdf::ICompare* GetCompare(TType& type, bool useIHash) const; template <class TForwardIterator> NUdf::TUnboxedValuePod RangeAsArray(TForwardIterator first, TForwardIterator last) const { |
