aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/providers/common/config/yql_configuration_transformer.h
blob: 64622c463c9b20b0f3c9fe039612d3c7fa32a6e7 (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
#pragma once

#include "yql_dispatch.h"

#include <yql/essentials/core/yql_type_annotation.h>

#include <util/generic/ptr.h>
#include <util/generic/string.h>
#include <util/generic/hash_set.h>
#include <util/generic/strbuf.h>

namespace NYql {
namespace NCommon {

class TProviderConfigurationTransformer : public TSyncTransformerBase {
public:
    TProviderConfigurationTransformer(TSettingDispatcher::TPtr dispatcher,const TTypeAnnotationContext& types,
        const TString& provider, const THashSet<TStringBuf>& configureCallables = {});

    TStatus DoTransform(TExprNode::TPtr input, TExprNode::TPtr& output, TExprContext& ctx) final;
    void Rewind() final {
    }

protected:
    virtual bool HandleAttr(TPositionHandle pos, const TString& cluster, const TString& name,
        const TMaybe<TString>& value, TExprContext& ctx);
    virtual bool HandleAuth(TPositionHandle pos, const TString& cluster, const TString& alias, TExprContext& ctx);

protected:
    TSettingDispatcher::TPtr Dispatcher;
    const TTypeAnnotationContext& Types;
    TString Provider;
    THashSet<TStringBuf> ConfigureCallables;
};

THolder<IGraphTransformer> CreateProviderConfigurationTransformer(
    TSettingDispatcher::TPtr dispatcher,
    const TTypeAnnotationContext& types,
    const TString& provider
);

} // namespace NCommon
} // namespace NYql