Skip to content

Commit 214bede

Browse files
gridnevvvitlll-phill-lll
authored andcommitted
add ut for incorrect pragma parsing and return error (#7153)
1 parent d4bcd02 commit 214bede

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

ydb/core/kqp/provider/yql_kikimr_settings.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ ui64 ParseEnableSpillingNodes(const TString &v) {
3434
if (s.empty()) {
3535
throw yexception() << "Empty value item";
3636
}
37-
auto value = FromStringWithDefault<NYql::TDqSettings::EEnabledSpillingNodes>(
38-
s, NYql::TDqSettings::EEnabledSpillingNodes::None);
37+
auto value = FromString<NYql::TDqSettings::EEnabledSpillingNodes>(s);
3938
res |= ui64(value);
4039
}
4140
return res;

ydb/core/kqp/ut/spilling/kqp_scan_spilling_ut.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,24 @@ NKikimrConfig::TAppConfig AppCfgLowComputeLimits(ui64 reasonableTreshold) {
5454

5555
Y_UNIT_TEST_SUITE(KqpScanSpilling) {
5656

57+
Y_UNIT_TEST(SpillingPragmaParseError) {
58+
Cerr << "cwd: " << NFs::CurrentWorkingDirectory() << Endl;
59+
TKikimrRunner kikimr(AppCfg());
60+
61+
auto db = kikimr.GetQueryClient();
62+
auto query = R"(
63+
--!syntax_v1
64+
PRAGMA ydb.EnableSpillingNodes="GraceJoin1";
65+
select t1.Key, t1.Value, t2.Key, t2.Value
66+
from `/Root/KeyValue` as t1 full join `/Root/KeyValue` as t2 on t1.Value = t2.Value
67+
order by t1.Value
68+
)";
69+
70+
auto explainMode = NYdb::NQuery::TExecuteQuerySettings().ExecMode(NYdb::NQuery::EExecMode::Explain);
71+
auto planres = db.ExecuteQuery(query, NYdb::NQuery::TTxControl::NoTx(), explainMode).ExtractValueSync();
72+
UNIT_ASSERT_VALUES_EQUAL_C(planres.GetStatus(), EStatus::GENERIC_ERROR, planres.GetIssues().ToString());
73+
}
74+
5775
Y_UNIT_TEST_TWIN(SpillingInRuntimeNodes, EnabledSpilling) {
5876
ui64 reasonableTreshold = EnabledSpilling ? 100 : 200_MB;
5977
Cerr << "cwd: " << NFs::CurrentWorkingDirectory() << Endl;

ydb/library/yql/providers/dq/common/yql_dq_settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ TDqConfiguration::TDqConfiguration() {
110110
if (s.empty()) {
111111
throw yexception() << "Empty value item";
112112
}
113-
auto value = FromStringWithDefault<EEnabledSpillingNodes>(s, EEnabledSpillingNodes::None);
113+
auto value = FromString<EEnabledSpillingNodes>(s);
114114
res |= ui64(value);
115115
}
116116
return res;

0 commit comments

Comments
 (0)