#pragma once #include "yql_user_data.h" #include #include #include #include namespace NYql { class TTypeAnnotationNode; struct TUserDataBlock; struct TExprContext; struct TFilePathWithMd5 { TString Path; TString Md5; explicit TFilePathWithMd5(const TString& path = "", const TString& md5 = "") : Path(path) , Md5(md5) { } TFilePathWithMd5& operator=(const TFilePathWithMd5& other) = default; }; class IUdfResolver : public TThrRefBase { public: using TPtr = TIntrusiveConstPtr; virtual ~IUdfResolver() = default; struct TFunction { // input TPosition Pos; TString Name; TString TypeConfig; const TTypeAnnotationNode* UserType = nullptr; THashMap SecureParams; // output TString NormalizedName; const TTypeAnnotationNode* NormalizedUserType = nullptr; const TTypeAnnotationNode* RunConfigType = nullptr; const TTypeAnnotationNode* CallableType = nullptr; bool SupportsBlocks = false; bool IsStrict = false; }; struct TImport { // input TPosition Pos; TString FileAlias; const TUserDataBlock* Block = nullptr; // output TMaybe> Modules; }; /* Returns nothing if module is not a system one Always returns frozen path */ virtual TMaybe GetSystemModulePath(const TStringBuf& moduleName) const = 0; virtual bool LoadMetadata(const TVector& imports, const TVector& functions, TExprContext& ctx) const = 0; virtual TResolveResult LoadRichMetadata(const TVector& imports) const = 0; virtual bool ContainsModule(const TStringBuf& moduleName) const = 0; }; TResolveResult LoadRichMetadata(const IUdfResolver& resolver, const TVector& blocks); TResolveResult LoadRichMetadata(const IUdfResolver& resolver, const TVector& paths); }