diff options
author | marsaly <[email protected]> | 2023-02-03 13:06:12 +0300 |
---|---|---|
committer | marsaly <[email protected]> | 2023-02-03 13:06:12 +0300 |
commit | f6f5837c9d0278853229cd10e24c140979ddca2e (patch) | |
tree | 839b955209c85ce60d7dbc8b0e1aee853accbcab | |
parent | cea66ed1b917193b66004e497e255b3e4d7bba3d (diff) |
Strict markers for the math, pire, re2, set & stat modules
Marked all math UDFs strict
No UDF in pire is strict
Escape & Options UDFs in re2 are strict
Create, AddValue, WasChanged, Merge, Serialize, GetResult UDF in set are strict
TDigest_AddValue, TDigest_GetPercentile, TDigest_Serialize, TDigest_Merge UDF in stat are strict
19 files changed, 42 insertions, 22 deletions
diff --git a/ydb/library/yql/udfs/common/math/CMakeLists.darwin.txt b/ydb/library/yql/udfs/common/math/CMakeLists.darwin.txt index fe081a1fc89..099af4f71c6 100644 --- a/ydb/library/yql/udfs/common/math/CMakeLists.darwin.txt +++ b/ydb/library/yql/udfs/common/math/CMakeLists.darwin.txt @@ -21,7 +21,7 @@ target_link_libraries(math_udf INTERFACE add_global_library_for(math_udf.global math_udf) target_compile_options(math_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(math_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/math/CMakeLists.linux-aarch64.txt b/ydb/library/yql/udfs/common/math/CMakeLists.linux-aarch64.txt index 6981794d21d..940739a13ca 100644 --- a/ydb/library/yql/udfs/common/math/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/udfs/common/math/CMakeLists.linux-aarch64.txt @@ -22,7 +22,7 @@ target_link_libraries(math_udf INTERFACE add_global_library_for(math_udf.global math_udf) target_compile_options(math_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(math_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/math/CMakeLists.linux.txt b/ydb/library/yql/udfs/common/math/CMakeLists.linux.txt index 6981794d21d..940739a13ca 100644 --- a/ydb/library/yql/udfs/common/math/CMakeLists.linux.txt +++ b/ydb/library/yql/udfs/common/math/CMakeLists.linux.txt @@ -22,7 +22,7 @@ target_link_libraries(math_udf INTERFACE add_global_library_for(math_udf.global math_udf) target_compile_options(math_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(math_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/math/math_udf.cpp b/ydb/library/yql/udfs/common/math/math_udf.cpp index 3491a7bdace..394b8cdf7f8 100644 --- a/ydb/library/yql/udfs/common/math/math_udf.cpp +++ b/ydb/library/yql/udfs/common/math/math_udf.cpp @@ -57,6 +57,13 @@ return res; \ } +#define MATH_STRICT_UDF_IMPL(name, signature, options) \ + UDF_IMPL(T##name, builder.SimpleSignature<signature>().IsStrict(); options;, ;, ;, "/llvm_bc/Math", #name "IR") { \ + TUnboxedValuePod res; \ + name##IR(this, &res, valueBuilder, args); \ + return res; \ + } + #define REGISTER_MATH_UDF(udfName, ...) T##udfName, #define REGISTER_MATH_UDF_LAST(udfName, ...) T##udfName @@ -70,7 +77,7 @@ namespace { extern const char precision[] = "Precision"; using TPrecision = TNamedArg<int, precision>; - MATH_UDF_MAP(MATH_UDF_IMPL, MATH_UDF_IMPL) + MATH_UDF_MAP(MATH_STRICT_UDF_IMPL, MATH_STRICT_UDF_IMPL) SIMPLE_MODULE(TMathModule, MATH_UDF_MAP(REGISTER_MATH_UDF, REGISTER_MATH_UDF_LAST)) diff --git a/ydb/library/yql/udfs/common/re2/CMakeLists.darwin.txt b/ydb/library/yql/udfs/common/re2/CMakeLists.darwin.txt index 0ecc44510c8..1e90e3974b2 100644 --- a/ydb/library/yql/udfs/common/re2/CMakeLists.darwin.txt +++ b/ydb/library/yql/udfs/common/re2/CMakeLists.darwin.txt @@ -20,7 +20,7 @@ target_link_libraries(re2_udf INTERFACE add_global_library_for(re2_udf.global re2_udf) target_compile_options(re2_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(re2_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/re2/CMakeLists.linux-aarch64.txt b/ydb/library/yql/udfs/common/re2/CMakeLists.linux-aarch64.txt index fb482a20f0f..1731af4334a 100644 --- a/ydb/library/yql/udfs/common/re2/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/udfs/common/re2/CMakeLists.linux-aarch64.txt @@ -21,7 +21,7 @@ target_link_libraries(re2_udf INTERFACE add_global_library_for(re2_udf.global re2_udf) target_compile_options(re2_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(re2_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/re2/CMakeLists.linux.txt b/ydb/library/yql/udfs/common/re2/CMakeLists.linux.txt index fb482a20f0f..1731af4334a 100644 --- a/ydb/library/yql/udfs/common/re2/CMakeLists.linux.txt +++ b/ydb/library/yql/udfs/common/re2/CMakeLists.linux.txt @@ -21,7 +21,7 @@ target_link_libraries(re2_udf INTERFACE add_global_library_for(re2_udf.global re2_udf) target_compile_options(re2_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(re2_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/re2/re2_udf.cpp b/ydb/library/yql/udfs/common/re2/re2_udf.cpp index b478675fb60..6b261f4019a 100644 --- a/ydb/library/yql/udfs/common/re2/re2_udf.cpp +++ b/ydb/library/yql/udfs/common/re2/re2_udf.cpp @@ -256,7 +256,7 @@ namespace { } }; - SIMPLE_UDF(TEscape, char*(char*)) { + SIMPLE_STRICT_UDF(TEscape, char*(char*)) { const std::string_view input(args[0].AsStringRef()); const auto& result = RE2::QuoteMeta(StringPiece(input.data(), input.size())); return input == result ? TUnboxedValue(args[0]) : valueBuilder->NewString(result); @@ -315,6 +315,8 @@ namespace { bool typesOnly) { Y_UNUSED(userType); if (Name() == name) { + builder.IsStrict(); + auto argsBuilder = builder.Args(); #define FIELD_HANDLE(name, index, type, ...) argsBuilder->Add<TOptional<type>>().Name(TStringRef::Of(#name)); OPTIONS_MAP(FIELD_HANDLE) diff --git a/ydb/library/yql/udfs/common/set/CMakeLists.darwin.txt b/ydb/library/yql/udfs/common/set/CMakeLists.darwin.txt index f8fd405a225..b0794f743c0 100644 --- a/ydb/library/yql/udfs/common/set/CMakeLists.darwin.txt +++ b/ydb/library/yql/udfs/common/set/CMakeLists.darwin.txt @@ -18,7 +18,7 @@ target_link_libraries(set_udf INTERFACE add_global_library_for(set_udf.global set_udf) target_compile_options(set_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(set_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/set/CMakeLists.linux-aarch64.txt b/ydb/library/yql/udfs/common/set/CMakeLists.linux-aarch64.txt index 4b9258ffba9..75ac12f476a 100644 --- a/ydb/library/yql/udfs/common/set/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/udfs/common/set/CMakeLists.linux-aarch64.txt @@ -19,7 +19,7 @@ target_link_libraries(set_udf INTERFACE add_global_library_for(set_udf.global set_udf) target_compile_options(set_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(set_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/set/CMakeLists.linux.txt b/ydb/library/yql/udfs/common/set/CMakeLists.linux.txt index 4b9258ffba9..75ac12f476a 100644 --- a/ydb/library/yql/udfs/common/set/CMakeLists.linux.txt +++ b/ydb/library/yql/udfs/common/set/CMakeLists.linux.txt @@ -19,7 +19,7 @@ target_link_libraries(set_udf INTERFACE add_global_library_for(set_udf.global set_udf) target_compile_options(set_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(set_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/set/set_udf.cpp b/ydb/library/yql/udfs/common/set/set_udf.cpp index f282c22842c..b915443bcad 100644 --- a/ydb/library/yql/udfs/common/set/set_udf.cpp +++ b/ydb/library/yql/udfs/common/set/set_udf.cpp @@ -1,4 +1,3 @@ - #include <ydb/library/yql/public/udf/udf_type_ops.h> #include <ydb/library/yql/public/udf/udf_helpers.h> @@ -457,6 +456,8 @@ public: builder.Args()->Add(valueType).Add<ui32>().Done().Returns(setType); if (!typesOnly) { + builder.IsStrict(); + if (isGeneric) { builder.Implementation(new TSetCreate(hash, equate)); } else { @@ -471,6 +472,8 @@ public: builder.Args()->Add(setType).Add(valueType).Done().Returns(setType); if (!typesOnly) { + builder.IsStrict(); + if (isGeneric) { builder.Implementation(new TSetAddValue); } else { @@ -485,6 +488,8 @@ public: builder.Args()->Add(setType).Done().Returns<bool>(); if (!typesOnly) { + builder.IsStrict(); + if (isGeneric) { builder.Implementation(new TSetWasChanged); } else { @@ -499,6 +504,8 @@ public: builder.Args()->Add(setType).Add(setType).Done().Returns(setType); if (!typesOnly) { + builder.IsStrict(); + if (isGeneric) { builder.Implementation(new TSetMerge(hash, equate)); } else { @@ -513,6 +520,8 @@ public: builder.Args()->Add(setType).Done().Returns(serializedType); if (!typesOnly) { + builder.IsStrict(); + if (isGeneric) { builder.Implementation(new TSetSerialize); } else { @@ -543,6 +552,8 @@ public: builder.Args()->Add(setType).Done().Returns(resultType); if (!typesOnly) { + builder.IsStrict(); + if (isGeneric) { builder.Implementation(new TSetGetResult); } else { diff --git a/ydb/library/yql/udfs/common/stat/CMakeLists.darwin.txt b/ydb/library/yql/udfs/common/stat/CMakeLists.darwin.txt index df023a6ffad..1df8d6d188c 100644 --- a/ydb/library/yql/udfs/common/stat/CMakeLists.darwin.txt +++ b/ydb/library/yql/udfs/common/stat/CMakeLists.darwin.txt @@ -21,7 +21,7 @@ target_link_libraries(stat_udf INTERFACE add_global_library_for(stat_udf.global stat_udf) target_compile_options(stat_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(stat_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/stat/CMakeLists.linux-aarch64.txt b/ydb/library/yql/udfs/common/stat/CMakeLists.linux-aarch64.txt index 1d815f75840..dc61b234b3b 100644 --- a/ydb/library/yql/udfs/common/stat/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/udfs/common/stat/CMakeLists.linux-aarch64.txt @@ -22,7 +22,7 @@ target_link_libraries(stat_udf INTERFACE add_global_library_for(stat_udf.global stat_udf) target_compile_options(stat_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(stat_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/stat/CMakeLists.linux.txt b/ydb/library/yql/udfs/common/stat/CMakeLists.linux.txt index 1d815f75840..dc61b234b3b 100644 --- a/ydb/library/yql/udfs/common/stat/CMakeLists.linux.txt +++ b/ydb/library/yql/udfs/common/stat/CMakeLists.linux.txt @@ -22,7 +22,7 @@ target_link_libraries(stat_udf INTERFACE add_global_library_for(stat_udf.global stat_udf) target_compile_options(stat_udf.global PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(stat_udf.global PUBLIC diff --git a/ydb/library/yql/udfs/common/stat/static/CMakeLists.darwin.txt b/ydb/library/yql/udfs/common/stat/static/CMakeLists.darwin.txt index 02060bf28fa..7dee63a8c0c 100644 --- a/ydb/library/yql/udfs/common/stat/static/CMakeLists.darwin.txt +++ b/ydb/library/yql/udfs/common/stat/static/CMakeLists.darwin.txt @@ -10,7 +10,7 @@ add_library(common-stat-static) target_compile_options(common-stat-static PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(common-stat-static PUBLIC diff --git a/ydb/library/yql/udfs/common/stat/static/CMakeLists.linux-aarch64.txt b/ydb/library/yql/udfs/common/stat/static/CMakeLists.linux-aarch64.txt index a06acd76a85..9302da9ae4d 100644 --- a/ydb/library/yql/udfs/common/stat/static/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/udfs/common/stat/static/CMakeLists.linux-aarch64.txt @@ -10,7 +10,7 @@ add_library(common-stat-static) target_compile_options(common-stat-static PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(common-stat-static PUBLIC diff --git a/ydb/library/yql/udfs/common/stat/static/CMakeLists.linux.txt b/ydb/library/yql/udfs/common/stat/static/CMakeLists.linux.txt index a06acd76a85..9302da9ae4d 100644 --- a/ydb/library/yql/udfs/common/stat/static/CMakeLists.linux.txt +++ b/ydb/library/yql/udfs/common/stat/static/CMakeLists.linux.txt @@ -10,7 +10,7 @@ add_library(common-stat-static) target_compile_options(common-stat-static PRIVATE -DUDF_ABI_VERSION_MAJOR=2 - -DUDF_ABI_VERSION_MINOR=27 + -DUDF_ABI_VERSION_MINOR=28 -DUDF_ABI_VERSION_PATCH=0 ) target_link_libraries(common-stat-static PUBLIC diff --git a/ydb/library/yql/udfs/common/stat/static/stat_udf.h b/ydb/library/yql/udfs/common/stat/static/stat_udf.h index 7cc4f8abb55..208b4674702 100644 --- a/ydb/library/yql/udfs/common/stat/static/stat_udf.h +++ b/ydb/library/yql/udfs/common/stat/static/stat_udf.h @@ -25,7 +25,7 @@ namespace { return TUnboxedValuePod(new TDigestResource(delta, K, args[0].Get<double>())); } - SIMPLE_UDF(TTDigest_AddValue, TResource<DigestResourceName>(TResource<DigestResourceName>, double)) { + SIMPLE_STRICT_UDF(TTDigest_AddValue, TResource<DigestResourceName>(TResource<DigestResourceName>, double)) { Y_UNUSED(valueBuilder); TDigestResource::Validate(args[0]); TDigestResource* resource = static_cast<TDigestResource*>(args[0].AsBoxed().Get()); @@ -33,13 +33,13 @@ namespace { return TUnboxedValuePod(resource); } - SIMPLE_UDF(TTDigest_GetPercentile, double(TResource<DigestResourceName>, double)) { + SIMPLE_STRICT_UDF(TTDigest_GetPercentile, double(TResource<DigestResourceName>, double)) { Y_UNUSED(valueBuilder); TDigestResource::Validate(args[0]); return TUnboxedValuePod(static_cast<TDigestResource*>(args[0].AsBoxed().Get())->Get()->GetPercentile(args[1].Get<double>())); } - SIMPLE_UDF(TTDigest_Serialize, char*(TResource<DigestResourceName>)) { + SIMPLE_STRICT_UDF(TTDigest_Serialize, char*(TResource<DigestResourceName>)) { TDigestResource::Validate(args[0]); return valueBuilder->NewString(static_cast<TDigestResource*>(args[0].AsBoxed().Get())->Get()->Serialize()); } @@ -49,7 +49,7 @@ namespace { return TUnboxedValuePod(new TDigestResource(TString(args[0].AsStringRef()))); } - SIMPLE_UDF(TTDigest_Merge, TResource<DigestResourceName>(TResource<DigestResourceName>, TResource<DigestResourceName>)) { + SIMPLE_STRICT_UDF(TTDigest_Merge, TResource<DigestResourceName>(TResource<DigestResourceName>, TResource<DigestResourceName>)) { Y_UNUSED(valueBuilder); TDigestResource::Validate(args[0]); TDigestResource::Validate(args[1]); |