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

Method flushInternal

src/storage/table/chunked_node_group.cpp:441–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439}
440
441std::unique_ptr<ColumnChunk> InMemChunkedNodeGroup::flushInternal(ColumnChunkData& chunk,
442 PageAllocator& pageAllocator) {
443 // Finalize is necessary prior to splitting for strings and lists so that pruned values
444 // don't have an impact on the number/size of segments It should not be necessary after
445 // splitting since the function is used to prune unused values (or duplicated dictionary
446 // entries in the case of strings) and those will never be introduced when splitting.
447 chunk.finalize();
448 if (chunk.shouldSplit()) {
449 auto splitSegments = chunk.split(true /*new segments are always the max size if possible*/);
450 std::vector<std::unique_ptr<ColumnChunkData>> flushedSegments;
451 flushedSegments.reserve(splitSegments.size());
452 for (auto& segment : splitSegments) {
453 // TODO(bmwinger): This should be removed when splitting works predictively instead of
454 // backtracking if we copy too many values
455 // It's only needed to prune values from string/list chunks which were truncated
456 segment->finalize();
457 flushedSegments.push_back(Column::flushChunkData(*segment, pageAllocator));
458 }
459 return std::make_unique<ColumnChunk>(chunk.isCompressionEnabled(),
460 std::move(flushedSegments));
461 } else {
462 return std::make_unique<ColumnChunk>(chunk.isCompressionEnabled(),
463 Column::flushChunkData(chunk, pageAllocator));
464 }
465}
466
467std::unique_ptr<ChunkedNodeGroup> InMemChunkedNodeGroup::flush(const Transaction* transaction,
468 PageAllocator& pageAllocator) {

Callers

nothing calls this directly

Calls 6

isCompressionEnabledMethod · 0.80
finalizeMethod · 0.45
splitMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected