Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherednik committed Jan 10, 2024
1 parent 5831cb3 commit a882c95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions ydb/core/kqp/opt/physical/effects/kqp_opt_phy_indexes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ TMaybeNode<TDqPhyPrecompute> PrecomputeTableLookupDict(const TDqPhyPrecompute& l

TExprNode::TPtr keys;

// we need to left only table key columns to perform lookup
// unfortunately we can't do it inside lookup stage
if (fixLookupKeys) {
auto keyArg = TCoArgument(ctx.NewArgument(pos, "key"));
auto keysList = TCoArgument(ctx.NewArgument(pos, "keys_list"));
Expand Down
11 changes: 5 additions & 6 deletions ydb/core/kqp/opt/physical/effects/kqp_opt_phy_upsert_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,12 @@ TMaybe<TCondenseInputResult> CheckUniqueConstraint(const TExprBase& inputRows, c
for (const auto& [_, indexDesc] : indexes) {
hasUniqIndex |= (indexDesc->Type == TIndexDescription::EType::GlobalSyncUnique);
for (const auto& indexKeyCol : indexDesc->KeyColumns) {
if (inputColumns.contains(indexKeyCol)) {
if (!usedIndexes.contains(indexDesc->Name) &&
std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end())
{
usedIndexes.insert(indexDesc->Name);
}
if (inputColumns.contains(indexKeyCol)
&& std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end())
{
usedIndexes.insert(indexDesc->Name);
} else {
// input always contains key columns
YQL_ENSURE(std::find(mainPk.begin(), mainPk.end(), indexKeyCol) == mainPk.end());
missedKeyInput.emplace(indexKeyCol);
}
Expand Down

0 comments on commit a882c95

Please sign in to comment.