| 448 | } |
| 449 | |
| 450 | void 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 | |
| 480 | void NodeTable::initUpdateState(main::ClientContext* context, TableUpdateState& updateState) const { |
| 481 | auto& nodeUpdateState = updateState.cast<NodeTableUpdateState>(); |
nothing calls this directly
no test coverage detected