blob: 46a08ba5e704ecc784afc3d1d0dd45bb4c2acb38 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#pragma once
#include <util/generic/hash.h>
#include <util/generic/string.h>
#include <library/cpp/logger/log.h>
#include <library/cpp/yt/yson_string/string.h>
#include <optional>
namespace NYT::NYqlPlugin {
using namespace NYson;
////////////////////////////////////////////////////////////////////////////////
class TYqlPluginOptions
{
public:
TString MRJobBinary = "./mrjob";
TString UdfDirectory;
//! Mapping cluster name -> proxy address.
THashMap<TString, TString> Clusters;
std::optional<TString> DefaultCluster;
TYsonString OperationAttributes;
TString YTTokenPath;
THolder<TLogBackend> LogBackend;
std::optional<TString> YqlPluginSharedLibrary;
};
struct TQueryResult
{
std::optional<TString> YsonResult;
std::optional<TString> Plan;
std::optional<TString> Statistics;
std::optional<TString> TaskInfo;
//! YSON representation of a YT error.
std::optional<TString> YsonError;
};
//! This interface encapsulates YT <-> YQL integration.
//! There are two major implementation: one of them is based
//! on YQL code and another wraps the pure C bridge interface, which
//! is implemented by a dynamic library.
struct IYqlPlugin
{
virtual TQueryResult Run(TString impersonationUser, TString queryText, TYsonString settings) noexcept = 0;
virtual ~IYqlPlugin() = default;
};
////////////////////////////////////////////////////////////////////////////////
Y_WEAK std::unique_ptr<IYqlPlugin> CreateYqlPlugin(TYqlPluginOptions& options) noexcept;
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NYqlPlugin
|