Skip to content

Commit a882c95

Browse files
committed
fix
1 parent 5831cb3 commit a882c95

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

ydb/core/kqp/opt/physical/effects/kqp_opt_phy_indexes.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ TMaybeNode<TDqPhyPrecompute> PrecomputeTableLookupDict(const TDqPhyPrecompute& l
138138

139139
TExprNode::TPtr keys;
140140

141+
// we need to left only table key columns to perform lookup
142+
// unfortunately we can't do it inside lookup stage
141143
if (fixLookupKeys) {
142144
auto keyArg = TCoArgument(ctx.NewArgument(pos, "key"));
143145
auto keysList = TCoArgument(ctx.NewArgument(pos, "keys_list"));

ydb/core/kqp/opt/physical/effects/kqp_opt_phy_upsert_index.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,12 @@ TMaybe<TCondenseInputResult> CheckUniqueConstraint(const TExprBase& inputRows, c
351351
for (const auto& [_, indexDesc] : indexes) {
352352
hasUniqIndex |= (indexDesc->Type == TIndexDescription::EType::GlobalSyncUnique);
353353
for (const auto& indexKeyCol : indexDesc->KeyColumns) {
354-
if (inputColumns.contains(indexKeyCol)) {
355-
if (!usedIndexes.contains(indexDesc->Name) &&
356-
std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end())
357-
{
358-
usedIndexes.insert(indexDesc->Name);
359-
}
354+
if (inputColumns.contains(indexKeyCol)
355+
&& std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end())
356+
{
357+
usedIndexes.insert(indexDesc->Name);
360358
} else {
359+
// input always contains key columns
361360
YQL_ENSURE(std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end());
362361
missedKeyInput.emplace(indexKeyCol);
363362
}

0 commit comments

Comments
 (0)