aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvvvv <vvvv@ydb.tech>2023-10-20 14:57:12 +0300
committervvvv <vvvv@ydb.tech>2023-10-20 15:59:56 +0300
commitb9149c26f5470959b292b4a793e9d24801498fdd (patch)
treec850a0b7dec73b5e1d6714ba7cd45d4fdc607417
parent94b737e71f7f210914d394f192c49897c80e527d (diff)
downloadydb-b9149c26f5470959b292b4a793e9d24801498fdd.tar.gz
YQL-16880 moved protobuf udf
-rw-r--r--.mapping.json12
-rw-r--r--CMakeLists.darwin-x86_64.txt1
-rw-r--r--CMakeLists.linux-aarch64.txt1
-rw-r--r--CMakeLists.linux-x86_64.txt1
-rw-r--r--CMakeLists.windows-x86_64.txt1
-rw-r--r--ydb/library/yql/tests/common/test_framework/udfs_deps/ya.make1
-rw-r--r--ydb/library/yql/tests/s-expressions/common_file.py2
-rw-r--r--ydb/library/yql/tests/s-expressions/file.make4
-rw-r--r--ydb/library/yql/udfs/common/CMakeLists.darwin-x86_64.txt1
-rw-r--r--ydb/library/yql/udfs/common/CMakeLists.linux-aarch64.txt1
-rw-r--r--ydb/library/yql/udfs/common/CMakeLists.linux-x86_64.txt1
-rw-r--r--ydb/library/yql/udfs/common/CMakeLists.windows-x86_64.txt1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/CMakeLists.darwin-x86_64.txt71
-rw-r--r--ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-aarch64.txt77
-rw-r--r--ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-x86_64.txt77
-rw-r--r--ydb/library/yql/udfs/common/protobuf/CMakeLists.txt17
-rw-r--r--ydb/library/yql/udfs/common/protobuf/CMakeLists.windows-x86_64.txt62
-rw-r--r--ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp143
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/canondata/result.json126
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/canondata/test.test_recursion_fail_/extracted11
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.in3
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.sql11
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-16111.in0
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-16111.sql64
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.in3
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.sql7
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.in2
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.sql17
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.in4
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.sql10
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.in1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.sql35
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.cfg2
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.in1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.sql32
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.in1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.sql35
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.in4
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.sql23
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.in4
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.sql24
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_any.in0
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_any.sql43
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_enum.in0
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_enum.sql50
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.in1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.sql47
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.in1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.sql36
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.in1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.sql113
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.in1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.sql40
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.in1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.sql39
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.in4
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.in.attr1
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.sql82
-rw-r--r--ydb/library/yql/udfs/common/protobuf/test/ya.make13
-rw-r--r--ydb/library/yql/udfs/common/protobuf/ya.make22
-rw-r--r--ydb/library/yql/udfs/common/ya.make1
-rw-r--r--yql/CMakeLists.txt9
-rw-r--r--yql/library/CMakeLists.txt9
-rw-r--r--yql/library/protobuf_udf/CMakeLists.darwin-x86_64.txt32
-rw-r--r--yql/library/protobuf_udf/CMakeLists.linux-aarch64.txt33
-rw-r--r--yql/library/protobuf_udf/CMakeLists.linux-x86_64.txt33
-rw-r--r--yql/library/protobuf_udf/CMakeLists.txt17
-rw-r--r--yql/library/protobuf_udf/CMakeLists.windows-x86_64.txt32
82 files changed, 1567 insertions, 2 deletions
diff --git a/.mapping.json b/.mapping.json
index 2584dc6721..c4c909f0c9 100644
--- a/.mapping.json
+++ b/.mapping.json
@@ -8427,6 +8427,11 @@
"ydb/library/yql/udfs/common/pire/CMakeLists.linux-x86_64.txt":"",
"ydb/library/yql/udfs/common/pire/CMakeLists.txt":"",
"ydb/library/yql/udfs/common/pire/CMakeLists.windows-x86_64.txt":"",
+ "ydb/library/yql/udfs/common/protobuf/CMakeLists.darwin-x86_64.txt":"",
+ "ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-aarch64.txt":"",
+ "ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-x86_64.txt":"",
+ "ydb/library/yql/udfs/common/protobuf/CMakeLists.txt":"",
+ "ydb/library/yql/udfs/common/protobuf/CMakeLists.windows-x86_64.txt":"",
"ydb/library/yql/udfs/common/re2/CMakeLists.darwin-x86_64.txt":"",
"ydb/library/yql/udfs/common/re2/CMakeLists.linux-aarch64.txt":"",
"ydb/library/yql/udfs/common/re2/CMakeLists.linux-x86_64.txt":"",
@@ -9622,6 +9627,13 @@
"ydb/tests/tools/idx_test/CMakeLists.linux-x86_64.txt":"",
"ydb/tests/tools/idx_test/CMakeLists.txt":"",
"ydb/tests/tools/idx_test/CMakeLists.windows-x86_64.txt":"",
+ "yql/CMakeLists.txt":"",
+ "yql/library/CMakeLists.txt":"",
+ "yql/library/protobuf_udf/CMakeLists.darwin-x86_64.txt":"",
+ "yql/library/protobuf_udf/CMakeLists.linux-aarch64.txt":"",
+ "yql/library/protobuf_udf/CMakeLists.linux-x86_64.txt":"",
+ "yql/library/protobuf_udf/CMakeLists.txt":"",
+ "yql/library/protobuf_udf/CMakeLists.windows-x86_64.txt":"",
"yt/CMakeLists.txt":"",
"yt/cpp/CMakeLists.txt":"",
"yt/cpp/mapreduce/CMakeLists.txt":"",
diff --git a/CMakeLists.darwin-x86_64.txt b/CMakeLists.darwin-x86_64.txt
index 075d57df50..b24de15468 100644
--- a/CMakeLists.darwin-x86_64.txt
+++ b/CMakeLists.darwin-x86_64.txt
@@ -13,3 +13,4 @@ add_subdirectory(util)
add_subdirectory(yt)
add_subdirectory(certs)
add_subdirectory(ydb)
+add_subdirectory(yql)
diff --git a/CMakeLists.linux-aarch64.txt b/CMakeLists.linux-aarch64.txt
index 075d57df50..b24de15468 100644
--- a/CMakeLists.linux-aarch64.txt
+++ b/CMakeLists.linux-aarch64.txt
@@ -13,3 +13,4 @@ add_subdirectory(util)
add_subdirectory(yt)
add_subdirectory(certs)
add_subdirectory(ydb)
+add_subdirectory(yql)
diff --git a/CMakeLists.linux-x86_64.txt b/CMakeLists.linux-x86_64.txt
index 075d57df50..b24de15468 100644
--- a/CMakeLists.linux-x86_64.txt
+++ b/CMakeLists.linux-x86_64.txt
@@ -13,3 +13,4 @@ add_subdirectory(util)
add_subdirectory(yt)
add_subdirectory(certs)
add_subdirectory(ydb)
+add_subdirectory(yql)
diff --git a/CMakeLists.windows-x86_64.txt b/CMakeLists.windows-x86_64.txt
index e8667d4e27..0348a298de 100644
--- a/CMakeLists.windows-x86_64.txt
+++ b/CMakeLists.windows-x86_64.txt
@@ -13,3 +13,4 @@ add_subdirectory(library)
add_subdirectory(yt)
add_subdirectory(certs)
add_subdirectory(ydb)
+add_subdirectory(yql)
diff --git a/ydb/library/yql/tests/common/test_framework/udfs_deps/ya.make b/ydb/library/yql/tests/common/test_framework/udfs_deps/ya.make
index 98785d69d4..c620af2f7d 100644
--- a/ydb/library/yql/tests/common/test_framework/udfs_deps/ya.make
+++ b/ydb/library/yql/tests/common/test_framework/udfs_deps/ya.make
@@ -4,6 +4,7 @@ SET(
ydb/library/yql/udfs/common/digest
ydb/library/yql/udfs/common/hyperloglog
ydb/library/yql/udfs/common/pire
+ ydb/library/yql/udfs/common/protobuf
ydb/library/yql/udfs/common/re2
ydb/library/yql/udfs/common/set
ydb/library/yql/udfs/common/stat
diff --git a/ydb/library/yql/tests/s-expressions/common_file.py b/ydb/library/yql/tests/s-expressions/common_file.py
index 88821c3ea4..7b47b2601b 100644
--- a/ydb/library/yql/tests/s-expressions/common_file.py
+++ b/ydb/library/yql/tests/s-expressions/common_file.py
@@ -22,8 +22,6 @@ def get_block_gateways_config():
def yqlrun_yt_results(provider, prepare, suite, case, config):
if (suite, case) not in yqlrun_yt_results.cache:
- if 'Proto' in case:
- pytest.skip('Protobuf')
if 'ViewWithUdfProcess' in case:
pytest.skip('ScriptUdf')
diff --git a/ydb/library/yql/tests/s-expressions/file.make b/ydb/library/yql/tests/s-expressions/file.make
index d6ca78e54f..c1d9c91d43 100644
--- a/ydb/library/yql/tests/s-expressions/file.make
+++ b/ydb/library/yql/tests/s-expressions/file.make
@@ -40,6 +40,10 @@ PEERDIR(
TAG(ya:dump_test_env)
+IF (SANITIZER_TYPE == "memory")
+ TAG(ya:not_autocheck) # YQL-15385
+ENDIF()
+
NO_CHECK_IMPORTS()
REQUIREMENTS(cpu:4 ram:13)
diff --git a/ydb/library/yql/udfs/common/CMakeLists.darwin-x86_64.txt b/ydb/library/yql/udfs/common/CMakeLists.darwin-x86_64.txt
index 10ac5bd4b5..93b5b23ce8 100644
--- a/ydb/library/yql/udfs/common/CMakeLists.darwin-x86_64.txt
+++ b/ydb/library/yql/udfs/common/CMakeLists.darwin-x86_64.txt
@@ -18,6 +18,7 @@ add_subdirectory(json)
add_subdirectory(json2)
add_subdirectory(math)
add_subdirectory(pire)
+add_subdirectory(protobuf)
add_subdirectory(re2)
add_subdirectory(set)
add_subdirectory(stat)
diff --git a/ydb/library/yql/udfs/common/CMakeLists.linux-aarch64.txt b/ydb/library/yql/udfs/common/CMakeLists.linux-aarch64.txt
index 1fc73e5a2d..0afb0ce04b 100644
--- a/ydb/library/yql/udfs/common/CMakeLists.linux-aarch64.txt
+++ b/ydb/library/yql/udfs/common/CMakeLists.linux-aarch64.txt
@@ -17,6 +17,7 @@ add_subdirectory(json)
add_subdirectory(json2)
add_subdirectory(math)
add_subdirectory(pire)
+add_subdirectory(protobuf)
add_subdirectory(re2)
add_subdirectory(set)
add_subdirectory(stat)
diff --git a/ydb/library/yql/udfs/common/CMakeLists.linux-x86_64.txt b/ydb/library/yql/udfs/common/CMakeLists.linux-x86_64.txt
index 10ac5bd4b5..93b5b23ce8 100644
--- a/ydb/library/yql/udfs/common/CMakeLists.linux-x86_64.txt
+++ b/ydb/library/yql/udfs/common/CMakeLists.linux-x86_64.txt
@@ -18,6 +18,7 @@ add_subdirectory(json)
add_subdirectory(json2)
add_subdirectory(math)
add_subdirectory(pire)
+add_subdirectory(protobuf)
add_subdirectory(re2)
add_subdirectory(set)
add_subdirectory(stat)
diff --git a/ydb/library/yql/udfs/common/CMakeLists.windows-x86_64.txt b/ydb/library/yql/udfs/common/CMakeLists.windows-x86_64.txt
index 10ac5bd4b5..93b5b23ce8 100644
--- a/ydb/library/yql/udfs/common/CMakeLists.windows-x86_64.txt
+++ b/ydb/library/yql/udfs/common/CMakeLists.windows-x86_64.txt
@@ -18,6 +18,7 @@ add_subdirectory(json)
add_subdirectory(json2)
add_subdirectory(math)
add_subdirectory(pire)
+add_subdirectory(protobuf)
add_subdirectory(re2)
add_subdirectory(set)
add_subdirectory(stat)
diff --git a/ydb/library/yql/udfs/common/protobuf/CMakeLists.darwin-x86_64.txt b/ydb/library/yql/udfs/common/protobuf/CMakeLists.darwin-x86_64.txt
new file mode 100644
index 0000000000..1dec5ce33c
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/CMakeLists.darwin-x86_64.txt
@@ -0,0 +1,71 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_shared_library(protobuf_udf.dyn)
+set_property(TARGET protobuf_udf.dyn PROPERTY
+ OUTPUT_NAME protobuf_udf
+)
+target_compile_options(protobuf_udf.dyn PRIVATE
+ -DBUILD_UDF
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(protobuf_udf.dyn PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+target_link_options(protobuf_udf.dyn PRIVATE
+ -Wl,-platform_version,macos,11.0,11.0
+ -fPIC
+ -undefined
+ dynamic_lookup
+ -fPIC
+ -framework
+ CoreFoundation
+)
+target_sources(protobuf_udf.dyn PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
+)
+use_export_script(protobuf_udf.dyn
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/public/udf/udfs_exports.exports
+)
+vcs_info(protobuf_udf.dyn)
+
+add_library(protobuf_udf INTERFACE)
+target_link_libraries(protobuf_udf INTERFACE
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+
+add_global_library_for(protobuf_udf.global protobuf_udf)
+target_compile_options(protobuf_udf.global PRIVATE
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(protobuf_udf.global PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+target_sources(protobuf_udf.global PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
+)
diff --git a/ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-aarch64.txt b/ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-aarch64.txt
new file mode 100644
index 0000000000..57d2994a98
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-aarch64.txt
@@ -0,0 +1,77 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_shared_library(protobuf_udf.dyn)
+set_property(TARGET protobuf_udf.dyn PROPERTY
+ OUTPUT_NAME protobuf_udf
+)
+target_compile_options(protobuf_udf.dyn PRIVATE
+ -DBUILD_UDF
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(protobuf_udf.dyn PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+target_link_options(protobuf_udf.dyn PRIVATE
+ -ldl
+ -lrt
+ -Wl,--no-as-needed
+ -fPIC
+ -Wl,-z,notext
+ -Wl,-Bsymbolic
+ -fPIC
+ -lpthread
+ -lrt
+ -ldl
+)
+target_sources(protobuf_udf.dyn PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
+)
+use_export_script(protobuf_udf.dyn
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/public/udf/udfs_exports.exports
+)
+vcs_info(protobuf_udf.dyn)
+
+add_library(protobuf_udf INTERFACE)
+target_link_libraries(protobuf_udf INTERFACE
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+
+add_global_library_for(protobuf_udf.global protobuf_udf)
+target_compile_options(protobuf_udf.global PRIVATE
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(protobuf_udf.global PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+target_sources(protobuf_udf.global PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
+)
diff --git a/ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-x86_64.txt b/ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-x86_64.txt
new file mode 100644
index 0000000000..57d2994a98
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/CMakeLists.linux-x86_64.txt
@@ -0,0 +1,77 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_shared_library(protobuf_udf.dyn)
+set_property(TARGET protobuf_udf.dyn PROPERTY
+ OUTPUT_NAME protobuf_udf
+)
+target_compile_options(protobuf_udf.dyn PRIVATE
+ -DBUILD_UDF
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(protobuf_udf.dyn PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+target_link_options(protobuf_udf.dyn PRIVATE
+ -ldl
+ -lrt
+ -Wl,--no-as-needed
+ -fPIC
+ -Wl,-z,notext
+ -Wl,-Bsymbolic
+ -fPIC
+ -lpthread
+ -lrt
+ -ldl
+)
+target_sources(protobuf_udf.dyn PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
+)
+use_export_script(protobuf_udf.dyn
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/public/udf/udfs_exports.exports
+)
+vcs_info(protobuf_udf.dyn)
+
+add_library(protobuf_udf INTERFACE)
+target_link_libraries(protobuf_udf INTERFACE
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+
+add_global_library_for(protobuf_udf.global protobuf_udf)
+target_compile_options(protobuf_udf.global PRIVATE
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(protobuf_udf.global PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+target_sources(protobuf_udf.global PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
+)
diff --git a/ydb/library/yql/udfs/common/protobuf/CMakeLists.txt b/ydb/library/yql/udfs/common/protobuf/CMakeLists.txt
new file mode 100644
index 0000000000..f8b31df0c1
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/CMakeLists.txt
@@ -0,0 +1,17 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-aarch64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ include(CMakeLists.darwin-x86_64.txt)
+elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA)
+ include(CMakeLists.windows-x86_64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-x86_64.txt)
+endif()
diff --git a/ydb/library/yql/udfs/common/protobuf/CMakeLists.windows-x86_64.txt b/ydb/library/yql/udfs/common/protobuf/CMakeLists.windows-x86_64.txt
new file mode 100644
index 0000000000..0287e506d4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/CMakeLists.windows-x86_64.txt
@@ -0,0 +1,62 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_shared_library(protobuf_udf.dyn)
+set_property(TARGET protobuf_udf.dyn PROPERTY
+ OUTPUT_NAME protobuf_udf
+)
+target_compile_options(protobuf_udf.dyn PRIVATE
+ -DBUILD_UDF
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(protobuf_udf.dyn PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+target_sources(protobuf_udf.dyn PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
+)
+use_export_script(protobuf_udf.dyn
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/public/udf/udfs_exports.exports
+)
+vcs_info(protobuf_udf.dyn)
+
+add_library(protobuf_udf INTERFACE)
+target_link_libraries(protobuf_udf INTERFACE
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+
+add_global_library_for(protobuf_udf.global protobuf_udf)
+target_compile_options(protobuf_udf.global PRIVATE
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(protobuf_udf.global PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ yql-public-udf
+ public-udf-support
+ cpp-protobuf-yql
+ yql-library-protobuf_udf
+)
+target_sources(protobuf_udf.global PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
+)
diff --git a/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp b/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
new file mode 100644
index 0000000000..01d0ca54f3
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/protobuf_udf.cpp
@@ -0,0 +1,143 @@
+#include <yql/library/protobuf_udf/type_builder.h>
+#include <yql/library/protobuf_udf/value_builder.h>
+#include <ydb/library/yql/public/udf/udf_value.h>
+#include <ydb/library/yql/public/udf/udf_registrator.h>
+
+#include <library/cpp/protobuf/yql/descriptor.h>
+
+using namespace NKikimr::NUdf;
+using namespace NProtoBuf;
+
+namespace {
+ class TDynamicProtoValue: public TProtobufValue {
+ public:
+ TDynamicProtoValue(const TProtoInfo& info, TDynamicInfoRef dyn)
+ : TProtobufValue(info)
+ , Dynamic_(dyn)
+ {
+ Y_ASSERT(Dynamic_ != nullptr);
+ }
+
+ TAutoPtr<Message> Parse(const TStringBuf& data) const override {
+ return Dynamic_->Parse(data);
+ }
+
+ private:
+ TDynamicInfoRef Dynamic_;
+ };
+
+ class TDynamicProtoSerialize: public TProtobufSerialize {
+ public:
+ TDynamicProtoSerialize(const TProtoInfo& info, TDynamicInfoRef dyn)
+ : TProtobufSerialize(info)
+ , Dynamic_(dyn)
+ {
+ Y_ASSERT(Dynamic_ != nullptr);
+ }
+
+ TMaybe<TString> Serialize(const Message& proto) const override {
+ return Dynamic_->Serialize(proto);
+ }
+
+ TAutoPtr<Message> MakeProto() const override {
+ return Dynamic_->MakeProto();
+ }
+ private:
+ TDynamicInfoRef Dynamic_;
+ };
+
+ class TDynamicProtoValueSafe: public TDynamicProtoValue {
+ public:
+ TDynamicProtoValueSafe(const TProtoInfo& info, TDynamicInfoRef dyn)
+ : TDynamicProtoValue(info, dyn) {}
+
+ TAutoPtr<Message> Parse(const TStringBuf& data) const override {
+ try {
+ return TDynamicProtoValue::Parse(data);
+ } catch (const std::exception& e) {
+ return nullptr;
+ }
+ }
+ };
+
+ class TProtobufModule: public IUdfModule {
+ public:
+ TStringRef Name() const {
+ return TStringRef("Protobuf");
+ }
+
+ void CleanupOnTerminate() const final {
+ }
+
+ void GetAllFunctions(IFunctionsSink& sink) const final {
+ sink.Add(TStringRef::Of("Parse"))->SetTypeAwareness();
+ sink.Add(TStringRef::Of("TryParse"))->SetTypeAwareness();
+ sink.Add(TStringRef::Of("Serialize"))->SetTypeAwareness();
+ }
+
+ void BuildFunctionTypeInfo(
+ const TStringRef& name,
+ TType* userType,
+ const TStringRef& typeConfig,
+ ui32 flags,
+ IFunctionTypeInfoBuilder& builder) const final {
+ Y_UNUSED(userType);
+
+ try {
+ auto dyn = TDynamicInfo::Create(TStringBuf(typeConfig.Data(), typeConfig.Size()));
+
+ TProtoInfo typeInfo;
+ ProtoTypeBuild(dyn->Descriptor(),
+ dyn->GetEnumFormat(),
+ dyn->GetRecursionTraits(),
+ dyn->GetOptionalLists(),
+ builder, &typeInfo,
+ EProtoStringYqlType::Bytes,
+ dyn->GetSyntaxAware(),
+ false,
+ dyn->GetYtMode());
+
+ auto stringType = builder.SimpleType<char*>();
+ auto structType = typeInfo.StructType;
+ auto optionalStructType = builder.Optional()->Item(structType).Build();
+
+ if (TStringRef::Of("Serialize") == name) {
+ // function signature:
+ // String Serialize(Protobuf value)
+ builder.Returns(stringType)
+ .Args()
+ ->Add(structType)
+ .Flags(ICallablePayload::TArgumentFlags::AutoMap)
+ .Done();
+ if ((flags & TFlags::TypesOnly) == 0) {
+ builder.Implementation(new TDynamicProtoSerialize(typeInfo, dyn));
+ }
+ } else {
+ // function signature:
+ // Protobuf Parse(String value)
+ builder.Returns((TStringRef::Of("TryParse") == name) ? optionalStructType : structType)
+ .Args()
+ ->Add(stringType)
+ .Flags(ICallablePayload::TArgumentFlags::AutoMap)
+ .Done();
+
+ if (TStringRef::Of("Parse") == name) {
+ if ((flags & TFlags::TypesOnly) == 0) {
+ builder.Implementation(new TDynamicProtoValue(typeInfo, dyn));
+ }
+ } else if (TStringRef::Of("TryParse") == name) {
+ if ((flags & TFlags::TypesOnly) == 0) {
+ builder.Implementation(new TDynamicProtoValueSafe(typeInfo, dyn));
+ }
+ }
+ }
+
+ } catch (const std::exception& e) {
+ builder.SetError(CurrentExceptionMessage());
+ }
+ }
+ };
+
+}
+
+REGISTER_MODULES(TProtobufModule);
diff --git a/ydb/library/yql/udfs/common/protobuf/test/canondata/result.json b/ydb/library/yql/udfs/common/protobuf/test/canondata/result.json
new file mode 100644
index 0000000000..ac534cee58
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/canondata/result.json
@@ -0,0 +1,126 @@
+{
+ "test.test[CRYPTR-627]": [
+ {
+ "checksum": "fce4dcff82967863048135d17d52f31f",
+ "size": 90043,
+ "uri": "https://storage.yandex-team.ru/get-devtools/212715/870509fa5b3fad596ac1effbd15336199d7c4166/resource.tar.gz#test.test_CRYPTR-627_/results.txt"
+ }
+ ],
+ "test.test[YQL-16111]": [
+ {
+ "checksum": "35d6f2291f27eb3ec28a96739412f276",
+ "size": 5675,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1781765/c2a453956382e0fdfc958f3c4e32ed7740f03d4b/resource.tar.gz#test.test_YQL-16111_/results.txt"
+ }
+ ],
+ "test.test[YQL-3381]": [
+ {
+ "checksum": "c098af301d5dc8d85071a47455f0f592",
+ "size": 97359,
+ "uri": "https://storage.yandex-team.ru/get-devtools/212715/6d6e638efd56a0c6037196ae663d58f279ee467a/resource.tar.gz#test.test_YQL-3381_/results.txt"
+ }
+ ],
+ "test.test[YQL-6706]": [
+ {
+ "checksum": "17fbe1395ae7573288532aa42c5525c4",
+ "size": 87479,
+ "uri": "https://storage.yandex-team.ru/get-devtools/212715/b614019f8638cf007ad9da4a361791da4a66b156/resource.tar.gz#test.test_YQL-6706_/results.txt"
+ }
+ ],
+ "test.test[YQL-8307]": [
+ {
+ "checksum": "e3045a4ed9fe70bc12c8fd0de7bff29c",
+ "size": 3840,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1923547/edc65c62e064cae64c748b355e12a480cac0c768/resource.tar.gz#test.test_YQL-8307_/results.txt"
+ }
+ ],
+ "test.test[recursion_bytes]": [
+ {
+ "checksum": "eeb1ca24bdc09529bd0a320965b3123d",
+ "size": 1241,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1937492/9579ab43fa70f08e465aa7673b27a5da5460a75e/resource.tar.gz#test.test_recursion_bytes_/results.txt"
+ }
+ ],
+ "test.test[recursion_fail]": [
+ {
+ "uri": "file://test.test_recursion_fail_/extracted"
+ }
+ ],
+ "test.test[recursion_ignore]": [
+ {
+ "checksum": "eeb1ca24bdc09529bd0a320965b3123d",
+ "size": 1241,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1937492/9579ab43fa70f08e465aa7673b27a5da5460a75e/resource.tar.gz#test.test_recursion_ignore_/results.txt"
+ }
+ ],
+ "test.test[syntax_aware_empty_nested_message]": [
+ {
+ "checksum": "2f7d8896e8d637d9698c94f99b5e586f",
+ "size": 4344,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1899731/4317be1fdb14f46c8bb94f5975cce5af8f89f78e/resource.tar.gz#test.test_syntax_aware_empty_nested_message_/results.txt"
+ }
+ ],
+ "test.test[syntax_aware_nested_enum_string_value]": [
+ {
+ "checksum": "630a0e1ef04aada546e39ad71771c4d9",
+ "size": 4152,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1899731/4317be1fdb14f46c8bb94f5975cce5af8f89f78e/resource.tar.gz#test.test_syntax_aware_nested_enum_string_value_/results.txt"
+ }
+ ],
+ "test.test[yt_mode_any]": [
+ {
+ "checksum": "c640b3b07686099261511c45d21388f7",
+ "size": 3808,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1946324/c1d8ae91dcc463381c8fa29e568a09926e9a2225/resource.tar.gz#test.test_yt_mode_any_/results.txt"
+ }
+ ],
+ "test.test[yt_mode_enum]": [
+ {
+ "checksum": "2c32becbf155f2dce66d7c00db46a2a4",
+ "size": 2965,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1781765/c2a453956382e0fdfc958f3c4e32ed7740f03d4b/resource.tar.gz#test.test_yt_mode_enum_/results.txt"
+ }
+ ],
+ "test.test[yt_mode_map]": [
+ {
+ "checksum": "67b8ad859a21d7f0c8203daa08194cf3",
+ "size": 21224,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1936947/d770c9a45c5df4db61873fc48e1cb5961f774af6/resource.tar.gz#test.test_yt_mode_map_/results.txt"
+ }
+ ],
+ "test.test[yt_mode_no_ser]": [
+ {
+ "checksum": "eeb1ca24bdc09529bd0a320965b3123d",
+ "size": 1241,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1937492/9579ab43fa70f08e465aa7673b27a5da5460a75e/resource.tar.gz#test.test_yt_mode_no_ser_/results.txt"
+ }
+ ],
+ "test.test[yt_mode_plain]": [
+ {
+ "checksum": "7321635f17c1f8fdb75d96bb2a3ce4d1",
+ "size": 1796,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1937492/9579ab43fa70f08e465aa7673b27a5da5460a75e/resource.tar.gz#test.test_yt_mode_plain_/results.txt"
+ }
+ ],
+ "test.test[yt_mode_ser_pb]": [
+ {
+ "checksum": "eeb1ca24bdc09529bd0a320965b3123d",
+ "size": 1241,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1937492/9579ab43fa70f08e465aa7673b27a5da5460a75e/resource.tar.gz#test.test_yt_mode_ser_pb_/results.txt"
+ }
+ ],
+ "test.test[yt_mode_ser_yt]": [
+ {
+ "checksum": "eeb1ca24bdc09529bd0a320965b3123d",
+ "size": 1241,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1937492/9579ab43fa70f08e465aa7673b27a5da5460a75e/resource.tar.gz#test.test_yt_mode_ser_yt_/results.txt"
+ }
+ ],
+ "test.test[yt_mode_variant]": [
+ {
+ "checksum": "de1dd8aeb5c695707a114866a6124ed8",
+ "size": 12323,
+ "uri": "https://storage.yandex-team.ru/get-devtools/1937492/9579ab43fa70f08e465aa7673b27a5da5460a75e/resource.tar.gz#test.test_yt_mode_variant_/results.txt"
+ }
+ ]
+}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/canondata/test.test_recursion_fail_/extracted b/ydb/library/yql/udfs/common/protobuf/test/canondata/test.test_recursion_fail_/extracted
new file mode 100644
index 0000000000..0b4b0d3a37
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/canondata/test.test_recursion_fail_/extracted
@@ -0,0 +1,11 @@
+<tmp_path>/program.sql:<main>: Error: Type annotation
+
+ <tmp_path>/program.sql:<main>:64:1: Error: At function: RemovePrefixMembers, At function: Unordered, At function: PersistableRepr, At function: OrderedSqlProject, At function: SqlProjectItem
+ SELECT $udf(TestField) FROM plato.Input;
+ ^
+ <tmp_path>/program.sql:<main>:64:8: Error: At function: NamedApply, At function: Udf, At Protobuf.Parse
+ SELECT $udf(TestField) FROM plato.Input;
+ ^
+ <tmp_path>/program.sql:<main>:64:8: Error: Failed to find UDF function: Protobuf.Parse, reason: Error: Module: Protobuf, function: Parse, error: (yexception) yql/library/protobuf_udf/type_builder.cpp:xxx: can't handle recursive types: Test
+ SELECT $udf(TestField) FROM plato.Input;
+ ^ \ No newline at end of file
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.in b/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.in
new file mode 100644
index 0000000000..4aef303a9c
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.in
@@ -0,0 +1,3 @@
+{"ProfileDump"="\n\x0F\x08\x8B\3\x15\xC6\x16[Z\x1A\5\x98\xA7\xA5\xD4\nj-\x08\xDC\xC6\xF5\x92\xDE\xAC\xD2\xFF\xD5\1\x10\x98\xA7\xA5\xD4\n\x1D\xC6\x16[Z%\xC6\x16[Z-\xC6\x16[Z1\0\0\0\0\0\0\xF0?@\2H\2";};
+{"ProfileDump"="\n\x0F\x08\xEB\1\x15\xED\xE8^Z\x1A\5\x98BAD_ROW_PROTO";};
+{"ProfileDump"="\n\x0F\x08\x8B\3\x15\3222\x94Z\x1A\5\xB6\xF2\xDB\xA5\2\n\x11\x08\x94\3\x15\3222\x94ZB\7Swift 2\n\x12\x08\x93\3\x15\3222\x94ZB\x08Wileyfox\n\x0B\x08\x94\4\x15\3222\x94Z\x1A\1\2j,\x08\x84\xCD\xAF\xF9\x9B\xC0\xF8\xFEv\x10\xB6\xF2\xDB\xA5\2\x1D\3222\x94Z%\3222\x94Z-\3222\x94Z1\0\0\0\0\0\0\x10@@\2H\2";}; \ No newline at end of file
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.in.attr
new file mode 100644
index 0000000000..6f11c91408
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.in.attr
@@ -0,0 +1 @@
+{schema=[{name=ProfileDump;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.sql
new file mode 100644
index 0000000000..d4f8a432d4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/CRYPTR-627.sql
@@ -0,0 +1,11 @@
+/* syntax version 1 */
+/*
+ Should check is TryParse work correct for bad protobuf input data
+*/
+
+$config = @@{"name":"yabs.proto.Profile","meta":"eNqNVt1y21QQRrJs2Ws7ceS0UVwKoQyDgWla0h+GXHTGScw0M00T0hQuNYp0bGuiP86RkvoxeAMegeE5uOcF+ga8AHtWUiynypQr+6y+/Tm73+4eeG/C/bl9Lh7FPEqiR6lg3MK/E89n2yQyQH7O/j/4ywT9JPtqbEPdS1ggTGWrNmzvfL69wG3nmOL3EHHGC1hz7IRNIz4vPAhTJd0vq3T3c/DCXyu2hYgjngizRnr3qvRepufk7yE0nSgNE8aFqd0O388wxmNoRJOJBNcJvFUFPpaIIqBvQJul58JsfDyWb0H/LWXcwxvrhN6sQv+MkLnxHejndhjKSJqEHVRh9whifAWaG8TCbBFyowp5EMTGDrT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YBB//3Zo+Us9OOuVY6PTGN0ump2S+dnpnrpdNz806RrSC0bNc17+J5jYptczn5sSIbdKdNWEtsPmWJ5UayxjTDTfq0AatTJL7l+KnI6b1ZVFFg0h1KjjmQssEZ1OS7BT3i86YoeMXclFddh+b1E0O2QZf6oyCZVmrWGLrLDxWkFFbFS1KXUX/I/mz5UTjNRCqJKmcJ4vB1JDcSBqfl5Mk81ksej6Ff9bTpgebbtPCLdkYJVv2y1ODr0JL+RGIHceZ0V3k8+BOXaPm1I6PDHMu5PbPFbNEYDnee7GQytWpd1vLcdbwQXfh+eSYi12R4lty5lzm+Tl8+g7u5MIhCpPmEM+zA0JlTAylVI3JPPVH+AxssP0w=", "lists": {"optional": false}}@@;
+
+$udf = Udf(Protobuf::TryParse, $config as TypeConfig);
+
+SELECT $udf(ProfileDump) AS Profile
+FROM Input;
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-16111.in b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-16111.in
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-16111.in
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-16111.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-16111.sql
new file mode 100644
index 0000000000..6c35fc403c
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-16111.sql
@@ -0,0 +1,64 @@
+/*
+syntax='proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+
+ message InnerSubProto {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+ int64 x = 1;
+ string y = 2;
+
+ message TSubField {
+ repeated string List = 1;
+ }
+
+ TSubField SubField = 3 [(NYT.flags) = SERIALIZATION_PROTOBUF];
+ }
+
+ map<string, InnerSubProto> dict = 10 [(NYT.flags) = MAP_AS_DICT];
+}
+*/
+
+$config = @@{
+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sQugRO95F5NAj+jVxaoHQRHwbEohjPXLeHS5x4wETuZYLYq5isqe0fRmSXiN9b6hols0qkaTMfuejv/rsYnS7AkkvXFph4ORx7uLpT+yf91hGY9hcEIPzLJYP3wxxm8dx/gD7f1qjBpI=",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}
+@@;
+
+$udfParse = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSerialize = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+$data = @@
+{
+ "dict": [
+ {
+ "key": "key2",
+ "value": {
+ "x": 23,
+ "y": "yy",
+ "SubField": {"List": ["s1"]}
+ }
+ }
+ ]
+}
+@@;
+
+SELECT
+ $data,
+ $udfParse($data),
+ $udfSerialize($udfParse($data)),
+ Ensure("Success", StablePickle($udfParse($data)) == StablePickle($udfParse($udfSerialize($udfParse($data)))), "Fail")
+;
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.in b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.in
new file mode 100644
index 0000000000..f70c4566f9
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.in
@@ -0,0 +1,3 @@
+{"ProfileDump"="\n\x0F\x08\x8B\3\x15\xC6\x16[Z\x1A\5\x98\xA7\xA5\xD4\nj-\x08\xDC\xC6\xF5\x92\xDE\xAC\xD2\xFF\xD5\1\x10\x98\xA7\xA5\xD4\n\x1D\xC6\x16[Z%\xC6\x16[Z-\xC6\x16[Z1\0\0\0\0\0\0\xF0?@\2H\2";};
+{"ProfileDump"="\n\x0F\x08\xEB\1\x15\xED\xE8^Z\x1A\5\x99\xE5\xEB\x82\x0F\nH\x08\xDD\2\x15\xE0\xC3\xAAZ\"\7\x08\x99\1\x10\xE0\xC5\x08\"\7\x08\xA2P\x10\xE0\xC5\x08\"\7\x08\x9B\1\x10\xE0\xC5\x08\"\7\x08\x9A\1\x10\xE0\xC5\x08\"\7\x08\x9D\1\x10\xE0\xC5\x08\"\7\x08\x9E\1\x10\xE0\xC5\x08\"\x08\x08\xEE\x9C\7\x10\xE0\xC5\x08\n\x0F\x08\xEB\1\x15\x0BN_Z\x1A\5\xB7\xD8\xE6\xFF\x0E\n\x0B\x08\xA6\2\025fG_Z\x1A\1\7\n\x0F\x08\xEB\1\x15= _Z\x1A\5\xE8\xFD\xBE\xFF\x0E\n\x0B\x08\xA5\3\x15\xE0\xC3\xAAZ\x1A\1F\n\x0F\x08\xEB\1\025b#\xA7Z\x1A\5\xEA\xA5\x8F\xBB\7J\x0C\x08\4\x15\x8E\x83\xA8Z\x1A\3\xD9\xA1\x17";};
+{"ProfileDump"="\n\x0F\x08\x8B\3\x15\3222\x94Z\x1A\5\xB6\xF2\xDB\xA5\2\n\x11\x08\x94\3\x15\3222\x94ZB\7Swift 2\n\x12\x08\x93\3\x15\3222\x94ZB\x08Wileyfox\n\x0B\x08\x94\4\x15\3222\x94Z\x1A\1\2j,\x08\x84\xCD\xAF\xF9\x9B\xC0\xF8\xFEv\x10\xB6\xF2\xDB\xA5\2\x1D\3222\x94Z%\3222\x94Z-\3222\x94Z1\0\0\0\0\0\0\x10@@\2H\2";}; \ No newline at end of file
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.in.attr
new file mode 100644
index 0000000000..6f11c91408
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.in.attr
@@ -0,0 +1 @@
+{schema=[{name=ProfileDump;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.sql
new file mode 100644
index 0000000000..d8ee0b931f
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-3381.sql
@@ -0,0 +1,7 @@
+/* syntax version 1 */
+$config = @@{"name":"yabs.proto.Profile","meta":"eNqNVt1y21QQRrJs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CLDfIhnbvGKtTQOq25rJZrUM+uKcurSNHgCFqLqVtlpA96PrpLhjZu3rA21Mnc3wo08u2wBq1slSz6q5J5/eWmqVESMKOMLq/RUQ4T2ZOpn3g4axmnXKnYHBq3wwtKkSo9xjNuCyY96pQ1nDZy99H8aS7lsVRbvE7TE5YIbJ7gepLy+sT2BRv8W4N6thjLhpTcEGSShL3LKt+S8cyKGdEtjy7lxujKz2IeOsyl8GmUzaKUCyuwxUUe/3UemsXUKeeqRXr3oO9EvpRG+Hyyk1lGGyANzFyCKRK+zDrJ2yRHlsWcuZ4jO8dJOO3H7g1x7ODek2ITemnovVsazytVtF4lIaYBB//3Zo+Us9OOuVY6PTGN0ump2S+dnpnrpdNz806RrSC0bNc17+J5jYptczn5sSIbdKdNWEtsPmWJ5UayxjTDTfq0AatTJL7l+KnI6b1ZVFFg0h1KjjmQssEZ1OS7BT3i86YoeMXclFddh+b1E0O2QZf6oyCZVmrWGLrLDxWkFFbFS1KXUX/I/mz5UTjNRCqJKmcJ4vB1JDcSBqfl5Mk81ksej6Ff9bTpgebbtPCLdkYJVv2y1ODr0JL+RGIHceZ0V3k8+BOXaPm1I6PDHMu5PbPFbNEYDnee7GQytWpd1vLcdbwQXfh+eSYi12R4lty5lzm+Tl8+g7u5MIhCpPmEM+zA0JlTAylVI3JPPVH+AxssP0w=", "lists": {"optional": false}}@@;
+
+$udf = Udf(Protobuf::Parse, $config as TypeConfig);
+
+SELECT $udf(ProfileDump) AS Profile
+FROM Input;
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.in b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.in
new file mode 100644
index 0000000000..17ca40800d
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.in
@@ -0,0 +1,2 @@
+{"doc"="\n\x0Fhttp://agbz.ru/\x10\2\x18\x84\xFB\x89\xC6\5\"\4fake";};
+{"doc"="\nSO REALLY BAD BAD BAD PROTO ROW\n\xBF\2";};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.in.attr
new file mode 100644
index 0000000000..8838f04a44
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.in.attr
@@ -0,0 +1 @@
+{schema=[{name=doc;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.sql
new file mode 100644
index 0000000000..1989d5b03f
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-6706.sql
@@ -0,0 +1,17 @@
+/* syntax version 1 */
+/*
+ Should check is TryParse work correct for proto with required fields
+ Can't parse message of type "NNewsStorageProtocol.TRawNewsDoc" because it is missing required fields: Url, Status, FetchTime, FetchHost
+*/
+
+$config = @@{
+ "skip": 0,
+ "meta": "eNqtWFlzG0UQRrc0vpRxjiUER9kcOCbIwVBFkgoB31ZhOWYtAlRRRa20Y3nJale1Rxy9kkfyL/gjVPHIC3+BKn4I3T07q5Us2Q/hTX1P93zT3Sv2Ns+WBqeiveqK02C173uht+pFoWO7L4M6kVw7OABZwz32jkLPN7viENkdz9EdVm49j8J9UOZVlvvOd7RMLbtcMfAnv8qKR17kd4SWJWZM8eusfCTcULggydUyy3NGQktZtwdkoBVqObBKaP2fLKuocAFqbppOp2X3BAUFL4rmNTZzFHU6IghInKUgaRZq7Ji2I6yWb4sgPkaaxR+xAgXS8nCMmTW9Pq0KdXUmQxqg7y0RdHy7H9qeC2lkII00i3/OrqTITc89ti0qRxF0s8ZkIV9iLKVaItUUh99j8zuR46R0yqQzxsXK7fheb0cIS6uARtlIaPbHLXZ3HA6BzJdYP1vtGBWXqR5jtbh+AZb0b9lCqyks22ydRL22C/WeDJw9YXdPwvjmYopfZoXvbSs8ia9LEvoBm5UuDx1zIPx39vdvhs1Jh1AzQGU4wSOUsAkwag36El0AU0WnouUmR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to8ySh35RcFJ54vrYQJ0cUgmVXuL7QqhIsRODTaZr9vrBirwOE2SWC2VkB19msZO4KDxU5KY7wcImXdBM+KiA12VXg+IukPFnI64yPCPBdB9plMpkgoUaDL1r4L2DCIy5vxo1mhIsnxnuAavqiAx9PNarUCA99IfyO7J7tmND0B9od+YEwyuXLsKTj20kp3iXFcfbYh0xKf+XMh0zKakWeo2kHPROTCLR7mP9GtpoxxiRwbzJoSvmjRHlcBKtIOmTK5n5iM1kBc6aKyova9CyhfUyFHmfzr1hZfYRqnxDEb1/8bRgYiRFAoIp92Lc70G0bQRDB+VaT852RQVKleChrDyne0rQxKrUMpY6gaEV+24vXXO1TehEjPHx64OEXAAgC/TP59IYc/RmrtuL5ue915AcGTOJvxIAm8ayBP7E3KXziKM4bitR/zcJtxw622nSsDWhysSvyMbN2b0pGY4GNxI6GhRMFJ8KigNAMYxKb25HddeG+/GSsJ4zUypB/15WhML4ypAZnkWSKXPkBNrR40cbd0BAOcC3gwJY2y8q09yKVQeoFfKd7SGWRWo8sm6gcdMH5lm+6gUMlQF5+5QvGhos1n4PW7XYcL4BUpWscofikpOu9sEcTqJpdabD50STR+MDzezDqvA4YL7KFpulGMF8GW8IRcF7wAcyY2BjIwQ2ufoNPydT2go6S/QUcwb6JcfeiNjgAGRTFsTsoo130CLbPntmH/GDfo7uIGXncuKkYilPgZZZfD71etcivscVdDzYWF/8cGoYr/QdunI1N",
+ "name": "TRawNewsDoc",
+ "format": "protobin"
+}@@;
+
+$udf = Udf(Protobuf::TryParse, $config as TypeConfig);
+
+SELECT $udf(doc) AS parsed
+FROM Input;
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.in b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.in
new file mode 100644
index 0000000000..6c7f0be49c
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.in
@@ -0,0 +1,4 @@
+{"TestField"=""};
+{"TestField"="a: 1 b: 2 c: \"hello\""};
+{"TestField"="a: 1 c: \"hello\""};
+{"TestField"="d: [1, 2, 3, 4]"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.sql
new file mode 100644
index 0000000000..80604f1ad3
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/YQL-8307.sql
@@ -0,0 +1,10 @@
+/* syntax version 1 */
+
+$config = @@{"name":"Test","syntax":{"aware":true},"lists":{"optional":false},"format":"prototext","meta":"H4sIAAAAAAAAA+NK5FLOKs3L1i/TzU3MNjYu0y8oyi/Jjy9JLS7RBxF6YL6SERdLCJAnxMnFmCjBqMCowQpiJkkwAZnMIGayBDOQyQlipkiwKDBrsCaxgbUaAwBc3r8mYwAAAA=="}@@;
+
+$udf = Udf(Protobuf::Parse, $config as TypeConfig);
+$udf2 = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+SELECT $udf($udf2($udf(TestField))) AS Profile
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.in b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.in
new file mode 100644
index 0000000000..b6dd409ad4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.in
@@ -0,0 +1 @@
+{"TestField"="{\"inner\":{\"i\":{\"a\":\"hello\"}},\"test\":{\"inner\":{\"i\":{\"a\":\"bye\"}}}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.sql
new file mode 100644
index 0000000000..3ee0813dc4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_bytes.sql
@@ -0,0 +1,35 @@
+/*
+syntax='proto3';
+
+message Test {
+ message InnerInner {
+ string a = 1;
+ }
+ message Inner {
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+ Test test = 2;
+}
+*/
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrjWsjIxV2UmlxapFdQlF+Sr9TJyMUSklpcIqTIxZqZl5daJMGowKjBbcStBxLV8wQJBUFkhCS5WEqAghJMYBWsYBVBYCEpKS4usFIwIcTDxZgINocziDFRSp2LFSIsx8WYCTVeAMl4iB2MmUlsYCcZAwC/Qiqb",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number"
+ }
+}@@;
+
+$udfPar = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSer = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+SELECT TestField, Ensure("Success", $udfPar(TestField) == $udfPar($udfSer($udfPar(TestField))), "Fail")
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.cfg b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.cfg
new file mode 100644
index 0000000000..d7d756c826
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.cfg
@@ -0,0 +1,2 @@
+xfail
+in plato.Input recursion_fail.in
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.in b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.in
new file mode 100644
index 0000000000..b6dd409ad4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.in
@@ -0,0 +1 @@
+{"TestField"="{\"inner\":{\"i\":{\"a\":\"hello\"}},\"test\":{\"inner\":{\"i\":{\"a\":\"bye\"}}}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.sql
new file mode 100644
index 0000000000..e274c92e01
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_fail.sql
@@ -0,0 +1,32 @@
+/*
+syntax='proto3';
+
+message Test {
+ message InnerInner {
+ string a = 1;
+ }
+ message Inner {
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+ Test test = 2;
+}
+*/
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrjWsjIxV2UmlxapFdQlF+Sr9TJyMUSklpcIqTIxZqZl5daJMGowKjBbcStBxLV8wQJBUFkhCS5WEqAghJMYBWsYBVBYCEpKS4usFIwIcTDxZgINocziDFRSp2LFSIsx8WYCTVeAMl4iB2MmUlsYCcZAwC/Qiqb",
+ "view": {
+ "recursion": "fail",
+ "enum": "number"
+ }
+}@@;
+
+$udf = Udf(Protobuf::Parse, $config as TypeConfig);
+
+SELECT $udf(TestField) FROM plato.Input;
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.in b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.in
new file mode 100644
index 0000000000..b6dd409ad4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.in
@@ -0,0 +1 @@
+{"TestField"="{\"inner\":{\"i\":{\"a\":\"hello\"}},\"test\":{\"inner\":{\"i\":{\"a\":\"bye\"}}}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.sql
new file mode 100644
index 0000000000..2f57eb18d1
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/recursion_ignore.sql
@@ -0,0 +1,35 @@
+/*
+syntax='proto3';
+
+message Test {
+ message InnerInner {
+ string a = 1;
+ }
+ message Inner {
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+ Test test = 2;
+}
+*/
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrjWsjIxV2UmlxapFdQlF+Sr9TJyMUSklpcIqTIxZqZl5daJMGowKjBbcStBxLV8wQJBUFkhCS5WEqAghJMYBWsYBVBYCEpKS4usFIwIcTDxZgINocziDFRSp2LFSIsx8WYCTVeAMl4iB2MmUlsYCcZAwC/Qiqb",
+ "view": {
+ "recursion": "ignore",
+ "enum": "number"
+ }
+}@@;
+
+$udfPar = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSer = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+SELECT TestField, Ensure("Success", $udfPar(TestField) == $udfPar($udfSer($udfPar(TestField))), "Fail")
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.in b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.in
new file mode 100644
index 0000000000..1c32f6a142
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.in
@@ -0,0 +1,4 @@
+{"TestField"="{}"};
+{"TestField"="{\"inner\":{}}"};
+{"TestField"="{\"inner\":{\"i\":{}}"};
+{"TestField"="{\"inner\":{\"i\":{\"a\":\"\"}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.sql
new file mode 100644
index 0000000000..d24aa384d9
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_empty_nested_message.sql
@@ -0,0 +1,23 @@
+/* syntax version 1 */
+
+/*
+syntax='proto3';
+
+message Test {
+ message InnerInner {
+ string a = 1;
+ }
+ message Inner {
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+}
+*/
+
+$config = @@{"name":"Test","syntax":{"aware":true},"lists":{"optional":false},"format":"json","meta":"H4sIAAAAAAAAA+PqZuSSyyrNy9Yv081NzDY2LtMvKMovydcvSS0u0QMzlRK5WEKAPCEpLtbMvLzUIglGBUYNbiNuPZConidISEqciwvMABNCnFyMiWBVnFIqXKwQMWkuxkyoTgEknWAiiQ1skzEAZSMFuY4AAAA="}@@;
+
+$udf = Udf(Protobuf::Parse, $config as TypeConfig);
+
+SELECT $udf(TestField) AS Profile
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.in b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.in
new file mode 100644
index 0000000000..2487eb8da3
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.in
@@ -0,0 +1,4 @@
+{"TestField"="{}"};
+{"TestField"="{\"inner\": {\"l\": 25}}"};
+{"TestField"="{\"inner\": {\"l\": \"B\"}}"};
+{"TestField"="{\"inner\": {\"alphabet\": [0, 1, 25]}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.sql
new file mode 100644
index 0000000000..f869d0a3dd
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/syntax_aware_nested_enum_string_value.sql
@@ -0,0 +1,24 @@
+/* syntax version 1 */
+
+/*
+message Test {
+ enum Letters {
+ A = 0;
+ B = 1;
+ Z = 25;
+ }
+ message Inner {
+ repeated Letters alphabet = 1;
+ Letters l = 2;
+ }
+ Inner inner = 1;
+}
+*/
+
+$config = @@{"name":"Test","view":{"enum":"full_name"},"syntax":{"aware":true},"lists":{"optional":false},"format":"json","meta":"H4sIAAAAAAAAA+PayMgll1Wal61fppubmG1sXKZfUJRfkq9fklpcogdmKrUxcrGEALlCUlysmXl5qUUSjAqMGtxG3HogUT1PkJCUExcrmCEkz8WRmFOQkZiUWgJUx6zBZ8QLUeeTWlKSWlQsJMHFmCPBBDQBXUZJjosdpoiVi9FRgAFEOQkwgqgoAckkNrB7jAFNZK4ztAAAAA=="}@@;
+
+$udf = Udf(Protobuf::Parse, $config as TypeConfig);
+
+SELECT $udf(TestField) AS Profile
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_any.in b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_any.in
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_any.in
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_any.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_any.sql
new file mode 100644
index 0000000000..ccc9af6f30
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_any.sql
@@ -0,0 +1,43 @@
+/*
+syntax = 'proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ bytes Any = 1 [(NYT.flags) = ANY];
+ string x = 2;
+}
+*/
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWltvG8cVDq8iDyVquZJtRo7rhEks2YmpwLlWbtPwspLp8NYlmUQGgsWKHFFrk7vM7tI2jaIo0Kc+9rUoiqIvAfoDChR9aVCgjwUKtHlqgaIt0P6EPvbMzO5ylxeLCZAkDwr3zLnNmW/mnDNj+MNteL5vGP0B2R+Zhm2cjE/3e8TqmtrINsw8o4mbnCPvcuRqkDnUBqTsMbaILb4D0VMkZkPPR/ZSt17KzwjlgxJNSpaZRO7fUdhaMCqKENXVIdUY2kvK7LeYhbWR2n2g9kk2zMjup/gtgB4ZEb1H9O4kG0EvkrKPIr4CmdH4ZKB1FR8bIFtMFvhAecq8C5uPiPrAz5pirGlK9jGWYH1ILAsdUOzJiGSjbPbPz81+duYpR6qNQmIBkkQfD7mG2JL4ScgxqyVBxRwVaxYx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JoMYLSOKQmO3iqKlXpqFA6FhLUyGIWIUn9dMbKlVJbADEL2w7Bs8RGUmyCWH+Vy9jurIvPQZZP8P1K0z3dlQ8K1Y7UEjbECxhGOlq6I5Xed8np3APYcqPrND4svm0nvK/AbllqylKJ3t0qrYbcVg4rUrXcou5UnOAgqSrhElyFy36O4jH/5RaJodx3p0vJakNmas8xhVmoJTULMlpyNOCcUrD2QQFXA1dw48CGLN0eivsAwd8YTlGJJT71cTf7l9/Rl8v0rct5BF1+zgd+lXrhlL38M93ekDVnlb2urmT1rwuteiCet+oNWQdPYCdg1e1BV7H7uWP3SsCub3m55Us+y75B60CGGDfz9IeXJVGdmR9XdfAepLrGYDzkbz7naaaRY0cgl6HJ8eAINh+QifIFtHzuaNlAudJUkQ5bixB03pvtaiDK9OYA5LPnx8659laCj2vPBx0CG0G0nGtpRcC4/76Em/nYfeRbhhV/+7da8PgTIVdfA/Ghamqq7kZtyYoHrLi4ERxRFhW66MXr93bV/ESlr483baIO8+Z4f3GigjNITGxuYGfFZJZ7FaJtYtmY4CMFfcI6tPVi9Jd/v/yMTAl4UoceO2k99Pgkzt8j/w99CcIy",
+ "view": {
+ "recursion": "fail",
+ "enum": "number",
+ "yt_mode": true
+ }
+}
+@@;
+
+$udfParse = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSerialize = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+$data = @@
+{
+ "Any": "<x=y>{a=1;b=c}",
+ "x": "aaa"
+}
+@@;
+
+SELECT
+ $data,
+ $udfParse($data),
+ $udfSerialize($udfParse($data)),
+ Ensure("Success", StablePickle($udfParse($data)) == StablePickle($udfParse($udfSerialize($udfParse($data)))), "Fail")
+;
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_enum.in b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_enum.in
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_enum.in
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_enum.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_enum.sql
new file mode 100644
index 0000000000..f3b2935cc6
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_enum.sql
@@ -0,0 +1,50 @@
+/*
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ enum Color
+ {
+ WHITE = 0;
+ BLUE = 1;
+ RED = -1;
+ }
+
+ required Color ColorYtIntField = 1 [(NYT.flags) = ENUM_INT];
+ required Color ColorYtStringField = 2 [(NYT.flags) = ENUM_STRING];
+ required Color ColorField = 3;
+}
+*/
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWt2PG1cVx59rH+/a49lN4m4a0rptdpM23ir9ZAOl/pjdOPUXY7vpRqpGs/Zdx4k9486Mk2yEEBJPPPKGEEKIl0r8AUiIFyokHpGQoE8gIYoEfwJvcO69M+MZe5x1K7Xtw9Zzvu+5v3vPufcG/nATnhvo+mBE9iaGbunH05O9PjF7xnBi6UaB0cQMlyg4Evk6ZA+GI1JxBdvEEt+G6AkSc6HnIrupGy8W5pQKfo0WJctMI/+vKGwGcEURopo6phZDu0mZ/RZzsDZRew/UAcmFGdn5FL8J0CcTovWJ1jvNRTCKpOyhiC9DdjI9Hg17ikcMUCwmC5xRmQnvQOYRUR94RVNMNE3JHsEyrI+JaWIAinU6IbkoG/1zC6OfH3nK1uqgkliEJNGmY24htiR/EkrMW0lQNdvEmkmMh8MeycWZgZ0FA23On7fh6OFQkuSxRTRzqGu5NWbkpYBZJKP+vImZnvgmrOkTC3+ZuQTOT+rGs4FAaHIZ2REWqyCY+tToEaWn94ky1E70XJIZuLw4ECZYRrkqislp0/ctnoe4eapZ6uPcOkOI/ZX/bRwyq0DsJsRO6CgRYJ8jB1zHn8T4F0xiEVIaMS3S54iIrIgp4EqLkIp+IUh9ABk3JM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2cAZ3Ni3IEeXh+I8QPA3hhM0YopPfdzN/eV39OUyfeNiAUFXWIiBX6WeO2Ev/8y2yzIXvLLX1ZW8/jXQqwviRa8uy9x/Ats+r84ZdBW/n9p+L/n8eqaXe77g8exhmvsyxLibpz+8LMnq3Pi4qf13IdXTR9Mxf/M5yzLNHNsCuQ4tjvuHkHlATpXPYeVT28oG6pVnhjTYDELQWW+2q4Eo218AkMefFztn+lsJPo4/D3QIbPjRcqanFQHj/PsS7uZD55FvGVa8x7/VksefCLn5OogPVWOoak7Wlsy4z4uDG8FWZVmhk166endHLZyq9PXxukXUccGY7gUXKvhpGBKnFvewvWI1y38WgmiHmJZ4EzKINd04sqq2f9bFpW+kCpRfYMxS9Jd/vxiW5yWxgxZtEr8PPrD/9UegfkQOEMYdGxiVq0YWVGUPO1+AGPuit2Z3blU7Er8cKGFxYJcDEfqK9z/nv9D/AR5f/qs=",
+ "view": {
+ "recursion": "fail",
+ "enum": "number",
+ "yt_mode": true
+ }
+}
+@@;
+
+$udfParse = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSerialize = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+$data = @@
+{
+ "ColorYtIntField": 1,
+ "ColorYtStringField": "RED",
+ "ColorField": 0
+}
+@@;
+
+SELECT
+ $data,
+ $udfParse($data),
+ $udfSerialize($udfParse($data)),
+ Ensure("Success", StablePickle($udfParse($data)) == StablePickle($udfParse($udfSerialize($udfParse($data)))), "Fail")
+;
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.in b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.in
new file mode 100644
index 0000000000..db7b187bc3
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.in
@@ -0,0 +1 @@
+{"TestField"="{\"dict1\":[{\"key\":\"k1\",\"value\":{\"a\":\"1\"}}],\"dict2\":[{\"key\":\"k2\",\"value\":{\"a\":\"2\"}}],\"dict3\":[{\"key\":\"k3\",\"value\":{\"a\":\"3\"}}],\"dict4\":[{\"key\":\"k4\",\"value\":{\"a\":\"4\"}}],\"dict5\":[{\"key\":\"k5\",\"value\":\"v5\"}],\"dict6\":[{\"key\":\"k6\",\"value\":\"v6\"}],\"dict7\":[{\"key\":\"k7\",\"value\":\"v7\"}],\"dict8\":[{\"key\":\"k8\",\"value\":\"v8\"}]}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.sql
new file mode 100644
index 0000000000..b3c7377390
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_map.sql
@@ -0,0 +1,47 @@
+/*
+syntax='proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+
+ message Inner {
+ string a = 1;
+ }
+ map<string, Inner> dict1 = 1 [(NYT.flags) = MAP_AS_DICT];
+ map<string, Inner> dict2 = 2 [(NYT.flags) = MAP_AS_OPTIONAL_DICT];
+ map<string, Inner> dict3 = 3 [(NYT.flags) = MAP_AS_LIST_OF_STRUCTS_LEGACY];
+ map<string, Inner> dict4 = 4 [(NYT.flags) = MAP_AS_LIST_OF_STRUCTS];
+ map<string, string> dict5 = 5 [(NYT.flags) = MAP_AS_DICT];
+ map<string, string> dict6 = 6 [(NYT.flags) = MAP_AS_OPTIONAL_DICT];
+ map<string, string> dict7 = 7 [(NYT.flags) = MAP_AS_LIST_OF_STRUCTS_LEGACY];
+ map<string, string> dict8 = 8 [(NYT.flags) = MAP_AS_LIST_OF_STRUCTS];
+}
+*/
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWktvG9cVLp8iDyVqNJJtRo7rhHnYcWIqlV+q3KahyJFCl68OqSQyEAxGwyuKNjnDzAxty+iiQFddFVkVCIqi6CZFf0CBopsW3RcI0GZTBCjaAu1P6LLnPmY4fFm0m0cWDufc7zzuuefec869gj/dhhfaltXuko2+bbnW4eBoo0Ucw+70XcvOMZq8zBE5D5GtwMpup0uKPrBBXHkLokdIzIReiFxObb6cG2PKjXLUKVllHNl/RWF1yqgsQ9TUe1Ri6HJSZb/lDCz0deO+3iaZMCN7n/I3AVqkT8wWMY2TTAStSKoBivw6rPQHh92OoQVggLCYKvGB4hB8CZYfEv1+EJpi0DQlB4AFWOwRx0EDNPekTzJRNvsXJmY/PvOU4Goik5yHJDEHPS4hNsN/CiLGpSQomxCx4BD7QccgmTgTcGlCQIOPj8vw+HAqSfLIJabTsczMAhPyypRVJN3WuIghn3wTFqy+i7+cTALXJ7X5/NRAqHGM6oHlEkiONbANohlWi2gd88jKJJmAi5MTYcAC4koIU9POyLd8FuLOienqjzKLLELEV/Z3cVieJ8RuQ+yIzhID7Cl8wHlGnRh/RifmIWUSxyUtHhGROWMKONNkSEWfKaTeh2XfJM3WzbYXmxunWZJTPD6VsqlpMvItFwEsk1hHuL2MLsbJdC/VKGTCSxanGl3528NQW5gRKRW+ySaibR/SNqFxjy7mM0syI3KnzkwVbHxiS3bwU34JfILGwgrYKbToEatIW38M6VH3yGsQc1zddlkUxlT+IUsQwUOGnXIxlf6U3x5OOMIm/Orkio5IHp/3+i1YGpnAvKqzP4QzU0VjkKwNzI7pErtvExqxXFXm3wszYm4/iOZS1NXBJPFKMvGfBelH+F84+8c4rE3bM1O3L25/jOBDYjMnxVTxhTsi1tUPSRd3Q+hyevP1uXZlrkxZVM4pvwVRcURTCVfmk0D3ksr45POQpP/nsRFnNicogcaFvA4Jtk1axEtt/jcN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0tSE6wdHXPPR18WgUQF8fopMcfd1D3xB/ORFA35iw+4aHvin+cCSAvjlh900PfUv8rU4AfWvC7lseekv8uUUAvTVh99b6GYiVTCy/MMuFdPEoENLXFYChz2lphCeCGKU/Mfv6b3r05SPFlTBJ4tVuO7wV8sRsfjFirn0xYq7/n2K2uJgbs8SsBcUkp3DefGbOW8/MufXUnNvRX39+PnoY54/7/wMXV6Lr",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}
+@@;
+
+$udfParse = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSerialize = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+SELECT
+ TestField,
+ $udfParse(TestField),
+ $udfSerialize($udfParse(TestField)),
+ Ensure("Success", StablePickle($udfParse(TestField)) == StablePickle($udfParse($udfSerialize($udfParse(TestField)))), "Fail"),
+FROM plato.Input;
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.in b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.in
new file mode 100644
index 0000000000..b6dd409ad4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.in
@@ -0,0 +1 @@
+{"TestField"="{\"inner\":{\"i\":{\"a\":\"hello\"}},\"test\":{\"inner\":{\"i\":{\"a\":\"bye\"}}}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.sql
new file mode 100644
index 0000000000..d75aa4af2f
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_no_ser.sql
@@ -0,0 +1,36 @@
+/*
+syntax='proto3';
+
+message Test {
+ message InnerInner {
+ string a = 1;
+ }
+ message Inner {
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+ Test test = 2;
+}
+*/
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrjWsjIxV2UmlxapFdQlF+Sr9TJyMUSklpcIqTIxZqZl5daJMGowKjBbcStBxLV8wQJBUFkhCS5WEqAghJMYBWsYBVBYCEpKS4usFIwIcTDxZgINocziDFRSp2LFSIsx8WYCTVeAMl4iB2MmUlsYCcZAwC/Qiqb",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}@@;
+
+$udfPar = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSer = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+SELECT TestField, Ensure("Success", $udfPar(TestField) == $udfPar($udfSer($udfPar(TestField))), "Fail")
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.in b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.in
new file mode 100644
index 0000000000..f397ecd77c
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.in
@@ -0,0 +1 @@
+{"TestField"="{\"inner\":{\"i\":{\"a\":\"hello\"}}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.sql
new file mode 100644
index 0000000000..87e9fc6bd2
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_plain.sql
@@ -0,0 +1,113 @@
+/*
+syntax='proto3';
+
+message Test {
+ message InnerInner {
+ string a = 1;
+ }
+ message Inner {
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+}
+*/
+
+$configNO = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrjamXk4i7ISczM0ysoyi/JV8rjYglJLS4RUuRizczLSy2SYFRg1OA24tYDiep5goSCIDJSUlxcYD6YEOLhYkwEK+YMYkyUUudihQjLcTFmQs0QQDIDYhBjZhIb2FpjAIm1I9Q=",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}
+@@;
+
+/*
+syntax='proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+ message InnerInner {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+ string a = 1;
+ }
+ message Inner {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+}
+*/
+
+$configYT = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWs2P28YVrz5XetJqKe7aVtZxbCsf3jixNnA+u27TaCXuRq6+SmmTrIGA4EojmTZFKiRle42iCNBTj7kGRQ+9pOgfUKDopUUvPRUo0OZWoGgLtH9Cj30zQ1KkPrxygCQ5bMQ372ve/GbeezOGP96CK0PTHOpkd2yZjnkyGez2id2ztLFjWiVGEzc4R8njKDYgf6DppOozdogjvgPxARILkSuxnczNF0ozQqWwRJuSZSZR/HccNheMiiLEDXVENUZ20jL7LRZgbaz27qtDUogysvcpPgfQJ2Ni9InROy3E0Iu0HKCIr0B+PDnRtZ4SYANkS8gCH6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XqXqRx3hbi4DefD1Lbc6rb2jw6EBLXhXXEq9VqnKySZWfcmlJPWcK9eapTbSrnDCErrgJo8wsNVqUuH5cqxkKJGFrMIaeqnO1atVboCiAXYcgm+JTaSYRPEMqxaxa4nW7wPm16g3FaGharrRuoVuFaV2rJUobexSqcld5WDmlSvdqjmmjtPJNUljOZluBjk2D/mv7yyL1L8/nRVWLXHTO24pjCvdKR2WUZLrgYhK2Zg7YMyBhYXY33PgQIFvOI9KfBXgwEqscUnPtcW/vo7+haZu3mxhPgpzfnAL0fPDdhbPtPtD9lzVtl76UpW/7bQqo/Heav+kL33GLZDVr2uchW7X7p2L4XsBpaXW74QsBwYtPdkSHAzT35KWRLVmflxVXvvQaZn6pMRf8U5SzONHDvUuAxNd3uHsHGfnCpPoeVLV8s6ylWmigzYXISgs15hVwNRvj8HoIC9IHbOtLcSfDx7AegQWA+j5UxLKwLG+xcj3MzH3rPdMqwEG7rVgscf/bj6BogPVEtTDS9qS1Y8ZMXDjeCKsqjQRd9/7U5JLZ2q9D3xhkPUUcma7D4x9cCfIpAd66pmnHJj20+XqoqfRiDeJTYtwxKagQUA68QyNzMlSi3VKEnmI9tXsHymP9gfPKEjqnuhHVH34r/6+8X49g1I8MHnIKK5moSAJq4uonF2/vckyV8y/w/fjdbu",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}
+@@;
+
+/*
+syntax='proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ option (NYT.default_field_flags) = SERIALIZATION_PROTOBUF;
+ message InnerInner {
+ option (NYT.default_field_flags) = SERIALIZATION_PROTOBUF;
+ string a = 1;
+ }
+ message Inner {
+ option (NYT.default_field_flags) = SERIALIZATION_PROTOBUF;
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+}
+*/
+
+$configPB = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWs2P28YVrz5XetJqKe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Protobuf::Parse, $configNO as TypeConfig);
+$udfSerNO = Udf(Protobuf::Serialize, $configNO as TypeConfig);
+$udfParYT = Udf(Protobuf::Parse, $configYT as TypeConfig);
+$udfSerYT = Udf(Protobuf::Serialize, $configYT as TypeConfig);
+$udfParPB = Udf(Protobuf::Parse, $configPB as TypeConfig);
+$udfSerPB = Udf(Protobuf::Serialize, $configPB as TypeConfig);
+
+SELECT TestField,
+ Ensure("Success", $udfParNO(TestField) == $udfParNO($udfSerNO($udfParNO(TestField))), "Fail"),
+ Ensure("Success", $udfParYT(TestField) == $udfParYT($udfSerYT($udfParYT(TestField))), "Fail"),
+ Ensure("Success", $udfParPB(TestField) == $udfParPB($udfSerPB($udfParPB(TestField))), "Fail")
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.in b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.in
new file mode 100644
index 0000000000..b6dd409ad4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.in
@@ -0,0 +1 @@
+{"TestField"="{\"inner\":{\"i\":{\"a\":\"hello\"}},\"test\":{\"inner\":{\"i\":{\"a\":\"bye\"}}}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.sql
new file mode 100644
index 0000000000..35945ffe7a
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_pb.sql
@@ -0,0 +1,40 @@
+/*
+syntax='proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ option (NYT.default_field_flags) = SERIALIZATION_PROTOBUF;
+ message InnerInner {
+ string a = 1;
+ }
+ message Inner {
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+ Test test = 2;
+}
+*/
+
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWkuPG8cRDp9LFrnc4exKoinLsunHrmWLa8jPrBLHXHJ2TYWvDEnbK8AYzJJNaiRyhp4ZSlohCALklFPgqxHkkIuD/IAAQS4Jcg8QIHFOAYIkQPITckx198xwhg8tZcC2D2tO9VdV3dVfd1d1C/54E54dGsZwRPYnpmEbp9PBfp9YPVOb2IZZZDJxiyOKLqJQh+yRNiIVD9gmtvgORAcozIWejeylbrxQnFMqBjVaVCwzjcK/o7C9pFUUIaqrY2oxtJeU2W8xBxsTtXdPHZJcmIndT/EZgD6ZEL1P9N5ZLoK9SMo+ifgKZCfT05HWU3wwQFhMFnhDZQbeha0HRL3nh6YYNEPFPmAZ0mNiWdgBxT6bkFyUjf7ZhdHPjzzlaHVQSSxBkujTMbcQWxE/CRHzVhJUzTGxYRHzvtYjuTgzsLtgoM3b5224ejiUJHloE93SDD23wYy8uGQWyag/b2KmJ74FG8bExl9WLoHzk7rx9FIiNDlGdsFiFQTLmJo9ovSMPlE0fWDkkszA1cWBMGAZcVWEyRkr8C1ehLh1ptvqw1yaMcT5Kvw2DlvrUOwmxAZ0lEiwJ4gB1wkGMf4lg1iClE4sm/Q5IyJrcgq40iKlol+KUh/BltclxVT1ocvN/fN6UpRcPZmqyRkS+BYrAIZOjAEur94IebI8Sk0KWYiSwaW9kfjtGdU2VjClzhfZAtu6kDEJ5T2GmI8syTpRPHdksqPGB7Zp+j/F58ETKIxWwHahtCtsoCz/CDLB8Ig7ELNs1bQZC2My/xAFiOAmw3a5mEx/iu/NBhxhA35pcUYDlufHnX8bNgMDWNd14Ydw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2g2w519OahHH/xQh387H7bLeKK/6Cbr3g8Uc/br4O4n3V1FTdjdqKGQ94cXkjOKosKnTSD1+7XVSLZyp9T7xuE3VcNKf7jz164G8hSGO2PzUn3Fn+yY6qws9CEO0Qi6ZhMU3HBIBVYqkbqSKVFqtUJPMWWuzbKHRerWIMITNRPo+ZNcWwP7h5h1Tnrjuk5nchxsXPQEhzzAs+89xHSDuI/urvl2Oncf6w+X9iYdnD",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}@@;
+
+$udfPar = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSer = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+SELECT TestField, Ensure("Success", $udfPar(TestField) == $udfPar($udfSer($udfPar(TestField))), "Fail")
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.in b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.in
new file mode 100644
index 0000000000..b6dd409ad4
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.in
@@ -0,0 +1 @@
+{"TestField"="{\"inner\":{\"i\":{\"a\":\"hello\"}},\"test\":{\"inner\":{\"i\":{\"a\":\"bye\"}}}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.sql
new file mode 100644
index 0000000000..42312716e6
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_ser_yt.sql
@@ -0,0 +1,39 @@
+/*
+syntax='proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+ message InnerInner {
+ string a = 1;
+ }
+ message Inner {
+ InnerInner i = 1;
+ }
+ Inner inner = 1;
+ Test test = 2;
+}
+*/
+
+$config = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWkuPG8cRDp9LFrnc4exKoinLsunHrmWLa8jPrBLHXHJ2TYWvDEnbK8AYzJJNaiRyhp4ZSlohCALklFPgqxHkkIuD/IAAQS4Jcg8QIHFOAYIkQPITckx198xwhg8tZcC2D2tO9VdV3dVfd1d1C/54E54dGsZwRPYnpmEbp9PBfp9YPVOb2IZZZDJxiyOKLqJQh+yRNiIVD9gmtvgORAcozIWejeylbrxQnFMqBjVaVCwzjcK/o7C9pFUUIaqrY2oxtJeU2W8xBxsTtXdPHZJcmIndT/EZgD6ZEL1P9N5ZLoK9SMo+ifgKZCfT05HWU3wwQFhMFnhDZQbeha0HRL3nh6YYNEPFPmAZ0mNiWdgBxT6bkFyUjf7ZhdHPjzzlaHVQSSxBkujTMbcQWxE/CRHzVhJUzTGxYRHzvtYjuTgzsLtgoM3b5224ejiUJHloE93SDD23wYy8uGQWyag/b2KmJ74FG8bExl9WLoHzk7rx9FIiNDlGdsFiFQTLmJo9ovSMPlE0fWDkkszA1cWBMGAZcVWEyRkr8C1ehLh1ptvqw1yaMcT5Kvw2DlvrUOwmxAZ0lEiwJ4gB1wkGMf4lg1iClE4sm/Q5IyJrcgq40iKlol+KUh/BltclxVT1ocvN/fN6UpRcPZmqyRkS+BYrAIZOjAEur94IebI8Sk0KWYiSwaW9kfjtGdU2VjClzhfZAtu6kDEJ5T2GmI8syTpRPHdksqPGB7Zp+j/F58ETKIxWwHahtCtsoCz/CDLB8Ig7ELNs1bQZC2My/xAFiOAmw3a5mEx/iu/NBhxhA35pcUYDl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I58/PnXP9rUUf15+POgQ2g2w519OahHH/xQh387H7bLeKK/6Cbr3g8Uc/br4O4n3V1FTdjdqKGQ94cXkjOKosKnTSD1+7XVSLZyp9T7xuE3VcNKf7jz164G8hSGO2PzXPuLP8kx1VhZ+FINohFk3DYpqOCQCrxFI3UkUqLVapSOYttNi3Uei8WsUYQmaifB4za4phf3DzDqnOXXdIze9CjIufgZDmmBd85rmPkHYQ/dXfL0dP4/xh8/9pqNnL",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}@@;
+
+$udfPar = Udf(Protobuf::Parse, $config as TypeConfig);
+$udfSer = Udf(Protobuf::Serialize, $config as TypeConfig);
+
+SELECT TestField, Ensure("Success", $udfPar(TestField) == $udfPar($udfSer($udfPar(TestField))), "Fail")
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.in b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.in
new file mode 100644
index 0000000000..6ab446801f
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.in
@@ -0,0 +1,4 @@
+{"TestField"="{\"Name\":\"n1\"}"};
+{"TestField"="{\"Name\":\"n1\",\"a\":\"a1\"}"};
+{"TestField"="{\"Name\":\"n1\",\"test\":{\"Name\":\"n2\",\"a\":\"a2\"}}"};
+{"TestField"="{\"Name\":\"n1\",\"test\":{\"Name\":\"n2\",\"test\":{\"Name\":\"n3\"}}}"};
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.in.attr b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.in.attr
new file mode 100644
index 0000000000..f10d440a23
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.in.attr
@@ -0,0 +1 @@
+{schema=[{name=TestField;type=string}]}
diff --git a/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.sql b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.sql
new file mode 100644
index 0000000000..7c75b1cea5
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/cases/yt_mode_variant.sql
@@ -0,0 +1,82 @@
+/*
+syntax='proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+ option (NYT.default_oneof_flags) = VARIANT;
+
+ oneof Var {
+ Test test = 1 [(NYT.column_name) = "_test"];
+ string a = 2;
+ }
+ string Name = 3 [(NYT.column_name) = "name"];;
+}
+*/
+
+$configVar = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWs2P28YVjz5XetrVUty1razjOFESe+PE2sD57LpNow/uWq6+SmmTrIGA4FIjLW2JVEjK9ho9FOippyLXoCiKXlLk1FOBopcWvRcI0OYWoGgLtH9Cj30zQ1KkpPXKAZL4YItv3te8+c2892YMf7kJzw1MczAkO2PLdMyjSX+nR2zN0seOaRUZTVznHEWPo9CA3J4+JFWfsUMc8R2I95GYjzwX287ceLE4I1QMS7QpWWYShX/HYWPBqChC3FBHVGNkOy2z32IeVsaqdk8dkHyUkb1P8VmAHhkTo0cM7SQfQy/ScoAivgK58eRoqGtKgA2QLSELfKA6Zb4K6w+Iei/ImmGsWUoOMFZgdURsGx1QnJMxycfZ7J+bm/3szDOuVBeFxBKkiTEZcQ2JU+InIceslhQVc1Ws2MS6r2skn2QKrs4p6PDxWR2eHE4lTR46xLB108ivMCUvLVhFMuzNqpjKiW/Bijl28JedT+H6ZG48sxAILc4je8xiDQTbnFgaUTSzRxTd6Jv5NFNweX4ijLGCfDVkk7N26Fs8D0n7xHDUh/lVhhD3q/CHJKwvA7GbkOjTWSLAniAGXCYcxOTXDGIJMgaxHdLjiIgtiSngQvOQin8tSH0I675LiqUaAw+bO2d5UpQ8OZmKyVkS+harAKZBzD5uL22IOFkcpRZlmYuSyanaUPzeFGorpyClwTfZH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5DRzOFkxF9xztJMI8eOOS5DE+DuPqzfIyfKE2j50tWyhnKVqSIDNhYh6KxX2OVAlOvNAShgL4idM+0tBR/PXgA6BNbCaDnT0pKA8f7HCDfzkfdsdxpWgi3ecsHjj35cfQPE+6qlq4YXtVNWPGTFw43girKo0EUvv3anqBZPVPqeeN0h6qhoTXYem3rgd1jTnDjc0NaTpanCCOJdYjviFYg7+C/ryjI3EkVKLKc//+piQqH0W0/JbBwL6ojKMzuSIqr4DMSp17wMKqdQgJXAMqPupn6L37/+6uJaOQGx91XrKMlfLP8PjbXUZg==",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}
+@@;
+
+/*
+syntax='proto3';
+
+import "yt/yt_proto/yt/formats/extension.proto";
+
+message Test {
+ option (NYT.default_field_flags) = SERIALIZATION_YT;
+ option (NYT.default_oneof_flags) = SEPARATE_FIELDS;
+
+ oneof Var {
+ Test test = 1 [(NYT.column_name) = "_test"];
+ string a = 2;
+ }
+ string Name = 3 [(NYT.column_name) = "name"];;
+}
+*/
+
+$configSeparate = @@{
+ "name": "Test",
+ "format": "json",
+ "skip": 0,
+ "lists": {
+ "optional": false
+ },
+ "meta": "eNrFWs2P28YVjz5XetrVUty1razjOFESe+PE2sD57LpNow/uWq6+SmmTrIGA4FIjLW2JVEjK9ho9FOippyLXoCiKXlLk1FOBopcWvRcI0OYWoGgLtH9Cj30zQ1KkpPXKAZL4YItv3te8+c2892YMf7kJzw1MczAkO2PLdMyjSX+nR2zN0seOaRUZTVznHEWPo9CA3J4+JFWfsUMc8R2I95GYjzwX287ceLE4I1QMS7QpWWYShX/HYWPBqChC3FBHVGNkOy2z32IeVsaqdk8dkHyUkb1P8VmAHhkTo0cM7SQfQy/ScoAivgK58eRoqGtKgA2QLSELfKA6Zb4K6w+Iei/ImmGsWUoOMFZgdURsGx1QnJMxycfZ7J+bm/3szDOuVBeFxBKkiTEZcQ2JU+InIceslhQVc1Ws2MS6r2skn2QKrs4p6PDxW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k0QC7NqFbue1cI92PAC5bYyLFRdN1KvwNWq1JalCr2NVTotuavs1aR6tUM119x5IqkuYTQvw8UgR/mQ//IKwUjhB9NVYfUfM7XtmsJM05HaJRktuRqEVTEDK++XMLC4GGu7DuTpFlC8JwX+atBHJbb42Ofa/N/+SN8iszcuFhE/xTkf+OXouT57y2e6/SF7zip7L13K6t8XWvXxOG/VH7J3H8FWyKrXVS5j90vX7qWQ3cDycssXApYDg/auDAlu5vFPKadEdWZ+XNXue5DRzOFkxF9xztJMI8eOOS5DE+DuPqzfIyfKE2j50tWyhnKVqSIDNhYh6KxX2OVAlOvNAShgL4idM+0tBR/PXgA6BNbCaDnT0pKA8f7HCDfzkfdsdxpWgi3ecsHjj35cfQPE+6qlq4YXtVNWPGTFw43girKo0EUvv3anqBZPVPqeeN0h6qhoTXYem3rgd1jTnDjc0NaTpanCCOJdYjviFYg7+C/ryjI3EkVKLKc//+piQqH0W0/JbBwL6ojKMzuSIqr4DMSp17wMKqdQgJXAMqPupn6L37/+6uJqOQGx91XrKMlfLP8PjaXUZQ==",
+ "view": {
+ "recursion": "bytes",
+ "enum": "number",
+ "yt_mode": true
+ }
+}
+@@;
+
+$udfParseVar = Udf(Protobuf::Parse, $configVar as TypeConfig);
+$udfSerializeVar = Udf(Protobuf::Serialize, $configVar as TypeConfig);
+
+$udfParseSep = Udf(Protobuf::Parse, $configSeparate as TypeConfig);
+$udfSerializeSep = Udf(Protobuf::Serialize, $configSeparate as TypeConfig);
+
+SELECT
+ TestField,
+ $udfParseVar(TestField),
+ $udfSerializeVar($udfParseVar(TestField)),
+ Ensure("Success", StablePickle($udfParseVar(TestField)) == StablePickle($udfParseVar($udfSerializeVar($udfParseVar(TestField)))), "Fail"),
+ $udfParseSep(TestField),
+ $udfSerializeSep($udfParseSep(TestField)),
+ Ensure("Success", StablePickle($udfParseSep(TestField)) == StablePickle($udfParseSep($udfSerializeSep($udfParseSep(TestField)))), "Fail"),
+FROM plato.Input;
+
diff --git a/ydb/library/yql/udfs/common/protobuf/test/ya.make b/ydb/library/yql/udfs/common/protobuf/test/ya.make
new file mode 100644
index 0000000000..a74102e6ab
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/test/ya.make
@@ -0,0 +1,13 @@
+YQL_UDF_TEST()
+
+DEPENDS(ydb/library/yql/udfs/common/protobuf)
+
+TIMEOUT(300)
+
+SIZE(MEDIUM)
+
+IF (SANITIZER_TYPE == "memory")
+ TAG(ya:not_autocheck) # YQL-15385
+ENDIF()
+
+END()
diff --git a/ydb/library/yql/udfs/common/protobuf/ya.make b/ydb/library/yql/udfs/common/protobuf/ya.make
new file mode 100644
index 0000000000..83e45fd574
--- /dev/null
+++ b/ydb/library/yql/udfs/common/protobuf/ya.make
@@ -0,0 +1,22 @@
+YQL_UDF(protobuf_udf)
+
+YQL_ABI_VERSION(
+ 2
+ 9
+ 0
+)
+
+SRCS(
+ protobuf_udf.cpp
+)
+
+PEERDIR(
+ library/cpp/protobuf/yql
+ yql/library/protobuf_udf
+)
+
+END()
+
+RECURSE_FOR_TESTS(
+ test
+)
diff --git a/ydb/library/yql/udfs/common/ya.make b/ydb/library/yql/udfs/common/ya.make
index 511570b1bd..0f057ca81d 100644
--- a/ydb/library/yql/udfs/common/ya.make
+++ b/ydb/library/yql/udfs/common/ya.make
@@ -10,6 +10,7 @@ RECURSE(
json2
math
pire
+ protobuf
re2
set
stat
diff --git a/yql/CMakeLists.txt b/yql/CMakeLists.txt
new file mode 100644
index 0000000000..3642e95e64
--- /dev/null
+++ b/yql/CMakeLists.txt
@@ -0,0 +1,9 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+add_subdirectory(library)
diff --git a/yql/library/CMakeLists.txt b/yql/library/CMakeLists.txt
new file mode 100644
index 0000000000..f02e617aae
--- /dev/null
+++ b/yql/library/CMakeLists.txt
@@ -0,0 +1,9 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+add_subdirectory(protobuf_udf)
diff --git a/yql/library/protobuf_udf/CMakeLists.darwin-x86_64.txt b/yql/library/protobuf_udf/CMakeLists.darwin-x86_64.txt
new file mode 100644
index 0000000000..68152b43f2
--- /dev/null
+++ b/yql/library/protobuf_udf/CMakeLists.darwin-x86_64.txt
@@ -0,0 +1,32 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(yql-library-protobuf_udf)
+target_compile_options(yql-library-protobuf_udf PRIVATE
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(yql-library-protobuf_udf PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ contrib-libs-protobuf
+ cpp-protobuf-yql
+ yql-public-udf
+ library-yql-minikql
+ library-yql-utils
+ cpp-mapreduce-interface
+ yt_proto-yt-formats
+)
+target_sources(yql-library-protobuf_udf PRIVATE
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/proto_builder.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/module.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/type_builder.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/value_builder.cpp
+)
diff --git a/yql/library/protobuf_udf/CMakeLists.linux-aarch64.txt b/yql/library/protobuf_udf/CMakeLists.linux-aarch64.txt
new file mode 100644
index 0000000000..5e5cf9da15
--- /dev/null
+++ b/yql/library/protobuf_udf/CMakeLists.linux-aarch64.txt
@@ -0,0 +1,33 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(yql-library-protobuf_udf)
+target_compile_options(yql-library-protobuf_udf PRIVATE
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(yql-library-protobuf_udf PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ contrib-libs-protobuf
+ cpp-protobuf-yql
+ yql-public-udf
+ library-yql-minikql
+ library-yql-utils
+ cpp-mapreduce-interface
+ yt_proto-yt-formats
+)
+target_sources(yql-library-protobuf_udf PRIVATE
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/proto_builder.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/module.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/type_builder.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/value_builder.cpp
+)
diff --git a/yql/library/protobuf_udf/CMakeLists.linux-x86_64.txt b/yql/library/protobuf_udf/CMakeLists.linux-x86_64.txt
new file mode 100644
index 0000000000..5e5cf9da15
--- /dev/null
+++ b/yql/library/protobuf_udf/CMakeLists.linux-x86_64.txt
@@ -0,0 +1,33 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(yql-library-protobuf_udf)
+target_compile_options(yql-library-protobuf_udf PRIVATE
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(yql-library-protobuf_udf PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ contrib-libs-protobuf
+ cpp-protobuf-yql
+ yql-public-udf
+ library-yql-minikql
+ library-yql-utils
+ cpp-mapreduce-interface
+ yt_proto-yt-formats
+)
+target_sources(yql-library-protobuf_udf PRIVATE
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/proto_builder.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/module.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/type_builder.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/value_builder.cpp
+)
diff --git a/yql/library/protobuf_udf/CMakeLists.txt b/yql/library/protobuf_udf/CMakeLists.txt
new file mode 100644
index 0000000000..f8b31df0c1
--- /dev/null
+++ b/yql/library/protobuf_udf/CMakeLists.txt
@@ -0,0 +1,17 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-aarch64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ include(CMakeLists.darwin-x86_64.txt)
+elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA)
+ include(CMakeLists.windows-x86_64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-x86_64.txt)
+endif()
diff --git a/yql/library/protobuf_udf/CMakeLists.windows-x86_64.txt b/yql/library/protobuf_udf/CMakeLists.windows-x86_64.txt
new file mode 100644
index 0000000000..68152b43f2
--- /dev/null
+++ b/yql/library/protobuf_udf/CMakeLists.windows-x86_64.txt
@@ -0,0 +1,32 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(yql-library-protobuf_udf)
+target_compile_options(yql-library-protobuf_udf PRIVATE
+ -DUDF_ABI_VERSION_MAJOR=2
+ -DUDF_ABI_VERSION_MINOR=9
+ -DUDF_ABI_VERSION_PATCH=0
+)
+target_link_libraries(yql-library-protobuf_udf PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ contrib-libs-protobuf
+ cpp-protobuf-yql
+ yql-public-udf
+ library-yql-minikql
+ library-yql-utils
+ cpp-mapreduce-interface
+ yt_proto-yt-formats
+)
+target_sources(yql-library-protobuf_udf PRIVATE
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/proto_builder.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/module.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/type_builder.cpp
+ ${CMAKE_SOURCE_DIR}/yql/library/protobuf_udf/value_builder.cpp
+)