diff options
author | udovichenko-r <udovichenko-r@yandex-team.com> | 2024-11-12 22:07:02 +0300 |
---|---|---|
committer | udovichenko-r <udovichenko-r@yandex-team.com> | 2024-11-12 22:21:07 +0300 |
commit | fa5655229271d7a09cce8033d1097f1b03daf94e (patch) | |
tree | 5922c2db17789e411b6cc46069c66188e834f28b /yql/essentials/core/yql_udf_index.h | |
parent | 77c13da33ae29c033359e516ac2eb55a6c3d5e9e (diff) | |
download | ydb-fa5655229271d7a09cce8033d1097f1b03daf94e.tar.gz |
Apply GH commits
Apply GH: Extract prefix and entries in backup-related sql (#10807)
Apply GH: Fix syntax for Column Family (#10781)
Apply GH: Case-insensitive mode for searching modules and functions (#10842)
Apply GH: Fixed i/o for pg_proc (#10914)
Apply GH: An option to render SQL transalation with Seq! (#11015)
commit_hash:d2d2fcdef2bbd0434236aef325aa071c7e39c526
Diffstat (limited to 'yql/essentials/core/yql_udf_index.h')
-rw-r--r-- | yql/essentials/core/yql_udf_index.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/yql/essentials/core/yql_udf_index.h b/yql/essentials/core/yql_udf_index.h index 41896d191d..1ac882bd81 100644 --- a/yql/essentials/core/yql_udf_index.h +++ b/yql/essentials/core/yql_udf_index.h @@ -72,10 +72,12 @@ struct TResourceInfo : public TThrRefBase { TDownloadLink Link; TSet<TString> Modules; TMap<TString, TFunctionInfo> Functions; + TMap<TString, TSet<TString>> ICaseFuncNames; void SetFunctions(const TVector<TFunctionInfo>& functions) { for (auto& f : functions) { Functions.emplace(f.Name, f); + ICaseFuncNames[to_lower(f.Name)].insert(f.Name); } } }; @@ -96,12 +98,21 @@ public: RaiseError }; + enum class EStatus { + Found, + NotFound, + Ambigious + }; + public: TUdfIndex(); - bool ContainsModule(const TString& moduleName) const; - bool FindFunction(const TString& moduleName, const TString& functionName, TFunctionInfo& function) const; + void SetCaseSentiveSearch(bool caseSensitive); + bool CanonizeModule(TString& moduleName) const; + EStatus ContainsModule(const TString& moduleName) const; + EStatus FindFunction(const TString& moduleName, const TString& functionName, TFunctionInfo& function) const; TResourceInfo::TPtr FindResourceByModule(const TString& moduleName) const; + bool ContainsModuleStrict(const TString& moduleName) const; /* New resource can contain already registered module. In this case 'mode' will be used to resolve conflicts. @@ -114,7 +125,7 @@ public: TIntrusivePtr<TUdfIndex> Clone() const; private: - explicit TUdfIndex(const TMap<TString, TResourceInfo::TPtr>& resources); + explicit TUdfIndex(const TMap<TString, TResourceInfo::TPtr>& resources, bool caseSensitive); bool ContainsAnyModule(const TSet<TString>& modules) const; TSet<TResourceInfo::TPtr> FindResourcesByModules(const TSet<TString>& modules) const; @@ -123,6 +134,8 @@ private: private: // module => Resource TMap<TString, TResourceInfo::TPtr> Resources_; + bool CaseSensitive_ = true; + TMap<TString, TSet<TString>> ICaseModules_; }; void LoadRichMetadataToUdfIndex(const IUdfResolver& resolver, const TVector<TString>& paths, bool isTrusted, TUdfIndex::EOverrideMode mode, TUdfIndex& registry); |