aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Makunin <igor.makunin@gmail.com>2022-03-15 17:59:56 +0300
committerIgor Makunin <igor.makunin@gmail.com>2022-03-15 17:59:56 +0300
commit28e259b3ca329a7c0d05367480781f42614aa306 (patch)
treead071fb7a74609988ea3b55b21aa05c8a6e1dc2d
parent5e57bdffecb1fd1ed5269ec184b2c50f1a39ea85 (diff)
downloadydb-28e259b3ca329a7c0d05367480781f42614aa306.tar.gz
KIKIMR-14499: dont precompute literal keys for ReadTable
ref:275994e624f8427cdb1c7bb03bf4d1788a98562b
-rw-r--r--ydb/core/kqp/compile/kqp_compile.cpp128
-rw-r--r--ydb/core/kqp/executer/kqp_partition_helper.cpp15
-rw-r--r--ydb/core/kqp/opt/physical/kqp_opt_phy_build_stage.cpp19
-rw-r--r--ydb/core/kqp/prepare/kqp_query_plan.cpp5
-rw-r--r--ydb/core/kqp/ut/kqp_indexes_ut.cpp65
-rw-r--r--ydb/core/kqp/ut/kqp_ne_ut.cpp47
-rw-r--r--ydb/core/kqp/ut/kqp_query_ut.cpp12
-rw-r--r--ydb/core/kqp/ut/kqp_table_predicate_ut.cpp30
8 files changed, 168 insertions, 153 deletions
diff --git a/ydb/core/kqp/compile/kqp_compile.cpp b/ydb/core/kqp/compile/kqp_compile.cpp
index d778aec5be..bf95244d09 100644
--- a/ydb/core/kqp/compile/kqp_compile.cpp
+++ b/ydb/core/kqp/compile/kqp_compile.cpp
@@ -104,6 +104,68 @@ void FillColumns(const TCoAtomList& columns, const TKikimrTableMetadata& tableMe
}
}
+void FillLiteralKeyBound(const TCoDataCtor& literal, NKqpProto::TKqpPhyLiteralValue& proto) {
+ auto type = literal.Ref().GetTypeAnn();
+ auto slot = type->Cast<TDataExprType>()->GetSlot();
+ auto typeId = NKikimr::NUdf::GetDataTypeInfo(slot).TypeId;
+
+ YQL_ENSURE(NScheme::NTypeIds::IsYqlType(typeId) && NSchemeShard::IsAllowedKeyType(typeId));
+
+ auto& protoType = *proto.MutableType();
+ auto& protoValue = *proto.MutableValue();
+
+ protoType.SetKind(NKikimrMiniKQL::ETypeKind::Data);
+ protoType.MutableData()->SetScheme(typeId);
+
+ auto value = literal.Literal().Value();
+
+ switch (slot) {
+ case EDataSlot::Bool:
+ protoValue.SetBool(FromString<bool>(value));
+ break;
+ case EDataSlot::Uint8:
+ case EDataSlot::Uint32:
+ case EDataSlot::Date:
+ case EDataSlot::Datetime:
+ protoValue.SetUint32(FromString<ui32>(value));
+ break;
+ case EDataSlot::Int32:
+ protoValue.SetInt32(FromString<i32>(value));
+ break;
+ case EDataSlot::Int64:
+ case EDataSlot::Interval:
+ protoValue.SetInt64(FromString<i64>(value));
+ break;
+ case EDataSlot::Uint64:
+ case EDataSlot::Timestamp:
+ protoValue.SetUint64(FromString<ui64>(value));
+ break;
+ case EDataSlot::String:
+ case EDataSlot::DyNumber:
+ protoValue.SetBytes(value.Data(), value.Size());
+ break;
+ case EDataSlot::Utf8:
+ protoValue.SetText(ToString(value));
+ break;
+ case EDataSlot::Decimal: {
+ const auto paramsDataType = type->Cast<TDataExprParamsType>();
+ auto precision = FromString<ui8>(paramsDataType->GetParamOne());
+ auto scale = FromString<ui8>(paramsDataType->GetParamTwo());
+ protoType.MutableData()->MutableDecimalParams()->SetPrecision(precision);
+ protoType.MutableData()->MutableDecimalParams()->SetScale(scale);
+
+ auto v = NDecimal::FromString(literal.Cast<TCoDecimal>().Literal().Value(), precision, scale);
+ const auto p = reinterpret_cast<ui8*>(&v);
+ protoValue.SetLow128(*reinterpret_cast<ui64*>(p));
+ protoValue.SetHi128(*reinterpret_cast<ui64*>(p + 8));
+ break;
+ }
+
+ default:
+ YQL_ENSURE(false, "Unexpected type slot " << slot);
+ }
+}
+
void FillKeyBound(const TVarArgCallable<TExprBase>& bound, NKqpProto::TKqpPhyKeyBound& boundProto) {
if (bound.Maybe<TKqlKeyInc>()) {
boundProto.SetIsInclusive(true);
@@ -125,6 +187,8 @@ void FillKeyBound(const TVarArgCallable<TExprBase>& bound, NKqpProto::TKqpPhyKey
auto& paramElementProto = *protoValue.MutableParamElementValue();
paramElementProto.SetParamName(TString(maybeParam.Cast().Name()));
paramElementProto.SetElementIndex(FromString<ui32>(key.Cast<TCoNth>().Index().Value()));
+ } else if (auto maybeLiteral = key.Maybe<TCoDataCtor>()) {
+ FillLiteralKeyBound(maybeLiteral.Cast(), *protoValue.MutableLiteralValue());
} else {
YQL_ENSURE(false, "Unexpected key bound: " << key.Ref().Content());
}
@@ -237,8 +301,6 @@ void FillLookup(const TKqpLookupTable& lookup, NKqpProto::TKqpPhyOpLookup& looku
auto protoRow = proto->AddRows();
auto& protoRowColumns = *protoRow->MutableColumns();
- auto* structType = asStruct.Ref().GetTypeAnn()->Cast<TStructExprType>();
-
for (auto item : asStruct) {
auto tuple = item.Cast<TCoNameValueTuple>();
auto columnName = tuple.Name().StringValue();
@@ -248,67 +310,7 @@ void FillLookup(const TKqpLookupTable& lookup, NKqpProto::TKqpPhyOpLookup& looku
protoColumn.MutableParamValue()->SetParamName(maybeParam.Cast().Name().StringValue());
} else {
YQL_ENSURE(tuple.Value().Maybe<TCoDataCtor>(), "" << tuple.Value().Ref().Dump());
- auto dataCtor = tuple.Value().Cast<TCoDataCtor>();
-
- auto value = dataCtor.Literal().Value();
-
- auto& protoType = *protoColumn.MutableLiteralValue()->MutableType();
- auto& protoValue = *protoColumn.MutableLiteralValue()->MutableValue();
-
- auto type = structType->FindItemType(columnName);
- auto slot = type->Cast<TDataExprType>()->GetSlot();
- auto typeId = NKikimr::NUdf::GetDataTypeInfo(slot).TypeId;
-
- YQL_ENSURE(NScheme::NTypeIds::IsYqlType(typeId) && NSchemeShard::IsAllowedKeyType(typeId));
-
- protoType.SetKind(NKikimrMiniKQL::ETypeKind::Data);
- protoType.MutableData()->SetScheme(typeId);
-
- switch (slot) {
- case EDataSlot::Bool:
- protoValue.SetBool(FromString<bool>(value));
- break;
- case EDataSlot::Uint8:
- case EDataSlot::Uint32:
- case EDataSlot::Date:
- case EDataSlot::Datetime:
- protoValue.SetUint32(FromString<ui32>(value));
- break;
- case EDataSlot::Int32:
- protoValue.SetInt32(FromString<i32>(value));
- break;
- case EDataSlot::Int64:
- case EDataSlot::Interval:
- protoValue.SetInt64(FromString<i64>(value));
- break;
- case EDataSlot::Uint64:
- case EDataSlot::Timestamp:
- protoValue.SetUint64(FromString<ui64>(value));
- break;
- case EDataSlot::String:
- case EDataSlot::DyNumber:
- protoValue.SetBytes(value.Data(), value.Size());
- break;
- case EDataSlot::Utf8:
- protoValue.SetText(ToString(value));
- break;
- case EDataSlot::Decimal: {
- const auto paramsDataType = type->Cast<TDataExprParamsType>();
- auto precision = FromString<ui8>(paramsDataType->GetParamOne());
- auto scale = FromString<ui8>(paramsDataType->GetParamTwo());
- protoType.MutableData()->MutableDecimalParams()->SetPrecision(precision);
- protoType.MutableData()->MutableDecimalParams()->SetScale(scale);
-
- auto v = NDecimal::FromString(dataCtor.Cast<TCoDecimal>().Literal().Value(), precision, scale);
- const auto p = reinterpret_cast<ui8*>(&v);
- protoValue.SetLow128(*reinterpret_cast<ui64*>(p));
- protoValue.SetHi128(*reinterpret_cast<ui64*>(p + 8));
- break;
- }
-
- default:
- YQL_ENSURE(false, "Unexpected type slot " << slot);
- }
+ FillLiteralKeyBound(tuple.Value().Cast<TCoDataCtor>(), *protoColumn.MutableLiteralValue());
}
}
}
diff --git a/ydb/core/kqp/executer/kqp_partition_helper.cpp b/ydb/core/kqp/executer/kqp_partition_helper.cpp
index ac786f6c24..797047a2af 100644
--- a/ydb/core/kqp/executer/kqp_partition_helper.cpp
+++ b/ydb/core/kqp/executer/kqp_partition_helper.cpp
@@ -181,15 +181,24 @@ TVector<TCell> FillKeyValues(const TVector<NUdf::TDataTypeId>& keyColumnTypes, c
TString paramName;
TMaybe<ui32> paramIndex;
switch (tupleValue.GetKindCase()) {
- case NKqpProto::TKqpPhyValue::kParamValue:
+ case NKqpProto::TKqpPhyValue::kParamValue: {
paramName = tupleValue.GetParamValue().GetParamName();
break;
- case NKqpProto::TKqpPhyValue::kParamElementValue:
+ }
+ case NKqpProto::TKqpPhyValue::kParamElementValue: {
paramName = tupleValue.GetParamElementValue().GetParamName();
paramIndex = tupleValue.GetParamElementValue().GetElementIndex();
break;
- default:
+ }
+ case NKqpProto::TKqpPhyValue::kLiteralValue: {
+ const auto& literal = tupleValue.GetLiteralValue();
+ auto [type, value] = ImportValueFromProto(literal.GetType(), literal.GetValue(), typeEnv, holderFactory);
+ keyValues.emplace_back(NMiniKQL::MakeCell(keyColumnTypes[i], value, typeEnv, /* copy */ true));
+ continue;
+ }
+ default: {
YQL_ENSURE(false, "Unexpected type case " << (int) tupleValue.GetKindCase());
+ }
}
auto param = stageInfo.Meta.Tx.Params.Values.FindPtr(paramName);
diff --git a/ydb/core/kqp/opt/physical/kqp_opt_phy_build_stage.cpp b/ydb/core/kqp/opt/physical/kqp_opt_phy_build_stage.cpp
index f49aff031f..e2acb69973 100644
--- a/ydb/core/kqp/opt/physical/kqp_opt_phy_build_stage.cpp
+++ b/ydb/core/kqp/opt/physical/kqp_opt_phy_build_stage.cpp
@@ -64,12 +64,19 @@ TExprBase KqpBuildReadTableStage(TExprBase node, TExprContext& ctx, const TKqpOp
TVector<TExprBase> values;
TNodeOnNodeOwnedMap replaceMap;
- auto checkRange = [&values](const TVarArgCallable<TExprBase>& tuple) {
+ auto checkRange = [&values](const TVarArgCallable<TExprBase>& tuple, bool& literalRange) {
+ literalRange = true;
+
for (const auto& value : tuple) {
if (!IsDqPureExpr(value)) {
+ literalRange = false;
return false;
}
+ if (!value.Maybe<TCoDataCtor>()) {
+ literalRange = false;
+ }
+
if (!value.Maybe<TCoParameter>()) {
values.push_back(value);
}
@@ -78,18 +85,22 @@ TExprBase KqpBuildReadTableStage(TExprBase node, TExprContext& ctx, const TKqpOp
return true;
};
- if (!checkRange(read.Range().From())) {
+ bool fromIsLiteral = false;
+ if (!checkRange(read.Range().From(), fromIsLiteral)) {
return read;
}
- if (!checkRange(read.Range().To())) {
+ bool toIsLiteral = false;
+ if (!checkRange(read.Range().To(), toIsLiteral)) {
return read;
}
+ bool literalRanges = fromIsLiteral && toIsLiteral;
+
TVector<TExprBase> inputs;
TVector<TCoArgument> programArgs;
TNodeOnNodeOwnedMap rangeReplaces;
- if (!values.empty()) {
+ if (!values.empty() && !literalRanges) {
auto computeStage = Build<TDqStage>(ctx, read.Pos())
.Inputs()
.Build()
diff --git a/ydb/core/kqp/prepare/kqp_query_plan.cpp b/ydb/core/kqp/prepare/kqp_query_plan.cpp
index fc05f9f17b..e9e828b200 100644
--- a/ydb/core/kqp/prepare/kqp_query_plan.cpp
+++ b/ydb/core/kqp/prepare/kqp_query_plan.cpp
@@ -1108,6 +1108,11 @@ private:
}
}
}
+
+ if (auto literal = key.Maybe<TCoDataCtor>()) {
+ return literal.Cast().Literal().StringValue();
+ }
+
return TString("n/a");
};
diff --git a/ydb/core/kqp/ut/kqp_indexes_ut.cpp b/ydb/core/kqp/ut/kqp_indexes_ut.cpp
index a7bff4ce4a..c2580fb2aa 100644
--- a/ydb/core/kqp/ut/kqp_indexes_ut.cpp
+++ b/ydb/core/kqp/ut/kqp_indexes_ut.cpp
@@ -961,20 +961,12 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
UNIT_ASSERT_VALUES_EQUAL(NYdb::FormatResultSetYson(result.GetResultSet(0)), "[[[\"Value1\"]]]");
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- if (UseNewEngine) {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 2);
-
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(1).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(1).table_access(0).name(), "/Root/SecondaryWithDataColumns/Index/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(1).table_access(0).reads().rows(), 1);
- } else {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 1);
- 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/SecondaryWithDataColumns/Index/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 1);
+ 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/SecondaryWithDataColumns/Index/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 1);
- }
}
{
@@ -994,17 +986,11 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- UNIT_ASSERT_VALUES_EQUAL_C(stats.query_phases().size(), UseNewEngine ? 2 : 1, stats.DebugString());
+ UNIT_ASSERT_VALUES_EQUAL_C(stats.query_phases().size(), 1, stats.DebugString());
- ui32 index = 0;
- if (UseNewEngine) {
- UNIT_ASSERT(stats.query_phases(index).table_access().empty());
- 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/SecondaryWithDataColumns/Index/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(index).table_access(0).reads().rows(), 1);
+ 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/SecondaryWithDataColumns/Index/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 1);
}
{
@@ -1067,24 +1053,17 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
if (WithMvcc && !UseNewEngine) {
phaseCount--;
}
- if (UseNewEngine) {
- phaseCount++;
- }
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), phaseCount);
- int idx = 0;
- if (UseNewEngine) {
- idx = 1;
- }
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(idx).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(idx).table_access(0).name(), "/Root/SecondaryWithDataColumns/Index/indexImplTable");
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(idx).table_access(0).reads().rows(), 1);
+ 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/SecondaryWithDataColumns/Index/indexImplTable");
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 1);
- idx++;
- if (UseNewEngine) {
- idx++;
+ int idx = phaseCount - 1;
+ if (!WithMvcc && !UseNewEngine) {
+ idx--;
}
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(idx).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL_C(stats.query_phases(idx).table_access().size(), 1, stats.DebugString());
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(idx).table_access(0).name(), "/Root/KeyValue2");
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(idx).table_access(0).reads().rows(), 1);
}
@@ -2893,11 +2872,6 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
int indexPhaseId = 0;
int tablePhaseId = 1;
- if (UseNewEngine) {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 3);
- indexPhaseId = 1;
- tablePhaseId = 2;
- }
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");
@@ -2944,11 +2918,6 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
int indexPhaseId = 0;
int tablePhaseId = 1;
- if (UseNewEngine) {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 3);
- indexPhaseId = 1;
- tablePhaseId = 2;
- }
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");
@@ -2994,10 +2963,6 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
int indexPhaseId = 0;
- if (UseNewEngine) {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 2);
- indexPhaseId = 1;
- }
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");
diff --git a/ydb/core/kqp/ut/kqp_ne_ut.cpp b/ydb/core/kqp/ut/kqp_ne_ut.cpp
index 1c1f31acaa..58ff185761 100644
--- a/ydb/core/kqp/ut/kqp_ne_ut.cpp
+++ b/ydb/core/kqp/ut/kqp_ne_ut.cpp
@@ -3017,6 +3017,53 @@ Y_UNIT_TEST_SUITE(KqpNewEngine) {
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
CompareYson(R"([[2u]])", FormatResultSetYson(result.GetResultSet(0)));
}
+
+ Y_UNIT_TEST(LiteralKeys) {
+ TKikimrRunner kikimr;
+ auto db = kikimr.GetTableClient();
+ auto session = db.CreateSession().GetValueSync().GetSession();
+
+ auto settings = TExecDataQuerySettings()
+ .CollectQueryStats(ECollectQueryStatsMode::Basic);
+
+ auto result = session.ExecuteDataQuery(R"(
+ --!syntax_v1
+ PRAGMA kikimr.UseNewEngine = 'true';
+
+ SELECT * FROM `/Root/Logs` WHERE App = 'nginx'u AND Ts >= 2 LIMIT 1
+ )", TTxControl::BeginTx().CommitTx(), settings).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+ CompareYson(R"([[["nginx"];["nginx-23"];["PUT /form HTTP/1.1"];[2]]])", FormatResultSetYson(result.GetResultSet(0)));
+
+ auto stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
+ UNIT_ASSERT_VALUES_EQUAL(1, stats.query_phases().size()); // no LiteralExecuter phase
+ UNIT_ASSERT_VALUES_EQUAL(1, stats.query_phases()[0].table_access().size());
+ UNIT_ASSERT_VALUES_EQUAL(1, stats.query_phases()[0].affected_shards());
+ UNIT_ASSERT_VALUES_EQUAL("/Root/Logs", stats.query_phases()[0].table_access()[0].name());
+
+ // mix param and literal
+ auto params = TParamsBuilder()
+ .AddParam("$app").Utf8("nginx").Build()
+ .Build();
+
+ result = session.ExecuteDataQuery(R"(
+ --!syntax_v1
+ PRAGMA kikimr.UseNewEngine = 'true';
+
+ DECLARE $app AS Utf8;
+
+ SELECT * FROM `/Root/Logs` WHERE App = $app AND Ts >= 2 LIMIT 1
+ )", TTxControl::BeginTx().CommitTx(), std::move(params), settings).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+ CompareYson(R"([[["nginx"];["nginx-23"];["PUT /form HTTP/1.1"];[2]]])", FormatResultSetYson(result.GetResultSet(0)));
+
+ stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
+ UNIT_ASSERT_VALUES_EQUAL(2, stats.query_phases().size()); // with LiteralExecuter phase
+ UNIT_ASSERT_VALUES_EQUAL(0, stats.query_phases()[0].table_access().size());
+ UNIT_ASSERT_VALUES_EQUAL(1, stats.query_phases()[1].table_access().size());
+ UNIT_ASSERT_VALUES_EQUAL(1, stats.query_phases()[1].affected_shards());
+ UNIT_ASSERT_VALUES_EQUAL("/Root/Logs", stats.query_phases()[1].table_access()[0].name());
+ }
}
} // namespace NKikimr::NKqp
diff --git a/ydb/core/kqp/ut/kqp_query_ut.cpp b/ydb/core/kqp/ut/kqp_query_ut.cpp
index cf59d4071a..469f59311f 100644
--- a/ydb/core/kqp/ut/kqp_query_ut.cpp
+++ b/ydb/core/kqp/ut/kqp_query_ut.cpp
@@ -956,17 +956,11 @@ Y_UNIT_TEST_SUITE(KqpQuery) {
UNIT_ASSERT(compile.duration_us() > 0);
UNIT_ASSERT(compile.cpu_time_us() > 0);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), UseNewEngine ? 3 : 2);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 2);
uint64_t totalCpuTimeUs = 0;
- if (UseNewEngine) {
- auto& phase0 = stats.query_phases(0);
- UNIT_ASSERT(phase0.table_access().size() == 0);
- totalCpuTimeUs += phase0.cpu_time_us();
- }
-
- auto& phase0 = stats.query_phases(UseNewEngine ? 1 : 0);
+ auto& phase0 = stats.query_phases(0);
UNIT_ASSERT(phase0.duration_us() > 0);
UNIT_ASSERT(phase0.cpu_time_us() > 0);
totalCpuTimeUs += phase0.cpu_time_us();
@@ -978,7 +972,7 @@ Y_UNIT_TEST_SUITE(KqpQuery) {
UNIT_ASSERT(!phase0.table_access(0).has_updates());
UNIT_ASSERT(!phase0.table_access(0).has_deletes());
- auto& phase1 = stats.query_phases(UseNewEngine ? 2 : 1);
+ auto& phase1 = stats.query_phases(1);
UNIT_ASSERT(phase1.duration_us() > 0);
UNIT_ASSERT(phase1.cpu_time_us() > 0);
totalCpuTimeUs += phase1.cpu_time_us();
diff --git a/ydb/core/kqp/ut/kqp_table_predicate_ut.cpp b/ydb/core/kqp/ut/kqp_table_predicate_ut.cpp
index 5ab5108968..c132bdb3fb 100644
--- a/ydb/core/kqp/ut/kqp_table_predicate_ut.cpp
+++ b/ydb/core/kqp/ut/kqp_table_predicate_ut.cpp
@@ -1096,18 +1096,9 @@ Y_UNIT_TEST_SUITE(KqpTablePredicate) {
])", FormatResultSetYson(result.GetResultSet(0)));
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- if (UseNewEngine) {
- 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(1).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(1).table_access(0).reads().rows(), 3);
- } else {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 3);
- }
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 3);
}
Y_UNIT_TEST_NEW_ENGINE(LiteralOrCompisiteCollision) {
@@ -1137,18 +1128,9 @@ Y_UNIT_TEST_SUITE(KqpTablePredicate) {
])", FormatResultSetYson(result.GetResultSet(0)));
auto& stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
- if (UseNewEngine) {
- 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(1).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(1).table_access(0).reads().rows(), 3);
- } else {
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
- UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 3);
- }
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access().size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(0).table_access(0).reads().rows(), 3);
}
Y_UNIT_TEST(NoFullScanAtScanQuery) {