diff options
author | vvvv <[email protected]> | 2025-04-21 20:53:56 +0300 |
---|---|---|
committer | vvvv <[email protected]> | 2025-04-21 21:26:59 +0300 |
commit | 108c1aa409626aa29ca728edafd01fbbd7a1b00e (patch) | |
tree | b88c1e3b690a29b0ed4f505f05990d656d6373ec /yql/essentials/core | |
parent | 6b17ad8c52e16d0088291781e1b5a9e28d028b9b (diff) |
YQL-19861 abi, udf resolvers, test, pass via yt gateways
commit_hash:6e3f5fac6a8598586987b52d749644d1ce1fccbe
Diffstat (limited to 'yql/essentials/core')
-rw-r--r-- | yql/essentials/core/type_ann/type_ann_core.cpp | 45 | ||||
-rw-r--r-- | yql/essentials/core/type_ann/ya.make | 1 | ||||
-rw-r--r-- | yql/essentials/core/yql_type_annotation.h | 2 | ||||
-rw-r--r-- | yql/essentials/core/yql_udf_resolver.h | 4 |
4 files changed, 51 insertions, 1 deletions
diff --git a/yql/essentials/core/type_ann/type_ann_core.cpp b/yql/essentials/core/type_ann/type_ann_core.cpp index 91924ba853f..af3d5332696 100644 --- a/yql/essentials/core/type_ann/type_ann_core.cpp +++ b/yql/essentials/core/type_ann/type_ann_core.cpp @@ -22,6 +22,7 @@ #include <yql/essentials/minikql/dom/yson.h> #include <yql/essentials/utils/log/log.h> #include <yql/essentials/public/udf/udf_data_type.h> +#include <yql/essentials/public/langver/yql_langver.h> #include <yql/essentials/providers/common/schema/expr/yql_expr_schema.h> #include <yql/essentials/utils/utf8.h> @@ -7606,7 +7607,8 @@ template <NKikimr::NUdf::EDataSlot DataSlot> if (!EnsureTupleSize(*child, 1, ctx.Expr)) { return IGraphTransformer::TStatus::Error; } - } else if (settingName == "cpu" || settingName == "extraMem") { + } else if (settingName == "cpu" || settingName == "extraMem" || + settingName == "minLang" || settingName == "maxLang") { if (!EnsureTupleSize(*child, 2, ctx.Expr)) { return IGraphTransformer::TStatus::Error; } @@ -7614,6 +7616,30 @@ template <NKikimr::NUdf::EDataSlot DataSlot> if (!EnsureAtom(child->Tail(), ctx.Expr)) { return IGraphTransformer::TStatus::Error; } + + if (ctx.Types.LangVer != UnknownLangVersion) { + if (settingName == "minLang" && ctx.Types.LangVer < FromString<NYql::TLangVersion>(child->Tail().Content())) { + TLangVersionBuffer buffer; + TStringBuf str; + if (!FormatLangVersion(FromString<NYql::TLangVersion>(child->Tail().Content()), buffer, str)) { + str = "unknown"; + } + + ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(input->Pos()), TStringBuilder() << "UDF '" << name << "' is not available before version " << str)); + return IGraphTransformer::TStatus::Error; + } + + if (settingName == "maxLang" && ctx.Types.LangVer > FromString<NYql::TLangVersion>(child->Tail().Content())) { + TLangVersionBuffer buffer; + TStringBuf str; + if (!FormatLangVersion(FromString<NYql::TLangVersion>(child->Tail().Content()), buffer, str)) { + str = "unknown"; + } + + ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(input->Pos()), TStringBuilder() << "UDF '" << name << "' is not available after version " << str)); + return IGraphTransformer::TStatus::Error; + } + } } else { ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(child->Head().Pos()), TStringBuilder() << "Unknown setting: " << settingName)); return IGraphTransformer::TStatus::Error; @@ -7630,6 +7656,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> description.Name = TString(name); description.UserType = userType; description.TypeConfig = typeConfig; + description.LangVer = ctx.Types.LangVer; ctx.Types.Credentials->ForEach([&description](const TString& name, const TCredential& cred) { description.SecureParams[TString("token:") + name] = cred.Content; if (name.StartsWith("default_")) { @@ -7679,6 +7706,8 @@ template <NKikimr::NUdf::EDataSlot DataSlot> cached.NormalizedUserType = description.NormalizedUserType ? description.NormalizedUserType : ctx.Expr.MakeType<TVoidExprType>(); cached.SupportsBlocks = description.SupportsBlocks; cached.IsStrict = description.IsStrict; + cached.MinLangVer = description.MinLangVer; + cached.MaxLangVer = description.MaxLangVer; if (name != cached.NormalizedName) { ctx.Types.UdfTypeCache[std::make_tuple(cached.NormalizedName, TString(typeConfig), userType)] = cached; @@ -7733,6 +7762,20 @@ template <NKikimr::NUdf::EDataSlot DataSlot> .Seal(); } + if (cached.MinLangVer != UnknownLangVersion) { + parent.List(settingIndex++) + .Atom(0, "minLang") + .Atom(1, cached.MinLangVer) + .Seal(); + } + + if (cached.MaxLangVer != UnknownLangVersion) { + parent.List(settingIndex++) + .Atom(0, "maxLang") + .Atom(1, cached.MaxLangVer) + .Seal(); + } + if (settings) { if (auto setting = GetSetting(*settings, "cpu")) { parent.Add(settingIndex++, setting); diff --git a/yql/essentials/core/type_ann/ya.make b/yql/essentials/core/type_ann/ya.make index 80b44ce2799..a71db2a9c8e 100644 --- a/yql/essentials/core/type_ann/ya.make +++ b/yql/essentials/core/type_ann/ya.make @@ -36,6 +36,7 @@ PEERDIR( yql/essentials/parser/pg_catalog yql/essentials/core/sql_types yql/essentials/parser/pg_wrapper/interface + yql/essentials/public/langver library/cpp/yson/node ) diff --git a/yql/essentials/core/yql_type_annotation.h b/yql/essentials/core/yql_type_annotation.h index a43650a01f4..ba5d04fc170 100644 --- a/yql/essentials/core/yql_type_annotation.h +++ b/yql/essentials/core/yql_type_annotation.h @@ -339,6 +339,8 @@ struct TUdfCachedInfo { const TTypeAnnotationNode* NormalizedUserType = nullptr; bool SupportsBlocks = false; bool IsStrict = false; + TLangVersion MinLangVer = UnknownLangVersion; + TLangVersion MaxLangVer = UnknownLangVersion; }; const TString TypeAnnotationContextComponent = "TypeAnnotationContext"; diff --git a/yql/essentials/core/yql_udf_resolver.h b/yql/essentials/core/yql_udf_resolver.h index dff7e5bc07a..915a7a40407 100644 --- a/yql/essentials/core/yql_udf_resolver.h +++ b/yql/essentials/core/yql_udf_resolver.h @@ -4,6 +4,7 @@ #include <yql/essentials/providers/common/proto/udf_resolver.pb.h> #include <yql/essentials/core/yql_holding_file_storage.h> +#include <yql/essentials/public/langver/yql_langver.h> #include <yql/essentials/public/issue/yql_issue.h> #include <yql/essentials/public/udf/udf_log.h> @@ -42,6 +43,7 @@ public: TString TypeConfig; const TTypeAnnotationNode* UserType = nullptr; THashMap<TString, TString> SecureParams; + NYql::TLangVersion LangVer = NYql::UnknownLangVersion; // output TString NormalizedName; @@ -50,6 +52,8 @@ public: const TTypeAnnotationNode* CallableType = nullptr; bool SupportsBlocks = false; bool IsStrict = false; + NYql::TLangVersion MinLangVer = NYql::UnknownLangVersion; + NYql::TLangVersion MaxLangVer = NYql::UnknownLangVersion; TVector<TString> Messages; }; |