diff options
author | AlexSm <alex@ydb.tech> | 2023-12-19 14:10:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-19 14:10:33 +0100 |
commit | ad749a9f3df73bba7eceb6747f31e5168c478c1a (patch) | |
tree | db4cc1253534a7d2fb8a842f17f999c6c1a8e91e | |
parent | 38eb4160a977948f6d87916acd118a82797f7b0b (diff) | |
download | ydb-ad749a9f3df73bba7eceb6747f31e5168c478c1a.tar.gz |
Mote YT plugin to ydb/library/yql (#573)
-rw-r--r-- | ydb/library/yql/ya.make | 1 | ||||
-rw-r--r-- | ydb/library/yql/yt/README.md | 15 | ||||
-rw-r--r-- | ydb/library/yql/yt/bridge/interface.h (renamed from yt/yql/plugin/bridge/interface.h) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/CMakeLists.darwin-arm64.txt (renamed from yt/yql/plugin/dynamic/CMakeLists.darwin-arm64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/CMakeLists.darwin-x86_64.txt (renamed from yt/yql/plugin/dynamic/CMakeLists.darwin-x86_64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/CMakeLists.linux-aarch64.txt (renamed from yt/yql/plugin/dynamic/CMakeLists.linux-aarch64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/CMakeLists.linux-x86_64.txt (renamed from yt/yql/plugin/dynamic/CMakeLists.linux-x86_64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/CMakeLists.txt (renamed from yt/yql/plugin/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/CMakeLists.windows-x86_64.txt (renamed from yt/yql/plugin/dynamic/CMakeLists.windows-x86_64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/dylib.exports (renamed from yt/yql/plugin/dynamic/dylib.exports) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/impl.cpp (renamed from yt/yql/plugin/dynamic/impl.cpp) | 4 | ||||
-rw-r--r-- | ydb/library/yql/yt/dynamic/ya.make (renamed from yt/yql/plugin/dynamic/ya.make) | 2 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/CMakeLists.darwin-arm64.txt (renamed from yt/yql/plugin/native/CMakeLists.darwin-arm64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/CMakeLists.darwin-x86_64.txt (renamed from yt/yql/plugin/native/CMakeLists.darwin-x86_64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/CMakeLists.linux-aarch64.txt (renamed from yt/yql/plugin/native/CMakeLists.linux-aarch64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/CMakeLists.linux-x86_64.txt (renamed from yt/yql/plugin/native/CMakeLists.linux-x86_64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/CMakeLists.txt (renamed from yt/yql/plugin/dynamic/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/CMakeLists.windows-x86_64.txt (renamed from yt/yql/plugin/native/CMakeLists.windows-x86_64.txt) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/error_helpers.cpp (renamed from yt/yql/plugin/native/error_helpers.cpp) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/error_helpers.h (renamed from yt/yql/plugin/native/error_helpers.h) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/plugin.cpp (renamed from yt/yql/plugin/native/plugin.cpp) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/plugin.h (renamed from yt/yql/plugin/native/plugin.h) | 2 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/progress_merger.cpp (renamed from yt/yql/plugin/native/progress_merger.cpp) | 1 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/progress_merger.h (renamed from yt/yql/plugin/native/progress_merger.h) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/native/ya.make (renamed from yt/yql/plugin/native/ya.make) | 2 | ||||
-rw-r--r-- | ydb/library/yql/yt/plugin.cpp (renamed from yt/yql/plugin/plugin.cpp) | 0 | ||||
-rw-r--r-- | ydb/library/yql/yt/plugin.h (renamed from yt/yql/plugin/plugin.h) | 2 | ||||
-rw-r--r-- | ydb/library/yql/yt/ya.make | 13 | ||||
-rw-r--r-- | yt/yql/plugin/CMakeLists.darwin-arm64.txt | 19 | ||||
-rw-r--r-- | yt/yql/plugin/CMakeLists.darwin-x86_64.txt | 19 | ||||
-rw-r--r-- | yt/yql/plugin/CMakeLists.linux-aarch64.txt | 20 | ||||
-rw-r--r-- | yt/yql/plugin/CMakeLists.linux-x86_64.txt | 20 | ||||
-rw-r--r-- | yt/yql/plugin/CMakeLists.windows-x86_64.txt | 19 | ||||
-rw-r--r-- | yt/yql/plugin/bridge/plugin.cpp | 240 | ||||
-rw-r--r-- | yt/yql/plugin/bridge/plugin.h | 13 | ||||
-rw-r--r-- | yt/yql/plugin/bridge/ya.make | 12 | ||||
-rw-r--r-- | yt/yql/plugin/native/CMakeLists.txt | 19 | ||||
-rw-r--r-- | yt/yql/plugin/ya.make | 19 |
38 files changed, 35 insertions, 407 deletions
diff --git a/ydb/library/yql/ya.make b/ydb/library/yql/ya.make index 3aafe2834a..12523fc69f 100644 --- a/ydb/library/yql/ya.make +++ b/ydb/library/yql/ya.make @@ -12,4 +12,5 @@ RECURSE( tools udfs utils + yt ) diff --git a/ydb/library/yql/yt/README.md b/ydb/library/yql/yt/README.md new file mode 100644 index 0000000000..1e59e4515c --- /dev/null +++ b/ydb/library/yql/yt/README.md @@ -0,0 +1,15 @@ +### What is this? + +This directory contains targets related to YTsaurus YQL plugin. [YTsaurus](https://github.com/ytsaurus/ytsaurus) +is an open-source big data storage system which employs YQL engine as one of its primary computation engines. +YT relies on a so-called YQL plugin shared library, which is built from target located in dynamic/ directory. + +Changes of interfaces in this directory must be done very carefuly. In general, bridge/interface.h must be a +superset of +[ytsaurus:yt/yql/plugin/bridge/interface.h](https://github.com/ytsaurus/ytsaurus/blob/main/yt/yql/plugin/bridge/interface.h). +If a backwards incompatible change in interface is required, do not forget to promote the YQL plugin version +in this repository, and change the min/max supported YQL plugin +[versions](https://github.com/ytsaurus/ytsaurus/blob/main/yt/yql/plugin/bridge/plugin.cpp#L32-L41) in YTsaurus repository. + +If you are not 100% sure about what you are doing, contact vvvv@ydb.tech and mpereskokova@ytsaurus.tech for help. + diff --git a/yt/yql/plugin/bridge/interface.h b/ydb/library/yql/yt/bridge/interface.h index d1e277fe69..d1e277fe69 100644 --- a/yt/yql/plugin/bridge/interface.h +++ b/ydb/library/yql/yt/bridge/interface.h diff --git a/yt/yql/plugin/dynamic/CMakeLists.darwin-arm64.txt b/ydb/library/yql/yt/dynamic/CMakeLists.darwin-arm64.txt index bb76915330..bb76915330 100644 --- a/yt/yql/plugin/dynamic/CMakeLists.darwin-arm64.txt +++ b/ydb/library/yql/yt/dynamic/CMakeLists.darwin-arm64.txt diff --git a/yt/yql/plugin/dynamic/CMakeLists.darwin-x86_64.txt b/ydb/library/yql/yt/dynamic/CMakeLists.darwin-x86_64.txt index bb76915330..bb76915330 100644 --- a/yt/yql/plugin/dynamic/CMakeLists.darwin-x86_64.txt +++ b/ydb/library/yql/yt/dynamic/CMakeLists.darwin-x86_64.txt diff --git a/yt/yql/plugin/dynamic/CMakeLists.linux-aarch64.txt b/ydb/library/yql/yt/dynamic/CMakeLists.linux-aarch64.txt index 63edf774f2..63edf774f2 100644 --- a/yt/yql/plugin/dynamic/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/yt/dynamic/CMakeLists.linux-aarch64.txt diff --git a/yt/yql/plugin/dynamic/CMakeLists.linux-x86_64.txt b/ydb/library/yql/yt/dynamic/CMakeLists.linux-x86_64.txt index 63edf774f2..63edf774f2 100644 --- a/yt/yql/plugin/dynamic/CMakeLists.linux-x86_64.txt +++ b/ydb/library/yql/yt/dynamic/CMakeLists.linux-x86_64.txt diff --git a/yt/yql/plugin/CMakeLists.txt b/ydb/library/yql/yt/dynamic/CMakeLists.txt index d863ebd180..d863ebd180 100644 --- a/yt/yql/plugin/CMakeLists.txt +++ b/ydb/library/yql/yt/dynamic/CMakeLists.txt diff --git a/yt/yql/plugin/dynamic/CMakeLists.windows-x86_64.txt b/ydb/library/yql/yt/dynamic/CMakeLists.windows-x86_64.txt index 2814417000..2814417000 100644 --- a/yt/yql/plugin/dynamic/CMakeLists.windows-x86_64.txt +++ b/ydb/library/yql/yt/dynamic/CMakeLists.windows-x86_64.txt diff --git a/yt/yql/plugin/dynamic/dylib.exports b/ydb/library/yql/yt/dynamic/dylib.exports index 743e71c650..743e71c650 100644 --- a/yt/yql/plugin/dynamic/dylib.exports +++ b/ydb/library/yql/yt/dynamic/dylib.exports diff --git a/yt/yql/plugin/dynamic/impl.cpp b/ydb/library/yql/yt/dynamic/impl.cpp index c63f9fb035..818575745a 100644 --- a/yt/yql/plugin/dynamic/impl.cpp +++ b/ydb/library/yql/yt/dynamic/impl.cpp @@ -1,5 +1,5 @@ -#include <yt/yql/plugin/bridge/interface.h> -#include <yt/yql/plugin/native/plugin.h> +#include <ydb/library/yql/yt/bridge/interface.h> +#include <ydb/library/yql/yt/native/plugin.h> #include <type_traits> diff --git a/yt/yql/plugin/dynamic/ya.make b/ydb/library/yql/yt/dynamic/ya.make index c91996acec..e401537d54 100644 --- a/yt/yql/plugin/dynamic/ya.make +++ b/ydb/library/yql/yt/dynamic/ya.make @@ -9,7 +9,7 @@ SRCS( ) PEERDIR( - yt/yql/plugin/native + ydb/library/yql/yt/native ) END() diff --git a/yt/yql/plugin/native/CMakeLists.darwin-arm64.txt b/ydb/library/yql/yt/native/CMakeLists.darwin-arm64.txt index 04a6b539a5..04a6b539a5 100644 --- a/yt/yql/plugin/native/CMakeLists.darwin-arm64.txt +++ b/ydb/library/yql/yt/native/CMakeLists.darwin-arm64.txt diff --git a/yt/yql/plugin/native/CMakeLists.darwin-x86_64.txt b/ydb/library/yql/yt/native/CMakeLists.darwin-x86_64.txt index 04a6b539a5..04a6b539a5 100644 --- a/yt/yql/plugin/native/CMakeLists.darwin-x86_64.txt +++ b/ydb/library/yql/yt/native/CMakeLists.darwin-x86_64.txt diff --git a/yt/yql/plugin/native/CMakeLists.linux-aarch64.txt b/ydb/library/yql/yt/native/CMakeLists.linux-aarch64.txt index b9ac27203c..b9ac27203c 100644 --- a/yt/yql/plugin/native/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/yt/native/CMakeLists.linux-aarch64.txt diff --git a/yt/yql/plugin/native/CMakeLists.linux-x86_64.txt b/ydb/library/yql/yt/native/CMakeLists.linux-x86_64.txt index b9ac27203c..b9ac27203c 100644 --- a/yt/yql/plugin/native/CMakeLists.linux-x86_64.txt +++ b/ydb/library/yql/yt/native/CMakeLists.linux-x86_64.txt diff --git a/yt/yql/plugin/dynamic/CMakeLists.txt b/ydb/library/yql/yt/native/CMakeLists.txt index d863ebd180..d863ebd180 100644 --- a/yt/yql/plugin/dynamic/CMakeLists.txt +++ b/ydb/library/yql/yt/native/CMakeLists.txt diff --git a/yt/yql/plugin/native/CMakeLists.windows-x86_64.txt b/ydb/library/yql/yt/native/CMakeLists.windows-x86_64.txt index 04a6b539a5..04a6b539a5 100644 --- a/yt/yql/plugin/native/CMakeLists.windows-x86_64.txt +++ b/ydb/library/yql/yt/native/CMakeLists.windows-x86_64.txt diff --git a/yt/yql/plugin/native/error_helpers.cpp b/ydb/library/yql/yt/native/error_helpers.cpp index e23d1fc497..e23d1fc497 100644 --- a/yt/yql/plugin/native/error_helpers.cpp +++ b/ydb/library/yql/yt/native/error_helpers.cpp diff --git a/yt/yql/plugin/native/error_helpers.h b/ydb/library/yql/yt/native/error_helpers.h index ac75047cbe..ac75047cbe 100644 --- a/yt/yql/plugin/native/error_helpers.h +++ b/ydb/library/yql/yt/native/error_helpers.h diff --git a/yt/yql/plugin/native/plugin.cpp b/ydb/library/yql/yt/native/plugin.cpp index 60a0284aa7..60a0284aa7 100644 --- a/yt/yql/plugin/native/plugin.cpp +++ b/ydb/library/yql/yt/native/plugin.cpp diff --git a/yt/yql/plugin/native/plugin.h b/ydb/library/yql/yt/native/plugin.h index c930e56ba1..20df9a91c6 100644 --- a/yt/yql/plugin/native/plugin.h +++ b/ydb/library/yql/yt/native/plugin.h @@ -1,6 +1,6 @@ #pragma once -#include <yt/yql/plugin/plugin.h> +#include <ydb/library/yql/yt/plugin.h> namespace NYT::NYqlPlugin { diff --git a/yt/yql/plugin/native/progress_merger.cpp b/ydb/library/yql/yt/native/progress_merger.cpp index 3a0a02604e..8bd6145169 100644 --- a/yt/yql/plugin/native/progress_merger.cpp +++ b/ydb/library/yql/yt/native/progress_merger.cpp @@ -1,6 +1,5 @@ #include "progress_merger.h" - namespace NYT::NYqlPlugin { ////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yql/plugin/native/progress_merger.h b/ydb/library/yql/yt/native/progress_merger.h index 3bb5f101d0..3bb5f101d0 100644 --- a/yt/yql/plugin/native/progress_merger.h +++ b/ydb/library/yql/yt/native/progress_merger.h diff --git a/yt/yql/plugin/native/ya.make b/ydb/library/yql/yt/native/ya.make index fe1a657c69..270f74d8cb 100644 --- a/yt/yql/plugin/native/ya.make +++ b/ydb/library/yql/yt/native/ya.make @@ -40,7 +40,7 @@ PEERDIR( ydb/library/yql/providers/yt/lib/yt_download ydb/library/yql/providers/yt/provider - yt/yql/plugin + ydb/library/yql/yt ) YQL_LAST_ABI_VERSION() diff --git a/yt/yql/plugin/plugin.cpp b/ydb/library/yql/yt/plugin.cpp index f9fd053951..f9fd053951 100644 --- a/yt/yql/plugin/plugin.cpp +++ b/ydb/library/yql/yt/plugin.cpp diff --git a/yt/yql/plugin/plugin.h b/ydb/library/yql/yt/plugin.h index 3fcc8e3e16..520a9fe235 100644 --- a/yt/yql/plugin/plugin.h +++ b/ydb/library/yql/yt/plugin.h @@ -1,6 +1,6 @@ #pragma once -#include <yt/yql/plugin/bridge/interface.h> +#include <ydb/library/yql/yt/bridge/interface.h> #include <library/cpp/logger/log.h> diff --git a/ydb/library/yql/yt/ya.make b/ydb/library/yql/yt/ya.make new file mode 100644 index 0000000000..4aeb5b9bc6 --- /dev/null +++ b/ydb/library/yql/yt/ya.make @@ -0,0 +1,13 @@ +LIBRARY() + +SRCS( + plugin.cpp +) + +END() + +RECURSE( + dynamic + native +) + diff --git a/yt/yql/plugin/CMakeLists.darwin-arm64.txt b/yt/yql/plugin/CMakeLists.darwin-arm64.txt deleted file mode 100644 index e4e42a5389..0000000000 --- a/yt/yql/plugin/CMakeLists.darwin-arm64.txt +++ /dev/null @@ -1,19 +0,0 @@ - -# 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(dynamic) -add_subdirectory(native) - -add_library(yt-yql-plugin) -target_link_libraries(yt-yql-plugin PUBLIC - contrib-libs-cxxsupp - yutil -) -target_sources(yt-yql-plugin PRIVATE - ${CMAKE_SOURCE_DIR}/yt/yql/plugin/plugin.cpp -) diff --git a/yt/yql/plugin/CMakeLists.darwin-x86_64.txt b/yt/yql/plugin/CMakeLists.darwin-x86_64.txt deleted file mode 100644 index e4e42a5389..0000000000 --- a/yt/yql/plugin/CMakeLists.darwin-x86_64.txt +++ /dev/null @@ -1,19 +0,0 @@ - -# 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(dynamic) -add_subdirectory(native) - -add_library(yt-yql-plugin) -target_link_libraries(yt-yql-plugin PUBLIC - contrib-libs-cxxsupp - yutil -) -target_sources(yt-yql-plugin PRIVATE - ${CMAKE_SOURCE_DIR}/yt/yql/plugin/plugin.cpp -) diff --git a/yt/yql/plugin/CMakeLists.linux-aarch64.txt b/yt/yql/plugin/CMakeLists.linux-aarch64.txt deleted file mode 100644 index 3fb7f34a94..0000000000 --- a/yt/yql/plugin/CMakeLists.linux-aarch64.txt +++ /dev/null @@ -1,20 +0,0 @@ - -# 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(dynamic) -add_subdirectory(native) - -add_library(yt-yql-plugin) -target_link_libraries(yt-yql-plugin PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil -) -target_sources(yt-yql-plugin PRIVATE - ${CMAKE_SOURCE_DIR}/yt/yql/plugin/plugin.cpp -) diff --git a/yt/yql/plugin/CMakeLists.linux-x86_64.txt b/yt/yql/plugin/CMakeLists.linux-x86_64.txt deleted file mode 100644 index 3fb7f34a94..0000000000 --- a/yt/yql/plugin/CMakeLists.linux-x86_64.txt +++ /dev/null @@ -1,20 +0,0 @@ - -# 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(dynamic) -add_subdirectory(native) - -add_library(yt-yql-plugin) -target_link_libraries(yt-yql-plugin PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil -) -target_sources(yt-yql-plugin PRIVATE - ${CMAKE_SOURCE_DIR}/yt/yql/plugin/plugin.cpp -) diff --git a/yt/yql/plugin/CMakeLists.windows-x86_64.txt b/yt/yql/plugin/CMakeLists.windows-x86_64.txt deleted file mode 100644 index e4e42a5389..0000000000 --- a/yt/yql/plugin/CMakeLists.windows-x86_64.txt +++ /dev/null @@ -1,19 +0,0 @@ - -# 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(dynamic) -add_subdirectory(native) - -add_library(yt-yql-plugin) -target_link_libraries(yt-yql-plugin PUBLIC - contrib-libs-cxxsupp - yutil -) -target_sources(yt-yql-plugin PRIVATE - ${CMAKE_SOURCE_DIR}/yt/yql/plugin/plugin.cpp -) diff --git a/yt/yql/plugin/bridge/plugin.cpp b/yt/yql/plugin/bridge/plugin.cpp deleted file mode 100644 index 95f7de7a76..0000000000 --- a/yt/yql/plugin/bridge/plugin.cpp +++ /dev/null @@ -1,240 +0,0 @@ -#include "plugin.h" - -#include "interface.h" - -#include <yt/yql/plugin/plugin.h> - -#include <yt/yt/core/misc/error.h> - -#include <library/cpp/yt/misc/cast.h> - -#include <util/system/dynlib.h> - -namespace NYT::NYqlPlugin { -namespace NBridge { - -//////////////////////////////////////////////////////////////////////////////// - -namespace { - -std::optional<TString> ToString(const char* str, size_t strLength) -{ - if (!str) { - return std::nullopt; - } - return TString(str, strLength); -} - -} // namespace - -//////////////////////////////////////////////////////////////////////////////// - -// Each YQL plugin ABI change should be listed here. Either a compat should be added -// or MinSupportedYqlPluginAbiVersion should be promoted. -DEFINE_ENUM(EYqlPluginAbiVersion, - ((Invalid) (-1)) - ((TheBigBang) (0)) - ((AbortQuery) (1)) // gritukan: Added BridgeAbort; no breaking changes. -); - -constexpr auto MinSupportedYqlPluginAbiVersion = EYqlPluginAbiVersion::TheBigBang; -constexpr auto MaxSupportedYqlPluginAbiVersion = EYqlPluginAbiVersion::AbortQuery; - -//////////////////////////////////////////////////////////////////////////////// - -class TDynamicYqlPlugin -{ -public: - TDynamicYqlPlugin(std::optional<TString> yqlPluginSharedLibrary) - { - static const TString DefaultYqlPluginLibraryName = "./libyqlplugin.so"; - auto sharedLibraryPath = yqlPluginSharedLibrary.value_or(DefaultYqlPluginLibraryName); - Library_.Open(sharedLibraryPath.data()); - #define XX(function) \ - { \ - if constexpr(#function == TStringBuf("BridgeAbort")) { \ - if (AbiVersion_ < EYqlPluginAbiVersion::AbortQuery) { \ - function = reinterpret_cast<TFunc ## function*>(AbortQueryStub); \ - } else { \ - function = reinterpret_cast<TFunc ## function*>(Library_.Sym(#function)); \ - } \ - } else if constexpr(#function == TStringBuf("BridgeFreeAbortResult")) { \ - if (AbiVersion_ < EYqlPluginAbiVersion::AbortQuery) { \ - function = reinterpret_cast<TFunc ## function*>(FreeAbortResultStub); \ - } else { \ - function = reinterpret_cast<TFunc ## function*>(Library_.Sym(#function)); \ - } \ - } else { \ - function = reinterpret_cast<TFunc ## function*>(Library_.Sym(#function)); \ - } \ - } \ - - // Firstly we need to get ABI version of the plugin to make it possible to - // add compats for other functions. - XX(BridgeGetAbiVersion); - GetYqlPluginAbiVersion(); - - FOR_EACH_BRIDGE_INTERFACE_FUNCTION(XX); - #undef XX - } - -protected: - TDynamicLibrary Library_; - - EYqlPluginAbiVersion AbiVersion_ = EYqlPluginAbiVersion::Invalid; - - #define XX(function) TFunc ## function* function; - FOR_EACH_BRIDGE_INTERFACE_FUNCTION(XX) - #undef XX - - // COMPAT(gritukan): AbortQuery - static TBridgeAbortResult* AbortQueryStub(TBridgeYqlPlugin* /*plugin*/, const char* /*queryId*/) - { - // Just do nothing. It is not worse than in used to be before. - return nullptr; - } - - static void FreeAbortResultStub(TBridgeAbortResult* /*result*/) - { - YT_ABORT(); - } - - void GetYqlPluginAbiVersion() - { - if (!TryEnumCast(BridgeGetAbiVersion(), &AbiVersion_)) { - THROW_ERROR_EXCEPTION( - "YQL plugin ABI version %v is not supported", - BridgeGetAbiVersion()); - } - - if (AbiVersion_ < MinSupportedYqlPluginAbiVersion || - AbiVersion_ > MaxSupportedYqlPluginAbiVersion) - { - THROW_ERROR_EXCEPTION( - "YQL plugin ABI version %Qv is not supported", - AbiVersion_); - } - } -}; - -//////////////////////////////////////////////////////////////////////////////// - -class TYqlPlugin - : public TDynamicYqlPlugin - , public IYqlPlugin -{ -public: - explicit TYqlPlugin(TYqlPluginOptions options) - : TDynamicYqlPlugin(options.YqlPluginSharedLibrary) - { - TString singletonsConfig = options.SingletonsConfig ? options.SingletonsConfig.ToString() : "{}"; - - TBridgeYqlPluginOptions bridgeOptions { - .SingletonsConfig = singletonsConfig.data(), - .SingletonsConfigLength = static_cast<int>(singletonsConfig.size()), - .GatewayConfig = options.GatewayConfig.AsStringBuf().Data(), - .GatewayConfigLength = options.GatewayConfig.AsStringBuf().Size(), - .FileStorageConfig = options.FileStorageConfig.AsStringBuf().Data(), - .FileStorageConfigLength = options.FileStorageConfig.AsStringBuf().Size(), - .OperationAttributes = options.OperationAttributes.AsStringBuf().Data(), - .OperationAttributesLength = options.OperationAttributes.AsStringBuf().Size(), - .YTTokenPath = options.YTTokenPath.data(), - .LogBackend = &options.LogBackend, - }; - - BridgePlugin_ = BridgeCreateYqlPlugin(&bridgeOptions); - } - - TQueryResult Run( - TQueryId queryId, - TString impersonationUser, - TString queryText, - NYson::TYsonString settings, - std::vector<TQueryFile> files) noexcept override - { - auto settingsString = settings ? settings.ToString() : "{}"; - auto queryIdStr = ToString(queryId); - - std::vector<TBridgeQueryFile> filesData; - filesData.reserve(files.size()); - for (const auto& file : files) { - filesData.push_back(TBridgeQueryFile{ - .Name = file.Name.data(), - .NameLength = file.Name.size(), - .Content = file.Content.data(), - .ContentLength = file.Content.size(), - .Type = file.Type, - }); - } - - auto* bridgeQueryResult = BridgeRun( - BridgePlugin_, - queryIdStr.data(), - impersonationUser.data(), - queryText.data(), - settingsString.data(), - filesData.data(), - filesData.size()); - TQueryResult queryResult{ - .YsonResult = ToString(bridgeQueryResult->YsonResult, bridgeQueryResult->YsonResultLength), - .Plan = ToString(bridgeQueryResult->Plan, bridgeQueryResult->PlanLength), - .Statistics = ToString(bridgeQueryResult->Statistics, bridgeQueryResult->StatisticsLength), - .Progress = ToString(bridgeQueryResult->Progress, bridgeQueryResult->ProgressLength), - .TaskInfo = ToString(bridgeQueryResult->TaskInfo, bridgeQueryResult->TaskInfoLength), - .YsonError = ToString(bridgeQueryResult->YsonError, bridgeQueryResult->YsonErrorLength), - }; - BridgeFreeQueryResult(bridgeQueryResult); - return queryResult; - } - - TQueryResult GetProgress(TQueryId queryId) noexcept override - { - auto queryIdStr = ToString(queryId); - auto* bridgeQueryResult = BridgeGetProgress(BridgePlugin_, queryIdStr.data()); - TQueryResult queryResult{ - .Plan = ToString(bridgeQueryResult->Plan, bridgeQueryResult->PlanLength), - .Progress = ToString(bridgeQueryResult->Progress, bridgeQueryResult->ProgressLength), - }; - BridgeFreeQueryResult(bridgeQueryResult); - return queryResult; - } - - TAbortResult Abort(TQueryId queryId) noexcept override - { - auto queryIdStr = ToString(queryId); - auto* bridgeAbortResult = BridgeAbort(BridgePlugin_, queryIdStr.data()); - // COMPAT(gritukan): AbortQuery - if (!bridgeAbortResult) { - return {}; - } - - TAbortResult abortResult{ - .YsonError = ToString(bridgeAbortResult->YsonError, bridgeAbortResult->YsonErrorLength), - }; - BridgeFreeAbortResult(bridgeAbortResult); - return abortResult; - } - - ~TYqlPlugin() override - { - BridgeFreeYqlPlugin(BridgePlugin_); - } - -private: - TBridgeYqlPlugin* BridgePlugin_; -}; - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NBridge - -//////////////////////////////////////////////////////////////////////////////// - -std::unique_ptr<IYqlPlugin> CreateYqlPlugin(TYqlPluginOptions options) noexcept -{ - return std::make_unique<NBridge::TYqlPlugin>(std::move(options)); -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT::NYqlPlugin diff --git a/yt/yql/plugin/bridge/plugin.h b/yt/yql/plugin/bridge/plugin.h deleted file mode 100644 index c930e56ba1..0000000000 --- a/yt/yql/plugin/bridge/plugin.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include <yt/yql/plugin/plugin.h> - -namespace NYT::NYqlPlugin { - -//////////////////////////////////////////////////////////////////////////////// - -std::unique_ptr<IYqlPlugin> CreateYqlPlugin(TYqlPluginOptions options) noexcept; - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT::NYqlPlugin diff --git a/yt/yql/plugin/bridge/ya.make b/yt/yql/plugin/bridge/ya.make deleted file mode 100644 index 3f2bc1fe04..0000000000 --- a/yt/yql/plugin/bridge/ya.make +++ /dev/null @@ -1,12 +0,0 @@ -LIBRARY() - -SRCS( - GLOBAL plugin.cpp -) - -PEERDIR( - yt/yql/plugin - yt/yt/core -) - -END() diff --git a/yt/yql/plugin/native/CMakeLists.txt b/yt/yql/plugin/native/CMakeLists.txt deleted file mode 100644 index d863ebd180..0000000000 --- a/yt/yql/plugin/native/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ - -# 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 "x86_64" AND NOT HAVE_CUDA) - include(CMakeLists.linux-x86_64.txt) -elseif (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 (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") - include(CMakeLists.darwin-arm64.txt) -elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA) - include(CMakeLists.windows-x86_64.txt) -endif() diff --git a/yt/yql/plugin/ya.make b/yt/yql/plugin/ya.make deleted file mode 100644 index 7046752106..0000000000 --- a/yt/yql/plugin/ya.make +++ /dev/null @@ -1,19 +0,0 @@ -LIBRARY() - -SRCS( - plugin.cpp -) - -END() - -RECURSE( - bridge -) - -IF (NOT OPENSOURCE) - # We do not bring YQL with us into open source. - RECURSE( - dynamic - native - ) -ENDIF() |