| 25 | } |
| 26 | |
| 27 | void NodeGroupCollection::append(const Transaction* transaction, |
| 28 | const std::vector<ValueVector*>& vectors) { |
| 29 | const auto numRowsToAppend = vectors[0]->state->getSelVector().getSelSize(); |
| 30 | DASSERT(numRowsToAppend == vectors[0]->state->getSelVector().getSelSize()); |
| 31 | for (auto i = 1u; i < vectors.size(); i++) { |
| 32 | DASSERT(vectors[i]->state->getSelVector().getSelSize() == numRowsToAppend); |
| 33 | } |
| 34 | const auto lock = nodeGroups.lock(); |
| 35 | if (nodeGroups.isEmpty(lock)) { |
| 36 | auto newGroup = |
| 37 | std::make_unique<NodeGroup>(mm, 0, enableCompression, LogicalType::copy(types)); |
| 38 | nodeGroups.appendGroup(lock, std::move(newGroup)); |
| 39 | } |
| 40 | row_idx_t numRowsAppended = 0u; |
| 41 | while (numRowsAppended < numRowsToAppend) { |
| 42 | auto lastNodeGroup = nodeGroups.getLastGroup(lock); |
| 43 | if (!lastNodeGroup || lastNodeGroup->isFull()) { |
| 44 | auto newGroup = std::make_unique<NodeGroup>(mm, nodeGroups.getNumGroups(lock), |
| 45 | enableCompression, LogicalType::copy(types)); |
| 46 | nodeGroups.appendGroup(lock, std::move(newGroup)); |
| 47 | } |
| 48 | lastNodeGroup = nodeGroups.getLastGroup(lock); |
| 49 | const auto numToAppendInNodeGroup = |
| 50 | std::min(numRowsToAppend - numRowsAppended, lastNodeGroup->getNumRowsLeftToAppend()); |
| 51 | lastNodeGroup->moveNextRowToAppend(numToAppendInNodeGroup); |
| 52 | pushInsertInfo(transaction, lastNodeGroup, numToAppendInNodeGroup); |
| 53 | numTotalRows += numToAppendInNodeGroup; |
| 54 | lastNodeGroup->append(transaction, vectors, numRowsAppended, numToAppendInNodeGroup); |
| 55 | numRowsAppended += numToAppendInNodeGroup; |
| 56 | } |
| 57 | stats.update(vectors); |
| 58 | } |
| 59 | |
| 60 | void NodeGroupCollection::append(const Transaction* transaction, |
| 61 | const std::vector<column_id_t>& columnIDs, const NodeGroupCollection& other) { |
no test coverage detected