diff options
author | vvvv <vvvv@yandex-team.com> | 2024-12-11 18:27:12 +0300 |
---|---|---|
committer | Vitaly Isaev <vitalyisaev@ydb.tech> | 2024-12-12 10:12:06 +0000 |
commit | 6f7aec7116e07787d02f8fd5d96b8e98dfa607ca (patch) | |
tree | 7feb15eb19dee1ddd64cfe433307583c97339887 /yql | |
parent | 1c02f62aebf17622a4a57b007aa91e9caf4e2729 (diff) | |
download | ydb-6f7aec7116e07787d02f8fd5d96b8e98dfa607ca.tar.gz |
Introduced NoYield argument flag
init
commit_hash:531cbd91ec4aac4c7fb0959310f8fc082fa9b892
Diffstat (limited to 'yql')
-rw-r--r-- | yql/essentials/ast/ya.make | 2 | ||||
-rw-r--r-- | yql/essentials/ast/yql_expr.h | 6 | ||||
-rw-r--r-- | yql/essentials/ast/yql_type_string.cpp | 22 | ||||
-rw-r--r-- | yql/essentials/ast/yql_type_string_ut.cpp | 4 | ||||
-rw-r--r-- | yql/essentials/public/udf/udf_types.h | 5 | ||||
-rw-r--r-- | yql/essentials/public/udf/udf_version.h | 2 |
6 files changed, 31 insertions, 10 deletions
diff --git a/yql/essentials/ast/ya.make b/yql/essentials/ast/ya.make index 04b39457a0..58c21a1d7f 100644 --- a/yql/essentials/ast/ya.make +++ b/yql/essentials/ast/ya.make @@ -41,6 +41,8 @@ PEERDIR( yql/essentials/parser/pg_catalog ) +YQL_LAST_ABI_VERSION() + END() RECURSE_FOR_TESTS( diff --git a/yql/essentials/ast/yql_expr.h b/yql/essentials/ast/yql_expr.h index 8238204552..a903c0022b 100644 --- a/yql/essentials/ast/yql_expr.h +++ b/yql/essentials/ast/yql_expr.h @@ -1095,12 +1095,6 @@ public: } }; -struct TArgumentFlags { - enum { - AutoMap = 0x01, - }; -}; - class TCallableExprType : public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::Callable; diff --git a/yql/essentials/ast/yql_type_string.cpp b/yql/essentials/ast/yql_type_string.cpp index b9b6570cf0..8d38a751c8 100644 --- a/yql/essentials/ast/yql_type_string.cpp +++ b/yql/essentials/ast/yql_type_string.cpp @@ -3,8 +3,10 @@ #include "yql_ast_escaping.h" #include <yql/essentials/parser/pg_catalog/catalog.h> +#include <yql/essentials/public/udf/udf_types.h> #include <library/cpp/containers/stack_vector/stack_vec.h> + #include <util/string/cast.h> #include <util/generic/map.h> #include <util/generic/utility.h> @@ -559,7 +561,9 @@ private: for (;;) { if (Token == TOKEN_IDENTIFIER) { if (Identifier == TStringBuf("AutoMap")) { - argFlags |= TArgumentFlags::AutoMap; + argFlags |= NUdf::ICallablePayload::TArgumentFlags::AutoMap; + } else if (Identifier == TStringBuf("NoYield")) { + argFlags |= NUdf::ICallablePayload::TArgumentFlags::NoYield; } else { AddError(TString("Unknown flag name: ") + Identifier); return false; @@ -1329,8 +1333,22 @@ private: argInfo.Type->Accept(*this); if (argInfo.Flags) { Out_ << TStringBuf("{Flags:"); - if (argInfo.Flags & TArgumentFlags::AutoMap) { + bool start = true; + if (argInfo.Flags & NUdf::ICallablePayload::TArgumentFlags::AutoMap) { + if (!start) { + Out_ << '|'; + } + Out_ << TStringBuf("AutoMap"); + start = false; + } + if (argInfo.Flags & NUdf::ICallablePayload::TArgumentFlags::NoYield) { + if (!start) { + Out_ << '|'; + } + + Out_ << TStringBuf("NoYield"); + start = false; } Out_ << '}'; } diff --git a/yql/essentials/ast/yql_type_string_ut.cpp b/yql/essentials/ast/yql_type_string_ut.cpp index 9b6db5f11e..676f6c2397 100644 --- a/yql/essentials/ast/yql_type_string_ut.cpp +++ b/yql/essentials/ast/yql_type_string_ut.cpp @@ -203,6 +203,10 @@ Y_UNIT_TEST_SUITE(TTypeString) "(CallableType '() '((DataType 'Double)) " "'((DataType 'Int32) 'x '1)" ")"); + TestOk("(x:Int32{Flags: AutoMap | NoYield})->Double", + "(CallableType '() '((DataType 'Double)) " + "'((DataType 'Int32) 'x '3)" + ")"); } Y_UNIT_TEST(ParseCallableWithPayload) { diff --git a/yql/essentials/public/udf/udf_types.h b/yql/essentials/public/udf/udf_types.h index 57f2f4e7e9..c5610016dc 100644 --- a/yql/essentials/public/udf/udf_types.h +++ b/yql/essentials/public/udf/udf_types.h @@ -131,6 +131,9 @@ public: struct TArgumentFlags { enum { AutoMap = 0x01, +#if UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 41) + NoYield = 0x02, +#endif }; }; @@ -321,7 +324,7 @@ public: public: // returns nullptr if type isn't supported virtual IArrowType::TPtr MakeArrowType(const TType* type) const = 0; - // The given ArrowSchema struct is released, even if this function fails. + // The given ArrowSchema struct is released, even if this function fails. virtual IArrowType::TPtr ImportArrowType(ArrowSchema* schema) const = 0; }; #endif diff --git a/yql/essentials/public/udf/udf_version.h b/yql/essentials/public/udf/udf_version.h index 8045789bfc..747d15cf44 100644 --- a/yql/essentials/public/udf/udf_version.h +++ b/yql/essentials/public/udf/udf_version.h @@ -7,7 +7,7 @@ namespace NYql { namespace NUdf { #define CURRENT_UDF_ABI_VERSION_MAJOR 2 -#define CURRENT_UDF_ABI_VERSION_MINOR 40 +#define CURRENT_UDF_ABI_VERSION_MINOR 41 #define CURRENT_UDF_ABI_VERSION_PATCH 0 #ifdef USE_CURRENT_UDF_ABI_VERSION |