Skip to content

Commit 27016d5

Browse files
authored
fix missed check for usedIndexes. (#947)
1 parent e678637 commit 27016d5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,12 @@ TMaybe<TCondenseInputResult> CheckUniqueConstraint(const TExprBase& inputRows, c
365365
for (const auto& [_, indexDesc] : indexes) {
366366
hasUniqIndex |= (indexDesc->Type == TIndexDescription::EType::GlobalSyncUnique);
367367
for (const auto& indexKeyCol : indexDesc->KeyColumns) {
368-
if (inputColumns.contains(indexKeyCol)
369-
&& std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end())
370-
{
371-
usedIndexes.insert(indexDesc->Name);
368+
if (inputColumns.contains(indexKeyCol)) {
369+
if (!usedIndexes.contains(indexDesc->Name) &&
370+
std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end())
371+
{
372+
usedIndexes.insert(indexDesc->Name);
373+
}
372374
} else {
373375
// input always contains key columns
374376
YQL_ENSURE(std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end());

0 commit comments

Comments
 (0)