Skip to content

Commit dcd610e

Browse files
author
Pavel Velikhov
committed
Update before rebased
1 parent 5aeef9b commit dcd610e

File tree

4 files changed

+58
-11
lines changed

4 files changed

+58
-11
lines changed

ydb/core/kqp/compile_service/kqp_compile_actor.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,15 @@ void ApplyServiceConfig(TKikimrConfiguration& kqpConfig, const TTableServiceConf
709709
kqpConfig.DefaultHashShuffleFuncType = NYql::NDq::EHashShuffleFuncType::HashV2;
710710
break;
711711
}
712+
713+
switch(serviceConfig.GetBackportMode()) {
714+
case NKikimrConfig::TTableServiceConfig_EBackportMode_Released:
715+
kqpConfig.BackportMode = NYql::EBackportCompatibleFeaturesMode::Released;
716+
break;
717+
case NKikimrConfig::TTableServiceConfig_EBackportMode_All:
718+
kqpConfig.BackportMode = NYql::EBackportCompatibleFeaturesMode::All;
719+
break;
720+
}
712721
}
713722

714723
IActor* CreateKqpCompileActor(const TActorId& owner, const TKqpSettings::TConstPtr& kqpSettings,

ydb/core/kqp/ut/rbo/kqp_rbo_yql_ut.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Y_UNIT_TEST_SUITE(KqpRboYql) {
6969
Y_UNIT_TEST(Select) {
7070
NKikimrConfig::TAppConfig appConfig;
7171
appConfig.MutableTableServiceConfig()->SetEnableNewRBO(true);
72+
appConfig.MutableTableServiceConfig()->SetBackportMode(NKikimrConfig::TTableServiceConfig_EBackportMode_All);
7273
TKikimrRunner kikimr(NKqp::TKikimrSettings(appConfig).SetWithSampleTables(false));
7374
auto db = kikimr.GetTableClient();
7475
auto session = db.CreateSession().GetValueSync().GetSession();
@@ -84,6 +85,7 @@ Y_UNIT_TEST_SUITE(KqpRboYql) {
8485
Y_UNIT_TEST(Filter) {
8586
NKikimrConfig::TAppConfig appConfig;
8687
appConfig.MutableTableServiceConfig()->SetEnableNewRBO(true);
88+
appConfig.MutableTableServiceConfig()->SetBackportMode(NKikimrConfig::TTableServiceConfig_EBackportMode_All);
8789
TKikimrRunner kikimr(NKqp::TKikimrSettings(appConfig).SetWithSampleTables(false));
8890
auto db = kikimr.GetTableClient();
8991
auto session = db.CreateSession().GetValueSync().GetSession();
@@ -140,6 +142,7 @@ Y_UNIT_TEST_SUITE(KqpRboYql) {
140142
Y_UNIT_TEST(ConstantFolding) {
141143
NKikimrConfig::TAppConfig appConfig;
142144
appConfig.MutableTableServiceConfig()->SetEnableNewRBO(true);
145+
appConfig.MutableTableServiceConfig()->SetBackportMode(NKikimrConfig::TTableServiceConfig_EBackportMode_All);
143146
TKikimrRunner kikimr(NKqp::TKikimrSettings(appConfig).SetWithSampleTables(false));
144147
auto db = kikimr.GetTableClient();
145148
auto session = db.CreateSession().GetValueSync().GetSession();

ydb/core/protos/table_service_config.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,4 +437,11 @@ message TTableServiceConfig {
437437
optional bool EnableDqHashCombineByDefault = 105 [default = true, (InvalidateCompileCache) = true];
438438

439439
optional bool EnableBuildAggregationResultStages = 106 [default = true, (InvalidateCompileCache) = true];
440+
441+
enum EBackportMode {
442+
Released = 0;
443+
All = 1;
444+
}
445+
446+
optional EBackportMode BackportMode = 107 [ default = Released, (InvalidateCompileCache) = true];
440447
};

yql/essentials/sql/v1/sql_query.cpp

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,19 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
266266
return false;
267267
}
268268

269-
if (Ctx_.YqlSelectMode != EYqlSelectMode::Disable) {
270-
//if (!IsBackwardCompatibleFeatureAvailable(MakeLangVersion(2025, 04))) {
271-
// Error() << "YqlSelect is not available before 2025.04";
272-
// return false;
273-
//}
269+
if (Ctx_.GetYqlSelectMode() != EYqlSelectMode::Disable) {
270+
if (!IsBackwardCompatibleFeatureAvailable(MakeLangVersion(2025, 04))) {
271+
Error() << "YqlSelect is not available before 2025.04";
272+
return false;
273+
}
274274

275275
const auto stmt = core.GetAlt_sql_stmt_core2().GetRule_select_stmt1();
276276
if (auto result = BuildYqlSelect(Ctx_, Mode_, stmt)) {
277277
blocks.emplace_back(std::move(*result));
278278
break;
279279
} else if (
280280
result.error() == EYqlSelectError::Unsupported &&
281-
Ctx_.YqlSelectMode == EYqlSelectMode::Force)
281+
Ctx_.GetYqlSelectMode() == EYqlSelectMode::Force)
282282
{
283283
Error() << "Translation of the statement "
284284
<< "to YqlSelect was forced, but unsupported";
@@ -672,6 +672,28 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
672672
return false;
673673
}
674674

675+
if (Ctx_.GetYqlSelectMode() != EYqlSelectMode::Disable) {
676+
const auto langVer = GetMaxLangVersion();
677+
if (!IsBackwardCompatibleFeatureAvailable(langVer)) {
678+
Error() << "YqlSelect is not available before "
679+
<< FormatLangVersion(langVer);
680+
return false;
681+
}
682+
683+
const auto stmt = core.GetAlt_sql_stmt_core21().GetRule_values_stmt1();
684+
if (auto result = BuildYqlSelect(Ctx_, Mode_, stmt)) {
685+
blocks.emplace_back(std::move(*result));
686+
break;
687+
} else if (
688+
result.error() == EYqlSelectError::Unsupported &&
689+
Ctx_.GetYqlSelectMode() == EYqlSelectMode::Force)
690+
{
691+
Error() << "Translation of the statement "
692+
<< "to YqlSelect was forced, but unsupported";
693+
return false;
694+
}
695+
}
696+
675697
Ctx_.BodyPart();
676698
TSqlValues values(Ctx_, Mode_);
677699
TPosition pos;
@@ -3541,6 +3563,14 @@ THashMap<TString, TPragmaDescr> PragmaDescrs{
35413563
}),
35423564
TableElemExt("YqlSelect", [](CB_SIG) -> TMaybe<TNodePtr> {
35433565
auto& ctx = query.Context();
3566+
if (!IsBackwardCompatibleFeatureAvailable(
3567+
ctx.Settings.LangVer,
3568+
MakeLangVersion(2025, 04),
3569+
ctx.Settings.BackportMode))
3570+
{
3571+
query.Error() << "YqlSelect is not available before 2025.04";
3572+
return Nothing();
3573+
}
35443574

35453575
const TString* literal = values.size() == 1 ? values[0].GetLiteral() : nullptr;
35463576
if (!literal) {
@@ -3549,19 +3579,17 @@ THashMap<TString, TPragmaDescr> PragmaDescrs{
35493579
}
35503580

35513581
if (*literal == "disable") {
3552-
ctx.YqlSelectMode = EYqlSelectMode::Disable;
3582+
ctx.SetYqlSelectMode(EYqlSelectMode::Disable);
35533583
} else if (*literal == "auto") {
3554-
ctx.YqlSelectMode = EYqlSelectMode::Auto;
3584+
ctx.SetYqlSelectMode(EYqlSelectMode::Auto);
35553585
} else if (*literal == "force") {
3556-
ctx.YqlSelectMode = EYqlSelectMode::Force;
3586+
ctx.SetYqlSelectMode(EYqlSelectMode::Force);
35573587
} else {
35583588
query.Error() << "Unexpected literal '" << *literal << "' for: " << pragma
35593589
<< ", expected 'disable', 'auto' or 'force'";
35603590
return Nothing();
35613591
}
35623592

3563-
ctx.DeriveColumnOrder = true;
3564-
35653593
return TNodePtr();
35663594
}),
35673595

0 commit comments

Comments
 (0)