Skip to content

add ut for incorrect pragma parsing and return error #7153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ydb/core/kqp/provider/yql_kikimr_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ ui64 ParseEnableSpillingNodes(const TString &v) {
if (s.empty()) {
throw yexception() << "Empty value item";
}
auto value = FromStringWithDefault<NYql::TDqSettings::EEnabledSpillingNodes>(
s, NYql::TDqSettings::EEnabledSpillingNodes::None);
auto value = FromString<NYql::TDqSettings::EEnabledSpillingNodes>(s);
res |= ui64(value);
}
return res;
Expand Down
18 changes: 18 additions & 0 deletions ydb/core/kqp/ut/spilling/kqp_scan_spilling_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ NKikimrConfig::TAppConfig AppCfgLowComputeLimits(ui64 reasonableTreshold) {

Y_UNIT_TEST_SUITE(KqpScanSpilling) {

Y_UNIT_TEST(SpillingPragmaParseError) {
Cerr << "cwd: " << NFs::CurrentWorkingDirectory() << Endl;
TKikimrRunner kikimr(AppCfg());

auto db = kikimr.GetQueryClient();
auto query = R"(
--!syntax_v1
PRAGMA ydb.EnableSpillingNodes="GraceJoin1";
select t1.Key, t1.Value, t2.Key, t2.Value
from `/Root/KeyValue` as t1 full join `/Root/KeyValue` as t2 on t1.Value = t2.Value
order by t1.Value
)";

auto explainMode = NYdb::NQuery::TExecuteQuerySettings().ExecMode(NYdb::NQuery::EExecMode::Explain);
auto planres = db.ExecuteQuery(query, NYdb::NQuery::TTxControl::NoTx(), explainMode).ExtractValueSync();
UNIT_ASSERT_VALUES_EQUAL_C(planres.GetStatus(), EStatus::GENERIC_ERROR, planres.GetIssues().ToString());
}

Y_UNIT_TEST_TWIN(SpillingInRuntimeNodes, EnabledSpilling) {
ui64 reasonableTreshold = EnabledSpilling ? 100 : 200_MB;
Cerr << "cwd: " << NFs::CurrentWorkingDirectory() << Endl;
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/yql/providers/dq/common/yql_dq_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ TDqConfiguration::TDqConfiguration() {
if (s.empty()) {
throw yexception() << "Empty value item";
}
auto value = FromStringWithDefault<EEnabledSpillingNodes>(s, EEnabledSpillingNodes::None);
auto value = FromString<EEnabledSpillingNodes>(s);
res |= ui64(value);
}
return res;
Expand Down
Loading