aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/core/kqp/provider/yql_kikimr_settings.cpp
blob: ebd392e16c1c47f7f1016ef24ede8b3a8e72394f (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#include "yql_kikimr_settings.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, _KqpQueryTimeoutSec);
    REGISTER_SETTING(*this, _KqpSessionIdleTimeoutSec);
    REGISTER_SETTING(*this, _KqpMaxActiveTxPerSession);
    REGISTER_SETTING(*this, _KqpTxIdleTimeoutSec);
    REGISTER_SETTING(*this, _KqpRollbackInvalidatedTx);
    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, _KqpAllowNewEngine);
    REGISTER_SETTING(*this, _KqpForceNewEngine);
    REGISTER_SETTING(*this, _KqpAllowUnsafeCommit);
    REGISTER_SETTING(*this, _KqpMaxComputeActors);
    REGISTER_SETTING(*this, _KqpEnableSpilling);
    REGISTER_SETTING(*this, _KqpDisableLlvmForUdfStages);
    REGISTER_SETTING(*this, _KqpPushOlapProcess);
    REGISTER_SETTING(*this, KqpPushOlapProcess);

    /* Compile time */
    REGISTER_SETTING(*this, _CommitPerShardKeysSizeLimitBytes);
    REGISTER_SETTING(*this, _CommitReadsLimit);
    REGISTER_SETTING(*this, _DefaultCluster);
    REGISTER_SETTING(*this, _ResultRowsLimit);
    REGISTER_SETTING(*this, _AllowReverseRange);
    REGISTER_SETTING(*this, CommitSafety).Enum({"Full", "Safe", "Moderate"});
    REGISTER_SETTING(*this, UseNewEngine);
    REGISTER_SETTING(*this, UnwrapReadTableValues);
    REGISTER_SETTING(*this, AllowNullCompareInIndex);
    REGISTER_SETTING(*this, EnableSystemColumns);
    REGISTER_SETTING(*this, EnableLlvm);

    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);

    /* Runtime */
    REGISTER_SETTING(*this, _RestrictModifyPermissions);
    REGISTER_SETTING(*this, _UseLocalProvider);
    REGISTER_SETTING(*this, IsolationLevel).Enum({"ReadStale", "ReadUncommitted", "ReadCommitted", "Serializable"});
    REGISTER_SETTING(*this, Profile);
    REGISTER_SETTING(*this, StrictDml);
    REGISTER_SETTING(*this, ScanQuery);
}

bool TKikimrSettings::HasAllowNullCompareInIndex() const {
    return GetFlagValue(AllowNullCompareInIndex.Get());
}

bool TKikimrSettings::HasUnwrapReadTableValues() const {
    return GetFlagValue(UnwrapReadTableValues.Get());
}

bool TKikimrSettings::HasAllowKqpNewEngine() const {
    return GetFlagValue(_KqpAllowNewEngine.Get());
}

bool TKikimrSettings::HasKqpForceNewEngine() const {
    return GetFlagValue(_KqpForceNewEngine.Get());
}

bool TKikimrSettings::HasUseNewEngine() const {
    return GetFlagValue(UseNewEngine.Get());
}

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

bool TKikimrSettings::AllowReverseRange() const {
    return GetFlagValue(_AllowReverseRange.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::PushOlapProcess() const {
    auto settingsFlag = GetFlagValue(_KqpPushOlapProcess.Get());
    auto runtimeFlag = GetFlagValue(KqpPushOlapProcess.Get());

    // There are no settings or it set to False, but pragma enable pushdown
    if (!settingsFlag && runtimeFlag) {
        return true;
    }

    // Settings are set to True but no pragma present - enable pushdown
    if (settingsFlag && !KqpPushOlapProcess.Get()) {
        return true;
    }

    // Other cases handled by AND
    return settingsFlag && runtimeFlag;
}

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());
}

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

EOptionalFlag TKikimrSettings::GetEnableLlvm() const {
    return GetOptionalFlagValue(EnableLlvm.Get());
}

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

}