diff options
author | ssmike <ssmike@ydb.tech> | 2023-11-21 18:15:47 +0300 |
---|---|---|
committer | ssmike <ssmike@ydb.tech> | 2023-11-21 20:45:08 +0300 |
commit | 59bdfcec4de8f80b043d15ba476ada32d2af09e0 (patch) | |
tree | 6c922ab6e13e9be4ccad9f6616cdd3af6c47dae1 | |
parent | abfcda063d633165f7bd4eecfff57c15c9fd5f0a (diff) | |
download | ydb-59bdfcec4de8f80b043d15ba476ada32d2af09e0.tar.gz |
Add ranges limit option
5 files changed, 16 insertions, 3 deletions
diff --git a/ydb/core/kqp/compile_service/kqp_compile_actor.cpp b/ydb/core/kqp/compile_service/kqp_compile_actor.cpp index f6b3c6b71e..91d2a8a0c8 100644 --- a/ydb/core/kqp/compile_service/kqp_compile_actor.cpp +++ b/ydb/core/kqp/compile_service/kqp_compile_actor.cpp @@ -503,6 +503,7 @@ void ApplyServiceConfig(TKikimrConfiguration& kqpConfig, const TTableServiceConf kqpConfig.PredicateExtract20 = serviceConfig.GetPredicateExtract20(); kqpConfig.IndexAutoChooserMode = serviceConfig.GetIndexAutoChooseMode(); kqpConfig.EnablePgConstsToParams = serviceConfig.GetEnablePgConstsToParams(); + kqpConfig.ExtractPredicateRangesLimit = serviceConfig.GetExtractPredicateRangesLimit(); } IActor* CreateKqpCompileActor(const TActorId& owner, const TKqpSettings::TConstPtr& kqpSettings, @@ -513,7 +514,7 @@ IActor* CreateKqpCompileActor(const TActorId& owner, const TKqpSettings::TConstP const TString& uid, const TKqpQueryId& query, const TIntrusiveConstPtr<NACLib::TUserToken>& userToken, std::optional<TKqpFederatedQuerySetup> federatedQuerySetup, TKqpDbCountersPtr dbCounters, const TIntrusivePtr<TUserRequestContext>& userRequestContext, - NWilson::TTraceId traceId, TKqpTempTablesState::TConstPtr tempTablesState, + NWilson::TTraceId traceId, TKqpTempTablesState::TConstPtr tempTablesState, ECompileActorAction compileAction, TMaybe<TQueryAst> astResult, bool collectFullDiagnostics) { return new TKqpCompileActor(owner, kqpSettings, tableServiceConfig, queryServiceConfig, metadataProviderConfig, diff --git a/ydb/core/kqp/compile_service/kqp_compile_service.cpp b/ydb/core/kqp/compile_service/kqp_compile_service.cpp index eb2b7d2e10..b883886195 100644 --- a/ydb/core/kqp/compile_service/kqp_compile_service.cpp +++ b/ydb/core/kqp/compile_service/kqp_compile_service.cpp @@ -473,6 +473,8 @@ private: auto indexAutoChooser = TableServiceConfig.GetIndexAutoChooseMode(); + ui64 rangesLimit = TableServiceConfig.GetExtractPredicateRangesLimit(); + bool enableSequences = TableServiceConfig.GetEnableSequences(); bool enableColumnsWithDefault = TableServiceConfig.GetEnableColumnsWithDefault(); @@ -496,7 +498,8 @@ private: TableServiceConfig.GetEnableKqpImmediateEffects() != enableKqpImmediateEffects || TableServiceConfig.GetIndexAutoChooseMode() != indexAutoChooser || TableServiceConfig.GetEnableSequences() != enableSequences || - TableServiceConfig.GetEnableColumnsWithDefault() != enableColumnsWithDefault) { + TableServiceConfig.GetEnableColumnsWithDefault() != enableColumnsWithDefault || + TableServiceConfig.GetExtractPredicateRangesLimit() != rangesLimit) { QueryCache.Clear(); @@ -748,7 +751,7 @@ private: if (ev->Get()->ReplayMessage) { QueryReplayBackend->Collect(*ev->Get()->ReplayMessage); } - + auto requests = RequestsQueue.ExtractByQuery(*compileResult->Query); for (auto& request : requests) { LWTRACK(KqpCompileServiceGetCompilation, request.Orbit, request.Query.UserSid, compileActorId.ToString()); diff --git a/ydb/core/kqp/opt/logical/kqp_opt_log_ranges_predext.cpp b/ydb/core/kqp/opt/logical/kqp_opt_log_ranges_predext.cpp index 2dc178460d..a60308ebdd 100644 --- a/ydb/core/kqp/opt/logical/kqp_opt_log_ranges_predext.cpp +++ b/ydb/core/kqp/opt/logical/kqp_opt_log_ranges_predext.cpp @@ -237,6 +237,12 @@ TExprBase KqpPushExtractedPredicateToReadTable(TExprBase node, TExprContext& ctx settings.HaveNextValueCallable = true; settings.BuildLiteralRange = true; + if (kqpCtx.Config->ExtractPredicateRangesLimit != 0) { + settings.MaxRanges = kqpCtx.Config->ExtractPredicateRangesLimit; + } else { + settings.MaxRanges = Nothing(); + } + if (!kqpCtx.Config->PredicateExtract20) { // test for trivial cases (explicit literals or parameters) auto& tableDesc = indexName diff --git a/ydb/core/kqp/provider/yql_kikimr_settings.h b/ydb/core/kqp/provider/yql_kikimr_settings.h index 0e0b23b7ca..10ecda55e6 100644 --- a/ydb/core/kqp/provider/yql_kikimr_settings.h +++ b/ydb/core/kqp/provider/yql_kikimr_settings.h @@ -161,6 +161,7 @@ struct TKikimrConfiguration : public TKikimrSettings, public NCommon::TSettingDi NKikimrConfig::TTableServiceConfig_EIndexAutoChooseMode IndexAutoChooserMode; bool EnableAstCache = false; bool EnablePgConstsToParams = false; + ui64 ExtractPredicateRangesLimit = 0; }; } diff --git a/ydb/core/protos/table_service_config.proto b/ydb/core/protos/table_service_config.proto index 6971597554..5ca397d677 100644 --- a/ydb/core/protos/table_service_config.proto +++ b/ydb/core/protos/table_service_config.proto @@ -270,4 +270,6 @@ message TTableServiceConfig { optional bool EnableAstCache = 52 [default = false]; optional bool EnablePgConstsToParams = 53 [default = false]; + + optional uint64 ExtractPredicateRangesLimit = 54 [default = 10000]; }; |