Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/include/storage/index/hash_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ class PrimaryKeyIndex final : public Index {
}

void delete_(common::ValueVector* keyVector);
void discardPrimaryKey(common::ValueVector* keyVector) override { delete_(keyVector); }
void discardPrimaryKey(common::ValueVector* keyVector) override;

void checkpointInMemory() override;
void checkpoint(main::ClientContext*, storage::PageAllocator& pageAllocator) override;
Expand Down
17 changes: 17 additions & 0 deletions src/storage/index/hash_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,23 @@ void PrimaryKeyIndex::delete_(ValueVector* keyVector) {
[](auto) { UNREACHABLE_CODE; });
}

void PrimaryKeyIndex::discardPrimaryKey(ValueVector* keyVector) {
DASSERT(indexInfo.keyDataTypes.size() == 1);
TypeUtils::visit(
indexInfo.keyDataTypes[0],
[&]<IndexHashable T>(T) {
for (auto i = 0u; i < keyVector->state->getSelVector().getSelSize(); i++) {
auto pos = keyVector->state->getSelVector()[i];
if (keyVector->isNull(pos)) {
continue;
}
auto key = keyVector->getValue<T>(pos);
discardLocal(key);
}
},
[](auto) { UNREACHABLE_CODE; });
}

void PrimaryKeyIndex::checkpointInMemory() {
bool indexChanged = false;
for (auto i = 0u; i < NUM_HASH_INDEXES; i++) {
Expand Down
Loading