MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / lookupPK

Method lookupPK

src/storage/table/node_table.cpp:846–866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846bool NodeTable::lookupPK(const Transaction* transaction, ValueVector* keyVector, uint64_t vectorPos,
847 offset_t& result) const {
848 if (transaction->getLocalStorage()) {
849 if (const auto localTable = transaction->getLocalStorage()->getLocalTable(tableID);
850 localTable && localTable->cast<LocalNodeTable>().lookupPK(transaction, keyVector,
851 vectorPos, result)) {
852 return true;
853 }
854 }
855 if (auto* pkIndex = tryGetPrimaryKeyIndex()) {
856 return pkIndex->lookupPrimaryKey(transaction, keyVector, vectorPos, result,
857 [&](offset_t offset) { return isVisibleNoLock(transaction, offset); });
858 }
859 auto keyToLookup = keyVector->getAsValue(vectorPos);
860 ColumnPredicateSet predicateSet;
861 predicateSet.addPredicate(std::make_unique<ColumnConstantPredicate>(
862 std::string{getColumn(pkColumnID).getName()}, ExpressionType::EQUALS, *keyToLookup));
863 std::vector<ColumnPredicateSet> predicateSets;
864 predicateSets.push_back(std::move(predicateSet));
865 return scanPKColumn(transaction, *keyToLookup, std::move(predicateSets), result);
866}
867
868bool NodeTable::lookupPKRange(const Transaction* transaction, ValueVector* lowerBoundVector,
869 uint64_t lowerBoundPos, bool lowerInclusive, ValueVector* upperBoundVector,

Callers 3

getNextTuplesInternalMethod · 0.45
scanFlatMethod · 0.45

Calls 7

getLocalTableMethod · 0.80
getAsValueMethod · 0.80
addPredicateMethod · 0.80
getColumnFunction · 0.50
lookupPrimaryKeyMethod · 0.45
getNameMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected