| 439 | } |
| 440 | |
| 441 | std::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 | |
| 467 | std::unique_ptr<ChunkedNodeGroup> InMemChunkedNodeGroup::flush(const Transaction* transaction, |
| 468 | PageAllocator& pageAllocator) { |