diff --git a/ydb/core/kqp/compile_service/kqp_compile_actor.cpp b/ydb/core/kqp/compile_service/kqp_compile_actor.cpp index d95954062d3a..d072d9e642c0 100644 --- a/ydb/core/kqp/compile_service/kqp_compile_actor.cpp +++ b/ydb/core/kqp/compile_service/kqp_compile_actor.cpp @@ -642,6 +642,7 @@ void ApplyServiceConfig(TKikimrConfiguration& kqpConfig, const TTableServiceConf kqpConfig.ExtractPredicateRangesLimit = serviceConfig.GetExtractPredicateRangesLimit(); kqpConfig.EnablePerStatementQueryExecution = serviceConfig.GetEnablePerStatementQueryExecution(); kqpConfig.EnableCreateTableAs = serviceConfig.GetEnableCreateTableAs(); + kqpConfig.AllowOlapDataQuery = serviceConfig.GetAllowOlapDataQuery(); kqpConfig.EnableOlapSink = serviceConfig.GetEnableOlapSink(); kqpConfig.EnableOltpSink = serviceConfig.GetEnableOltpSink(); kqpConfig.EnableHtapTx = serviceConfig.GetEnableHtapTx(); diff --git a/ydb/core/kqp/compile_service/kqp_compile_service.cpp b/ydb/core/kqp/compile_service/kqp_compile_service.cpp index fab575f53b3d..01d32434aa7a 100644 --- a/ydb/core/kqp/compile_service/kqp_compile_service.cpp +++ b/ydb/core/kqp/compile_service/kqp_compile_service.cpp @@ -295,6 +295,7 @@ class TKqpCompileService : public TActorBootstrapped { bool enableSequences = TableServiceConfig.GetEnableSequences(); bool enableColumnsWithDefault = TableServiceConfig.GetEnableColumnsWithDefault(); + bool allowOlapDataQuery = TableServiceConfig.GetAllowOlapDataQuery(); bool enableOlapSink = TableServiceConfig.GetEnableOlapSink(); bool enableOltpSink = TableServiceConfig.GetEnableOltpSink(); bool enableHtapTx = TableServiceConfig.GetEnableHtapTx(); @@ -329,6 +330,7 @@ class TKqpCompileService : public TActorBootstrapped { TableServiceConfig.GetIndexAutoChooseMode() != indexAutoChooser || TableServiceConfig.GetEnableSequences() != enableSequences || TableServiceConfig.GetEnableColumnsWithDefault() != enableColumnsWithDefault || + TableServiceConfig.GetAllowOlapDataQuery() != allowOlapDataQuery || TableServiceConfig.GetEnableOlapSink() != enableOlapSink || TableServiceConfig.GetEnableOltpSink() != enableOltpSink || TableServiceConfig.GetEnableHtapTx() != enableHtapTx || diff --git a/ydb/core/kqp/executer_actor/kqp_data_executer.cpp b/ydb/core/kqp/executer_actor/kqp_data_executer.cpp index 27b0b948409e..1fccc825b431 100644 --- a/ydb/core/kqp/executer_actor/kqp_data_executer.cpp +++ b/ydb/core/kqp/executer_actor/kqp_data_executer.cpp @@ -142,6 +142,7 @@ class TKqpDataExecuter : public TKqpExecuterBase FederatedQuerySetup; const TGUCSettings::TPtr GUCSettings; TShardIdToTableInfoPtr ShardIdToTableInfo; + const bool AllowOlapDataQuery = false; bool HasExternalSources = false; bool SecretSnapshotRequired = false; diff --git a/ydb/core/kqp/opt/kqp_opt.cpp b/ydb/core/kqp/opt/kqp_opt.cpp index 8af6ac69ad4b..0c153b525efa 100644 --- a/ydb/core/kqp/opt/kqp_opt.cpp +++ b/ydb/core/kqp/opt/kqp_opt.cpp @@ -83,7 +83,8 @@ bool IsKqpEffectsStage(const TDqStageBase& stage) { } bool NeedSinks(const TKikimrTableDescription& table, const TKqpOptimizeContext& kqpCtx) { - return (kqpCtx.IsGenericQuery() || (kqpCtx.IsDataQuery() && table.Metadata->Kind != EKikimrTableKind::Olap)) + return (kqpCtx.IsGenericQuery() + || (kqpCtx.IsDataQuery() && (table.Metadata->Kind != EKikimrTableKind::Olap || kqpCtx.Config->AllowOlapDataQuery))) && (table.Metadata->Kind != EKikimrTableKind::Olap || kqpCtx.Config->EnableOlapSink) && (table.Metadata->Kind != EKikimrTableKind::Datashard || kqpCtx.Config->EnableOltpSink); } diff --git a/ydb/core/kqp/provider/yql_kikimr_settings.h b/ydb/core/kqp/provider/yql_kikimr_settings.h index 9d81e3f2fa6d..11a6f8d2b1c3 100644 --- a/ydb/core/kqp/provider/yql_kikimr_settings.h +++ b/ydb/core/kqp/provider/yql_kikimr_settings.h @@ -168,6 +168,7 @@ struct TKikimrConfiguration : public TKikimrSettings, public NCommon::TSettingDi bool EnablePerStatementQueryExecution = false; bool EnableCreateTableAs = false; ui64 IdxLookupJoinsPrefixPointLimit = 1; + bool AllowOlapDataQuery = false; bool EnableOlapSink = false; bool EnableOltpSink = false; bool EnableHtapTx = false; diff --git a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp index 93e1d345b929..f4f8060f3d1b 100644 --- a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp +++ b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp @@ -1820,7 +1820,11 @@ Y_UNIT_TEST_SUITE(KqpOlap) { } void TestOlapUpsert(ui32 numShards) { + NKikimrConfig::TAppConfig appConfig; + appConfig.MutableTableServiceConfig()->SetEnableOlapSink(true); + appConfig.MutableTableServiceConfig()->SetAllowOlapDataQuery(true); auto settings = TKikimrSettings() + .SetAppConfig(appConfig) .SetWithSampleTables(false); TKikimrRunner kikimr(settings); @@ -1868,22 +1872,15 @@ Y_UNIT_TEST_SUITE(KqpOlap) { UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString()); TString result = StreamResultToYson(it); Cout << result << Endl; - //CompareYson(result, R"([[0;15];[1;15]])"); - CompareYson(result, R"([])"); // FIXME + CompareYson(result, R"([[15;0];[15;1]])"); } } Y_UNIT_TEST(OlapUpsertImmediate) { - // Should be fixed in KIKIMR-17646 - return; - TestOlapUpsert(1); } Y_UNIT_TEST(OlapUpsert) { - // Should be fixed in KIKIMR-17646 - return; - TestOlapUpsert(2); } diff --git a/ydb/core/protos/table_service_config.proto b/ydb/core/protos/table_service_config.proto index a47e91112e69..d6722a6759ba 100644 --- a/ydb/core/protos/table_service_config.proto +++ b/ydb/core/protos/table_service_config.proto @@ -347,4 +347,6 @@ message TTableServiceConfig { } optional EBlockTrackingMode BlockTrackingMode = 73 [ default = BLOCK_TRACKING_SERIALIZE ]; + + optional bool AllowOlapDataQuery = 74 [default = false]; };