aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorulya-sidorina <yulia@ydb.tech>2023-03-16 15:24:07 +0300
committerulya-sidorina <yulia@ydb.tech>2023-03-16 15:24:07 +0300
commitc38d54beb445caeabcb76bd1b5faea7c0ef40068 (patch)
treeb54fd49c9f47288efa7a00164b4954f219c9da42
parente3736cae776451f7494d5e73342c04e88226ab96 (diff)
downloadydb-c38d54beb445caeabcb76bd1b5faea7c0ef40068.tar.gz
enable stream lookup by default
feature(kqp): enable stream lookup by default
-rw-r--r--ydb/core/kqp/compile_service/kqp_compile_actor.cpp1
-rw-r--r--ydb/core/kqp/compile_service/kqp_compile_service.cpp10
-rw-r--r--ydb/core/kqp/opt/logical/kqp_opt_log_join.cpp6
-rw-r--r--ydb/core/kqp/provider/yql_kikimr_settings.h1
-rw-r--r--ydb/core/kqp/runtime/kqp_stream_lookup_actor.cpp2
-rw-r--r--ydb/core/kqp/ut/effects/kqp_inplace_update_ut.cpp3
-rw-r--r--ydb/core/kqp/ut/indexes/kqp_indexes_ut.cpp161
-rw-r--r--ydb/core/kqp/ut/opt/kqp_ne_ut.cpp14
-rw-r--r--ydb/core/kqp/ut/query/kqp_explain_ut.cpp10
-rw-r--r--ydb/core/kqp/ut/scan/kqp_split_ut.cpp1
-rw-r--r--ydb/core/protos/config.proto5
11 files changed, 125 insertions, 89 deletions
diff --git a/ydb/core/kqp/compile_service/kqp_compile_actor.cpp b/ydb/core/kqp/compile_service/kqp_compile_actor.cpp
index b10a43ed2d..c66f0817b5 100644
--- a/ydb/core/kqp/compile_service/kqp_compile_actor.cpp
+++ b/ydb/core/kqp/compile_service/kqp_compile_actor.cpp
@@ -351,6 +351,7 @@ void ApplyServiceConfig(TKikimrConfiguration& kqpConfig, const TTableServiceConf
kqpConfig.EnableKqpDataQueryStreamLookup = serviceConfig.GetEnableKqpDataQueryStreamLookup();
kqpConfig.EnableKqpScanQueryStreamLookup = serviceConfig.GetEnableKqpScanQueryStreamLookup();
kqpConfig.EnableKqpDataQueryStreamPointLookup = serviceConfig.GetEnableKqpDataQueryStreamPointLookup();
+ kqpConfig.EnableKqpScanQueryStreamIdxLookupJoin = serviceConfig.GetEnableKqpScanQueryStreamIdxLookupJoin();
}
IActor* CreateKqpCompileActor(const TActorId& owner, const TKqpSettings::TConstPtr& kqpSettings,
diff --git a/ydb/core/kqp/compile_service/kqp_compile_service.cpp b/ydb/core/kqp/compile_service/kqp_compile_service.cpp
index 2a00c4c885..9ad13e9e66 100644
--- a/ydb/core/kqp/compile_service/kqp_compile_service.cpp
+++ b/ydb/core/kqp/compile_service/kqp_compile_service.cpp
@@ -360,6 +360,7 @@ private:
bool enableKqpDataQueryStreamLookup = Config.GetEnableKqpDataQueryStreamLookup();
bool enableKqpScanQueryStreamLookup = Config.GetEnableKqpScanQueryStreamLookup();
+ bool enableKqpScanQueryStreamIdxLookupJoin = Config.GetEnableKqpScanQueryStreamIdxLookupJoin();
bool enableKqpDataQuerySourceRead = Config.GetEnableKqpDataQuerySourceRead();
bool enableKqpScanQuerySourceRead = Config.GetEnableKqpScanQuerySourceRead();
@@ -372,15 +373,18 @@ private:
if (Config.GetEnableKqpDataQueryStreamLookup() != enableKqpDataQueryStreamLookup ||
Config.GetEnableKqpScanQueryStreamLookup() != enableKqpScanQueryStreamLookup ||
+ Config.GetEnableKqpScanQueryStreamIdxLookupJoin() != enableKqpScanQueryStreamIdxLookupJoin ||
Config.GetEnableKqpDataQuerySourceRead() != enableKqpDataQuerySourceRead ||
Config.GetEnableKqpScanQuerySourceRead() != enableKqpScanQuerySourceRead) {
LOG_NOTICE_S(*TlsActivationContext, NKikimrServices::KQP_COMPILE_SERVICE,
"Iterator read flags was changed. StreamLookup from " << enableKqpDataQueryStreamLookup <<
" to " << Config.GetEnableKqpDataQueryStreamLookup() << " for data queries, from " <<
- enableKqpScanQueryStreamLookup << " to " << Config.GetEnableKqpScanQueryStreamLookup() << " for scan queries."
- << " Sources for data queries from " << enableKqpDataQuerySourceRead << " to " << Config.GetEnableKqpDataQuerySourceRead()
- << "for scan queries from " << enableKqpScanQuerySourceRead << " to " << Config.GetEnableKqpScanQuerySourceRead());
+ enableKqpScanQueryStreamLookup << " to " << Config.GetEnableKqpScanQueryStreamLookup() << ", from "
+ << enableKqpScanQueryStreamIdxLookupJoin << " to " << Config.GetEnableKqpScanQueryStreamIdxLookupJoin()
+ << " scan queries. Sources for data queries from " << enableKqpDataQuerySourceRead << " to "
+ << Config.GetEnableKqpDataQuerySourceRead() << "for scan queries from " << enableKqpScanQuerySourceRead
+ << " to " << Config.GetEnableKqpScanQuerySourceRead());
QueryCache.Clear();
}
diff --git a/ydb/core/kqp/opt/logical/kqp_opt_log_join.cpp b/ydb/core/kqp/opt/logical/kqp_opt_log_join.cpp
index 6edcd849d1..6bc9eee0fb 100644
--- a/ydb/core/kqp/opt/logical/kqp_opt_log_join.cpp
+++ b/ydb/core/kqp/opt/logical/kqp_opt_log_join.cpp
@@ -189,7 +189,7 @@ TExprBase BuildLookupIndex(TExprContext& ctx, const TPositionHandle pos, const T
const TKqpOptimizeContext& kqpCtx)
{
if (kqpCtx.IsScanQuery()) {
- YQL_ENSURE(kqpCtx.Config->EnableKqpScanQueryStreamLookup, "Stream lookup is not enabled");
+ YQL_ENSURE(kqpCtx.Config->EnableKqpScanQueryStreamIdxLookupJoin, "Stream lookup is not enabled for index lookup join");
return Build<TKqlStreamLookupIndex>(ctx, pos)
.Table(read.Table())
.LookupKeys<TCoSkipNullMembers>()
@@ -222,7 +222,7 @@ TExprBase BuildLookupTable(TExprContext& ctx, const TPositionHandle pos, const T
const TExprBase& keysToLookup, const TVector<TCoAtom>& lookupNames, const TKqpOptimizeContext& kqpCtx)
{
if (kqpCtx.IsScanQuery()) {
- YQL_ENSURE(kqpCtx.Config->EnableKqpScanQueryStreamLookup, "Stream lookup is not enabled");
+ YQL_ENSURE(kqpCtx.Config->EnableKqpScanQueryStreamIdxLookupJoin, "Stream lookup is not enabled for index lookup join");
return Build<TKqlStreamLookupTable>(ctx, pos)
.Table(read.Table())
.LookupKeys<TCoSkipNullMembers>()
@@ -607,7 +607,7 @@ TMaybeNode<TExprBase> KqpJoinToIndexLookupImpl(const TDqJoin& join, TExprContext
TExprBase KqpJoinToIndexLookup(const TExprBase& node, TExprContext& ctx, const TKqpOptimizeContext& kqpCtx,
const NYql::TKikimrConfiguration::TPtr& config)
{
- if ((kqpCtx.IsScanQuery() && !kqpCtx.Config->EnableKqpScanQueryStreamLookup) || !node.Maybe<TDqJoin>()) {
+ if ((kqpCtx.IsScanQuery() && !kqpCtx.Config->EnableKqpScanQueryStreamIdxLookupJoin) || !node.Maybe<TDqJoin>()) {
return node;
}
auto join = node.Cast<TDqJoin>();
diff --git a/ydb/core/kqp/provider/yql_kikimr_settings.h b/ydb/core/kqp/provider/yql_kikimr_settings.h
index a78371ee5d..f10ddec1a8 100644
--- a/ydb/core/kqp/provider/yql_kikimr_settings.h
+++ b/ydb/core/kqp/provider/yql_kikimr_settings.h
@@ -134,6 +134,7 @@ struct TKikimrConfiguration : public TKikimrSettings, public NCommon::TSettingDi
bool EnableKqpScanQueryStreamLookup = false;
bool EnableKqpDataQueryStreamLookup = false;
bool EnableKqpDataQueryStreamPointLookup = false;
+ bool EnableKqpScanQueryStreamIdxLookupJoin = false;
};
}
diff --git a/ydb/core/kqp/runtime/kqp_stream_lookup_actor.cpp b/ydb/core/kqp/runtime/kqp_stream_lookup_actor.cpp
index 216684aa4d..f29b446e47 100644
--- a/ydb/core/kqp/runtime/kqp_stream_lookup_actor.cpp
+++ b/ydb/core/kqp/runtime/kqp_stream_lookup_actor.cpp
@@ -20,7 +20,7 @@ namespace NKqp {
namespace {
-static constexpr TDuration SCHEME_CACHE_REQUEST_TIMEOUT = TDuration::Seconds(5);
+static constexpr TDuration SCHEME_CACHE_REQUEST_TIMEOUT = TDuration::Seconds(10);
static constexpr ui64 MAX_SHARD_RETRIES = 10;
class TKqpStreamLookupActor : public NActors::TActorBootstrapped<TKqpStreamLookupActor>, public NYql::NDq::IDqComputeActorAsyncInput {
diff --git a/ydb/core/kqp/ut/effects/kqp_inplace_update_ut.cpp b/ydb/core/kqp/ut/effects/kqp_inplace_update_ut.cpp
index fe160d0228..e1168bbaf4 100644
--- a/ydb/core/kqp/ut/effects/kqp_inplace_update_ut.cpp
+++ b/ydb/core/kqp/ut/effects/kqp_inplace_update_ut.cpp
@@ -40,9 +40,10 @@ void Test(bool enableInplaceUpdate, const TString& query, TParams&& params, cons
setting.SetName("_KqpAllowUnsafeCommit");
setting.SetValue("true");
- // source read use iterator interface, that doesn't use datashard transactions
+ // source read and stream lookup use iterator interface, that doesn't use datashard transactions
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableTableServiceConfig()->SetEnableKqpDataQuerySourceRead(false);
+ appConfig.MutableTableServiceConfig()->SetEnableKqpDataQueryStreamLookup(false);
auto settings = TKikimrSettings()
.SetAppConfig(appConfig)
diff --git a/ydb/core/kqp/ut/indexes/kqp_indexes_ut.cpp b/ydb/core/kqp/ut/indexes/kqp_indexes_ut.cpp
index 1caedc607a..82083c9b42 100644
--- a/ydb/core/kqp/ut/indexes/kqp_indexes_ut.cpp
+++ b/ydb/core/kqp/ut/indexes/kqp_indexes_ut.cpp
@@ -1670,16 +1670,24 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- int indexPhaseId = 0;
- int tablePhaseId = 1;
-
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access(0).name(), "/Root/TestTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access(0).reads().rows(), 3);
-
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable/ix_cust/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 3);
+ if (serverSettings.AppConfig.GetTableServiceConfig().GetEnableKqpDataQueryStreamLookup()) {
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).name(), "/Root/TestTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 3);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(1).name(), "/Root/TestTable/ix_cust/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(1).reads().rows(), 3);
+ } else {
+ int indexPhaseId = 0;
+ int tablePhaseId = 1;
+
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access(0).name(), "/Root/TestTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access(0).reads().rows(), 3);
+
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable/ix_cust/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 3);
+ }
}
}
@@ -1710,16 +1718,24 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- int indexPhaseId = 0;
- int tablePhaseId = 1;
-
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access(0).name(), "/Root/TestTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access(0).reads().rows(), 2);
-
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable/ix_cust2/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ if (serverSettings.AppConfig.GetTableServiceConfig().GetEnableKqpDataQueryStreamLookup()) {
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).name(), "/Root/TestTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(1).name(), "/Root/TestTable/ix_cust2/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(1).reads().rows(), 2);
+ } else {
+ int indexPhaseId = 0;
+ int tablePhaseId = 1;
+
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access(0).name(), "/Root/TestTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(tablePhaseId).table_access(0).reads().rows(), 2);
+
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable/ix_cust2/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ }
}
}
@@ -1750,7 +1766,6 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
int indexPhaseId = 0;
-
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable/ix_cust3/indexImplTable");
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
@@ -2557,6 +2572,7 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
TKikimrRunner kikimr(serverSettings);
auto db = kikimr.GetTableClient();
auto session = db.CreateSession().GetValueSync().GetSession();
+ bool streamLookupEnabled = serverSettings.AppConfig.GetTableServiceConfig().GetEnableKqpDataQueryStreamLookup();
{
auto tableBuilder = db.GetTableBuilder();
@@ -2624,9 +2640,8 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- int indexPhaseId = 1;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 3);
- indexPhaseId = 2;
+ int indexPhaseId = streamLookupEnabled ? 1 : 2;
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), streamLookupEnabled ? 2 : 3);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).name(), "/Root/TestTable1");
@@ -2655,9 +2670,8 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- int indexPhaseId = 1;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 3);
- indexPhaseId = 2;
+ int indexPhaseId = streamLookupEnabled ? 1 : 2;
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), streamLookupEnabled ? 2 : 3);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).name(), "/Root/TestTable1");
@@ -2688,8 +2702,8 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
int indexPhaseId = 1;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 3);
- indexPhaseId = 2;
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), streamLookupEnabled ? 2 : 3);
+ indexPhaseId = streamLookupEnabled ? 1 : 2;
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).name(), "/Root/TestTable1");
@@ -2718,9 +2732,8 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- int indexPhaseId = 1;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 3);
- indexPhaseId = 2;
+ int indexPhaseId = streamLookupEnabled ? 1 : 2;
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), streamLookupEnabled ? 2 : 3);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).name(), "/Root/TestTable1");
@@ -2739,6 +2752,7 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
TKikimrRunner kikimr(serverSettings);
auto db = kikimr.GetTableClient();
auto session = db.CreateSession().GetValueSync().GetSession();
+ bool streamLookupEnabled = serverSettings.AppConfig.GetTableServiceConfig().GetEnableKqpDataQueryStreamLookup();
NYdb::NTable::TExecDataQuerySettings execSettings;
execSettings.CollectQueryStats(ECollectQueryStatsMode::Basic);
@@ -2807,23 +2821,30 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- int indexPhaseId = 1;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 4);
- indexPhaseId = 2;
+ int indexPhaseId = streamLookupEnabled ? 1 : 2;
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), streamLookupEnabled ? 2 : 4);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).name(), "/Root/TestTable1");
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 3);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2/Index1/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ if (streamLookupEnabled) {
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(1).name(), "/Root/TestTable2/Index1/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(1).reads().rows(), 2);
+ } else {
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2/Index1/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
- indexPhaseId++;
+ indexPhaseId++;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ }
}
{
@@ -2845,23 +2866,30 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- int indexPhaseId = 1;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 4);
- indexPhaseId = 2;
+ int indexPhaseId = streamLookupEnabled ? 1 : 2;
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), streamLookupEnabled ? 2 : 4);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).name(), "/Root/TestTable1");
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 3);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2/Index1/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ if (streamLookupEnabled) {
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(1).name(), "/Root/TestTable2/Index1/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(1).reads().rows(), 2);
+ } else {
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2/Index1/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
- indexPhaseId++;
+ indexPhaseId++;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).name(), "/Root/TestTable2");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(indexPhaseId).table_access(0).reads().rows(), 2);
+ }
}
}
@@ -3372,19 +3400,28 @@ R"([[#;#;["Primary1"];[41u]];[["Secondary2"];[2u];["Primary2"];[42u]];[["Seconda
auto& stats = NYdb::TProtoAccessor::GetProto(*result2.GetStats());
- int readPhase = 0;
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 3);
- readPhase = 1;
+ int readPhase = 1;
+ if (serverSettings.AppConfig.GetTableServiceConfig().GetEnableKqpDataQueryStreamLookup()) {
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 2);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).name(), "/Root/SecondaryComplexKeys/Index/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).reads().rows(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access().size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).name(), "/Root/SecondaryComplexKeys");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).reads().rows(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(1).name(), "/Root/SecondaryComplexKeys/Index/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(1).reads().rows(), 1);
+ } else {
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 3);
- readPhase++;
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).name(), "/Root/SecondaryComplexKeys/Index/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).reads().rows(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).name(), "/Root/SecondaryComplexKeys");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).reads().rows(), 1);
+ readPhase++;
+
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).name(), "/Root/SecondaryComplexKeys");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(readPhase).table_access(0).reads().rows(), 1);
+ }
}
}
diff --git a/ydb/core/kqp/ut/opt/kqp_ne_ut.cpp b/ydb/core/kqp/ut/opt/kqp_ne_ut.cpp
index ddabd482c8..e4f54b8ba9 100644
--- a/ydb/core/kqp/ut/opt/kqp_ne_ut.cpp
+++ b/ydb/core/kqp/ut/opt/kqp_ne_ut.cpp
@@ -1204,16 +1204,12 @@ Y_UNIT_TEST_SUITE(KqpNewEngine) {
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
ui32 index = 0;
- if (settings.AppConfig.GetTableServiceConfig().GetEnableKqpDataQueryStreamLookup()) {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 1);
- } else {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 2);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 0);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).affected_shards(), 0);
- UNIT_ASSERT(stats.query_phases(0).table_access().size() == 0);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 0);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).affected_shards(), 0);
+ UNIT_ASSERT(stats.query_phases(0).table_access().size() == 0);
- index = 1;
- }
+ index = 1;
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(index).table_access().size(), 1);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(index).table_access(0).name(), "/Root/EightShard");
diff --git a/ydb/core/kqp/ut/query/kqp_explain_ut.cpp b/ydb/core/kqp/ut/query/kqp_explain_ut.cpp
index c04bdb4fbb..c763040b3d 100644
--- a/ydb/core/kqp/ut/query/kqp_explain_ut.cpp
+++ b/ydb/core/kqp/ut/query/kqp_explain_ut.cpp
@@ -468,14 +468,8 @@ Y_UNIT_TEST_SUITE(KqpExplain) {
UNIT_ASSERT_EQUAL(node.GetMapSafe().at("Table").GetStringSafe(), "KeyValue");
node = FindPlanNodeByKv(plan, "Name", "TableFullScan");
UNIT_ASSERT_EQUAL(node.GetMapSafe().at("Table").GetStringSafe(), "KeyValue");
-
- if (settings.AppConfig.GetTableServiceConfig().GetEnableKqpDataQueryStreamLookup()) {
- node = FindPlanNodeByKv(plan, "Node Type", "TableLookup");
- UNIT_ASSERT_EQUAL(node.GetMapSafe().at("Table").GetStringSafe(), "KeyValue");
- } else {
- node = FindPlanNodeByKv(plan, "Name", "TablePointLookup");
- UNIT_ASSERT_EQUAL(node.GetMapSafe().at("Table").GetStringSafe(), "KeyValue");
- }
+ node = FindPlanNodeByKv(plan, "Name", "TablePointLookup");
+ UNIT_ASSERT_EQUAL(node.GetMapSafe().at("Table").GetStringSafe(), "KeyValue");
}
Y_UNIT_TEST(FewEffects) {
diff --git a/ydb/core/kqp/ut/scan/kqp_split_ut.cpp b/ydb/core/kqp/ut/scan/kqp_split_ut.cpp
index c4f6a1ee1e..302090aa6c 100644
--- a/ydb/core/kqp/ut/scan/kqp_split_ut.cpp
+++ b/ydb/core/kqp/ut/scan/kqp_split_ut.cpp
@@ -379,6 +379,7 @@ Y_UNIT_TEST_SUITE(KqpSplit) {
TKikimrSettings settings;
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableTableServiceConfig()->SetEnableKqpScanQuerySourceRead(true);
+ appConfig.MutableTableServiceConfig()->SetEnableKqpScanQueryStreamLookup(false);
settings.SetDomainRoot(KikimrDefaultUtDomainRoot);
TFeatureFlags flags;
flags.SetEnablePredicateExtractForScanQueries(true);
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index a81bfa7c77..b3ac22396a 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -1264,11 +1264,12 @@ message TTableServiceConfig {
optional bool EnableKqpDataQuerySourceRead = 27 [default = true];
optional uint64 SessionIdleDurationSeconds = 28 [default = 600];
optional TAggregationConfig AggregationConfig = 29;
- optional bool EnableKqpScanQueryStreamLookup = 30 [default = false];
- optional bool EnableKqpDataQueryStreamLookup = 31 [default = false];
+ optional bool EnableKqpScanQueryStreamLookup = 30 [default = true];
+ optional bool EnableKqpDataQueryStreamLookup = 31 [default = true];
optional TExecuterRetriesConfig ExecuterRetriesConfig = 32;
optional bool EnableKqpDataQueryStreamPointLookup = 33 [default = false];
optional bool EnablePublishKqpProxyByRM = 34 [default = false];
+ optional bool EnableKqpScanQueryStreamIdxLookupJoin = 35 [default = false];
};
// Config describes immediate controls and allows