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

Method insert

src/storage/table/node_table.cpp:450–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450void NodeTable::insert(Transaction* transaction, TableInsertState& insertState) {
451 const auto& nodeInsertState = insertState.cast<NodeTableInsertState>();
452 auto& nodeIDSelVector = nodeInsertState.nodeIDVector.state->getSelVector();
453 DASSERT(nodeInsertState.propertyVectors[0]->state->getSelVector().getSelSize() == 1);
454 DASSERT(nodeIDSelVector.getSelSize() == 1);
455 if (nodeInsertState.nodeIDVector.isNull(nodeIDSelVector[0])) {
456 return;
457 }
458 const auto localTable = transaction->getLocalStorage()->getOrCreateLocalTable(*this);
459 validatePkNotExists(transaction, const_cast<ValueVector*>(&nodeInsertState.pkVector));
460 localTable->insert(transaction, insertState);
461 for (auto i = 0u; i < indexes.size(); i++) {
462 auto index = indexes[i].getIndex();
463 std::vector<ValueVector*> indexedPropertyVectors;
464 for (const auto columnID : index->getIndexInfo().columnIDs) {
465 indexedPropertyVectors.push_back(insertState.propertyVectors[columnID]);
466 }
467 index->insert(transaction, nodeInsertState.nodeIDVector, indexedPropertyVectors,
468 *nodeInsertState.indexInsertStates[i]);
469 }
470 if (insertState.logToWAL && transaction->shouldLogToWAL()) {
471 DASSERT(transaction->isWriteTransaction());
472 auto& wal = transaction->getLocalWAL();
473 wal.logTableInsertion(tableID, TableType::NODE,
474 nodeInsertState.nodeIDVector.state->getSelVector().getSelSize(),
475 insertState.propertyVectors);
476 }
477 setHasChanges();
478}
479
480void NodeTable::initUpdateState(main::ClientContext* context, TableUpdateState& updateState) const {
481 auto& nodeUpdateState = updateState.cast<NodeTableUpdateState>();

Callers

nothing calls this directly

Calls 9

setHasChangesFunction · 0.85
getSelSizeMethod · 0.80
getOrCreateLocalTableMethod · 0.80
shouldLogToWALMethod · 0.80
logTableInsertionMethod · 0.80
isNullMethod · 0.45
sizeMethod · 0.45
getIndexMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected