aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/core/kqp/provider/yql_kikimr_settings.cpp
blob: 74e1439c7f53dd38a9efd29bb8c17cfd64b67ff2 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#include "yql_kikimr_settings.h"

#include <ydb/core/protos/config.pb.h>

namespace NYql {

using namespace NCommon;

namespace {

template <typename TType>
EOptionalFlag GetOptionalFlagValue(const TMaybe<TType>& flag) {
    if (!flag) {
        return EOptionalFlag::Auto;
    }

    if (flag.GetRef()) {
        return EOptionalFlag::Enabled;
    }

    return EOptionalFlag::Disabled;
}

static inline bool GetFlagValue(const TMaybe<bool>& flag) {
    return flag ? flag.GetRef() : false;
}

} // anonymous namespace end

TKikimrConfiguration::TKikimrConfiguration() {
    /* KQP */
    REGISTER_SETTING(*this, _KqpSessionIdleTimeoutSec);
    REGISTER_SETTING(*this, _KqpMaxActiveTxPerSession);
    REGISTER_SETTING(*this, _KqpTxIdleTimeoutSec);
    REGISTER_SETTING(*this, _KqpExprNodesAllocationLimit);
    REGISTER_SETTING(*this, _KqpExprStringsAllocationLimit);
    REGISTER_SETTING(*this, _KqpTablePathPrefix);
    REGISTER_SETTING(*this, _KqpSlowLogWarningThresholdMs);
    REGISTER_SETTING(*this, _KqpSlowLogNoticeThresholdMs);
    REGISTER_SETTING(*this, _KqpSlowLogTraceThresholdMs);
    REGISTER_SETTING(*this, _KqpYqlSyntaxVersion);
    REGISTER_SETTING(*this, _KqpAllowUnsafeCommit);
    REGISTER_SETTING(*this, _KqpMaxComputeActors);
    REGISTER_SETTING(*this, _KqpEnableSpilling);
    REGISTER_SETTING(*this, _KqpDisableLlvmForUdfStages);

    REGISTER_SETTING(*this, KqpPushOlapProcess);

    /* Compile time */
    REGISTER_SETTING(*this, _CommitPerShardKeysSizeLimitBytes);
    REGISTER_SETTING(*this, _DefaultCluster);
    REGISTER_SETTING(*this, _ResultRowsLimit);
    REGISTER_SETTING(*this, EnableSystemColumns);
    REGISTER_SETTING(*this, UseLlvm);
    REGISTER_SETTING(*this, EnableLlvm);
    REGISTER_SETTING(*this, HashJoinMode).Parser([](const TString& v) { return FromString<NDq::EHashJoinMode>(v); });

    REGISTER_SETTING(*this, OptDisableJoinRewrite);
    REGISTER_SETTING(*this, OptDisableJoinTableLookup);
    REGISTER_SETTING(*this, OptDisableJoinReverseTableLookup);
    REGISTER_SETTING(*this, OptDisableJoinReverseTableLookupLeftSemi);
    REGISTER_SETTING(*this, OptDisableTopSort);
    REGISTER_SETTING(*this, OptDisableSqlInToJoin);
    REGISTER_SETTING(*this, OptEnableInplaceUpdate);
    REGISTER_SETTING(*this, OptEnablePredicateExtract);
    REGISTER_SETTING(*this, OptEnableOlapPushdown);
    REGISTER_SETTING(*this, OptEnableOlapProvideComputeSharding);
    
    REGISTER_SETTING(*this, OptUseFinalizeByKey);
    REGISTER_SETTING(*this, OptEnableCostBasedOptimization);

    REGISTER_SETTING(*this, MaxTasksPerStage);

    /* Runtime */
    REGISTER_SETTING(*this, ScanQuery);

    IndexAutoChooserMode = NKikimrConfig::TTableServiceConfig_EIndexAutoChooseMode_DISABLED;
}

bool TKikimrSettings::HasAllowKqpUnsafeCommit() const {
    return GetFlagValue(_KqpAllowUnsafeCommit.Get());
}

bool TKikimrSettings::HasDefaultCluster() const {
    return _DefaultCluster.Get() && !_DefaultCluster.Get().GetRef().empty();
}

bool TKikimrSettings::SystemColumnsEnabled() const {
    return GetFlagValue(EnableSystemColumns.Get());
}

bool TKikimrSettings::SpillingEnabled() const {
    return GetFlagValue(_KqpEnableSpilling.Get());
}

bool TKikimrSettings::DisableLlvmForUdfStages() const {
    return GetFlagValue(_KqpDisableLlvmForUdfStages.Get());
}

bool TKikimrSettings::HasOptDisableJoinRewrite() const {
    return GetFlagValue(OptDisableJoinRewrite.Get());
}

bool TKikimrSettings::HasOptDisableJoinTableLookup() const {
    return GetFlagValue(OptDisableJoinTableLookup.Get());
}

bool TKikimrSettings::HasOptDisableJoinReverseTableLookup() const {
    return GetFlagValue(OptDisableJoinReverseTableLookup.Get());
}

bool TKikimrSettings::HasOptDisableJoinReverseTableLookupLeftSemi() const {
    return GetFlagValue(OptDisableJoinReverseTableLookupLeftSemi.Get());
}

bool TKikimrSettings::HasOptDisableTopSort() const {
    return GetFlagValue(OptDisableTopSort.Get());
}

bool TKikimrSettings::HasOptDisableSqlInToJoin() const {
    return GetFlagValue(OptDisableSqlInToJoin.Get());
}

bool TKikimrSettings::HasOptEnableInplaceUpdate() const {
    return GetFlagValue(OptEnableInplaceUpdate.Get());
}

bool TKikimrSettings::HasOptEnableOlapPushdown() const {
    return GetOptionalFlagValue(OptEnableOlapPushdown.Get()) != EOptionalFlag::Disabled;
}

bool TKikimrSettings::HasOptEnableOlapProvideComputeSharding() const {
    return GetOptionalFlagValue(OptEnableOlapProvideComputeSharding.Get()) == EOptionalFlag::Enabled;
}

bool TKikimrSettings::HasOptUseFinalizeByKey() const {
    return GetOptionalFlagValue(OptUseFinalizeByKey.Get()) != EOptionalFlag::Disabled;
}

bool TKikimrSettings::HasOptEnableCostBasedOptimization() const {
    return GetOptionalFlagValue(OptEnableCostBasedOptimization.Get()) == EOptionalFlag::Enabled;
}


EOptionalFlag TKikimrSettings::GetOptPredicateExtract() const {
    return GetOptionalFlagValue(OptEnablePredicateExtract.Get());
}

EOptionalFlag TKikimrSettings::GetUseLlvm() const {
    auto optionalFlag = GetOptionalFlagValue(UseLlvm.Get());
    if (optionalFlag == EOptionalFlag::Auto) {
        optionalFlag = GetOptionalFlagValue(EnableLlvm.Get());
    }
    return optionalFlag;
}

NDq::EHashJoinMode TKikimrSettings::GetHashJoinMode() const {
    auto maybeHashJoinMode = HashJoinMode.Get();
    return maybeHashJoinMode ? *maybeHashJoinMode : NDq::EHashJoinMode::Off;
}

TKikimrSettings::TConstPtr TKikimrConfiguration::Snapshot() const {
    return std::make_shared<const TKikimrSettings>(*this);
}

}