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

Function compressBuffer

test/storage/compress_chunk_test.cpp:95–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94template<std::floating_point T>
95ColumnChunkMetadata compressBuffer(const std::vector<T>& bufferToCompress,
96 const std::shared_ptr<FloatCompression<T>>& alg, const CompressionMetadata* metadata,
97 FileHandle* dataFH, const LogicalType& dataType) {
98
99 auto preScanMetadata = GetFloatCompressionMetadata<T>{alg, dataType}.operator()(
100 byteSpan(bufferToCompress), bufferToCompress.size(), metadata->min, metadata->max);
101 auto allocatedBlock =
102 dataFH->getPageManager()->allocatePageRange(preScanMetadata.getNumPages());
103
104 if (preScanMetadata.compMeta.compression == CompressionType::CONSTANT) {
105 return preScanMetadata;
106 }
107
108 return CompressedFloatFlushBuffer<T>{alg, dataType}.operator()(byteSpan(bufferToCompress),
109 dataFH, allocatedBlock, preScanMetadata);
110}
111
112template<std::floating_point T>
113void CompressChunkTest::commitUpdate(SegmentState& state, FileHandle* dataFH,

Callers 1

testCompressChunkMethod · 0.85

Calls 6

byteSpanFunction · 0.85
getPageManagerMethod · 0.80
operator()Method · 0.45
sizeMethod · 0.45
allocatePageRangeMethod · 0.45
getNumPagesMethod · 0.45

Tested by

no test coverage detected