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

Method allocateFlatTupleBlocks

src/processor/result/factorized_table.cpp:366–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366std::vector<BlockAppendingInfo> FactorizedTable::allocateFlatTupleBlocks(
367 uint64_t numTuplesToAppend) {
368 auto numBytesPerTuple = tableSchema.getNumBytesPerTuple();
369 std::vector<BlockAppendingInfo> appendingInfos;
370 while (numTuplesToAppend > 0) {
371 if (flatTupleBlockCollection->needAllocation(numBytesPerTuple)) {
372 auto newBlock = std::make_unique<DataBlock>(memoryManager, flatTupleBlockSize);
373 flatTupleBlockCollection->append(std::move(newBlock));
374 }
375 auto block = flatTupleBlockCollection->getLastBlock();
376 auto numTuplesToAppendInCurBlock =
377 std::min(numTuplesToAppend, block->freeSize / numBytesPerTuple);
378 appendingInfos.emplace_back(block->getWritableData(), numTuplesToAppendInCurBlock);
379 block->freeSize -= numTuplesToAppendInCurBlock * numBytesPerTuple;
380 block->numTuples += numTuplesToAppendInCurBlock;
381 numTuplesToAppend -= numTuplesToAppendInCurBlock;
382 }
383 return appendingInfos;
384}
385
386uint64_t getDataBlockSize(uint32_t numBytes) {
387 if (numBytes < TEMP_PAGE_SIZE) {

Callers 2

appendVectorsMethod · 0.80

Calls 6

needAllocationMethod · 0.80
getLastBlockMethod · 0.80
emplace_backMethod · 0.80
getWritableDataMethod · 0.80
getNumBytesPerTupleMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected