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

Method append

src/storage/table/node_group_collection.cpp:27–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void 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
60void NodeGroupCollection::append(const Transaction* transaction,
61 const std::vector<column_id_t>& columnIDs, const NodeGroupCollection& other) {

Calls 15

mergeStatsFunction · 0.85
getSelSizeMethod · 0.80
appendGroupMethod · 0.80
getLastGroupMethod · 0.80
isFullMethod · 0.80
moveNextRowToAppendMethod · 0.80
getDataTypesMethod · 0.80
getNumChunkedGroupsMethod · 0.80
getChunkedNodeGroupMethod · 0.80
copyFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected