Kùzu C++ API
Loading...
Searching...
No Matches
compression.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <cstring>
5#include <optional>
6#include <type_traits>
7
8#include "assert.h"
9#include "null_mask.h"
10#include "numeric_utils.h"
11#include "types.h"
12#include <concepts>
13#include <span>
14
15namespace kuzu {
16namespace common {
17class ValueVector;
18class NullMask;
19} // namespace common
20
21namespace storage {
22class ColumnChunkData;
23
24struct PageCursor;
25
26template<typename T>
27concept StorageValueType = (common::numeric_utils::IsIntegral<T> || std::floating_point<T>);
28// Type storing values in the column chunk statistics
29// Only supports integers (up to 128bit), floats and bools
31 int64_t signedInt;
32 uint64_t unsignedInt;
33 double floatVal;
35
36 StorageValue() = default;
37 template<typename T>
38 requires std::same_as<std::remove_cvref_t<T>, common::int128_t>
39 explicit StorageValue(T value) : signedInt128(value) {}
40
41 template<typename T>
42 requires std::integral<T> && std::numeric_limits<T>::is_signed
43 // zero-initilize union padding
44 explicit StorageValue(T value) : StorageValue(common::int128_t(0)) {
45 signedInt = value;
46 }
47
48 template<typename T>
49 requires std::integral<T> && (!std::numeric_limits<T>::is_signed)
50 explicit StorageValue(T value) : StorageValue(common::int128_t(0)) {
51 unsignedInt = value;
52 }
53
54 template<typename T>
55 requires std::is_floating_point<T>::value
56 explicit StorageValue(T value) : StorageValue(common::int128_t(0)) {
57 floatVal = value;
58 }
59
60 bool operator==(const StorageValue& other) const {
61 // All types are the same size, so we can compare any of them to check equality
62 return this->signedInt == other.signedInt;
63 }
64
65 template<StorageValueType T>
66 StorageValue& operator=(const T& val) {
67 return *this = StorageValue(val);
68 }
69
70 template<StorageValueType T>
71 T get() const {
72 if constexpr (std::same_as<std::remove_cvref_t<T>, common::int128_t>) {
73 return signedInt128;
74 } else if constexpr (std::integral<T>) {
75 if constexpr (std::numeric_limits<T>::is_signed) {
76 return static_cast<T>(signedInt);
77 } else {
78 return static_cast<T>(unsignedInt);
79 }
80 } else if constexpr (std::is_floating_point<T>()) {
81 return floatVal;
82 }
83 }
84
85 bool gt(const StorageValue& other, common::PhysicalTypeID type) const;
86
87 // If the type cannot be stored in the statistics, readFromVector will return nullopt
88 static std::optional<StorageValue> readFromVector(const common::ValueVector& vector,
89 common::offset_t posInVector);
90};
91static_assert(std::is_trivial_v<StorageValue>);
92
93std::pair<std::optional<StorageValue>, std::optional<StorageValue>> getMinMaxStorageValue(
94 const uint8_t* data, uint64_t offset, uint64_t numValues, common::PhysicalTypeID physicalType,
95 const common::NullMask* nullMask, bool valueRequiredIfUnsupported = false);
96
97// Returns the size of the data type in bytes
100
101// Compression type is written to the data header both so we can usually catch issues when we
102// decompress uncompressed data by mistake, and to allow for runtime-configurable compression.
103enum class CompressionType : uint8_t {
104 UNCOMPRESSED = 0,
107 CONSTANT = 3,
108};
109
110// Data statistics used for determining how to handle compressed data
112 // Minimum and maximum are upper and lower bounds for the data.
113 // Updates and deletions may cause them to no longer be the exact minimums and maximums,
114 // but no value will be larger than the maximum or smaller than the minimum
118 uint8_t _padding[7]{};
119
122 inline bool isConstant() const { return compression == CompressionType::CONSTANT; }
123
124 // Returns the number of values which will be stored in the given data size
125 // This must be consistent with the compression implementation for the given size
126 uint64_t numValues(uint64_t dataSize, const common::LogicalType& dataType) const;
127 // Returns true if and only if the provided value within the vector can be updated
128 // in this chunk in-place.
129 bool canUpdateInPlace(const uint8_t* data, uint32_t pos, uint64_t numValues,
130 common::PhysicalTypeID physicalType,
131 const std::optional<common::NullMask>& nullMask = std::nullopt) const;
133
134 std::string toString(const common::PhysicalTypeID physicalType) const;
135};
136// Padding should be kept to a minimum, but must be stored explicitly for consistent binary output
137// when writing the padding to disk.
138static_assert(sizeof(CompressionMetadata) == sizeof(StorageValue) * 2 + 8);
139
141public:
142 virtual ~CompressionAlg() = default;
143
144 // Takes a single uncompressed value from the srcBuffer and compresses it into the dstBuffer
145 // Offsets refer to value offsets, not byte offsets
146 //
147 // nullMask may be null if no mask is available (all values are non-null)
148 // Storage of null values is handled by the implementation and decompression of null values
149 // does not have to produce the original value passed to this function.
150 virtual void setValuesFromUncompressed(const uint8_t* srcBuffer, common::offset_t srcOffset,
151 uint8_t* dstBuffer, common::offset_t dstOffset, common::offset_t numValues,
152 const CompressionMetadata& metadata, const common::NullMask* nullMask) const = 0;
153
154 // Takes uncompressed data from the srcBuffer and compresses it into the dstBuffer
155 //
156 // stores only as much data in dstBuffer as will fit, and advances the srcBuffer pointer
157 // to the beginning of the next value to store.
158 // (This means that we can't start the next page on an unaligned value.
159 // Maybe instead we could use value offsets, but the compression algorithms
160 // usually work on aligned chunks anyway)
161 //
162 // dstBufferSize is the size in bytes
163 // numValuesRemaining is the number of values remaining in the srcBuffer to be compressed.
164 // compressNextPage must store the least of either the number of values per page
165 // (as calculated by CompressionMetadata::numValues), or the remaining number of values.
166 //
167 // returns the size in bytes of the compressed data within the page (rounded up to the nearest
168 // byte)
169 virtual uint64_t compressNextPage(const uint8_t*& srcBuffer, uint64_t numValuesRemaining,
170 uint8_t* dstBuffer, uint64_t dstBufferSize,
171 const struct CompressionMetadata& metadata) const = 0;
172
173 // Takes compressed data from the srcBuffer and decompresses it into the dstBuffer
174 // Offsets refer to value offsets, not byte offsets
175 // srcBuffer points to the beginning of a page
176 virtual void decompressFromPage(const uint8_t* srcBuffer, uint64_t srcOffset,
177 uint8_t* dstBuffer, uint64_t dstOffset, uint64_t numValues,
178 const CompressionMetadata& metadata) const = 0;
179
181};
182
184public:
185 explicit ConstantCompression(const common::LogicalType& logicalType)
186 : numBytesPerValue{static_cast<uint8_t>(getDataTypeSizeInChunk(logicalType))},
187 dataType{logicalType.getPhysicalType()} {}
188 static std::optional<CompressionMetadata> analyze(const ColumnChunkData& chunk);
189
190 // Shouldn't be used, there's a special case when compressing which ends early for constant
191 // compression
192 uint64_t compressNextPage(const uint8_t*&, uint64_t, uint8_t*, uint64_t,
193 const struct CompressionMetadata&) const override {
194 return 0;
195 };
196
197 static void decompressValues(uint8_t* dstBuffer, uint64_t dstOffset, uint64_t numValues,
198 common::PhysicalTypeID physicalType, uint32_t numBytesPerValue,
199 const CompressionMetadata& metadata);
200
201 void decompressFromPage(const uint8_t* /*srcBuffer*/, uint64_t /*srcOffset*/,
202 uint8_t* dstBuffer, uint64_t dstOffset, uint64_t numValues,
203 const CompressionMetadata& metadata) const override;
204
205 void copyFromPage(const uint8_t* /*srcBuffer*/, uint64_t /*srcOffset*/, uint8_t* dstBuffer,
206 uint64_t dstOffset, uint64_t numValues, const CompressionMetadata& metadata) const;
207
208 // Nothing to do; constant compressed data is only updated if the update is to the same value
211 const common::NullMask* /*nullMask*/) const override {};
212
214
215private:
216 uint8_t numBytesPerValue;
217 common::PhysicalTypeID dataType;
218};
219
220// Compression alg which does not compress values and instead just copies them.
222public:
223 explicit Uncompressed(const common::LogicalType& logicalType)
226
227 Uncompressed(const Uncompressed&) = default;
228
229 inline void setValuesFromUncompressed(const uint8_t* srcBuffer, common::offset_t srcOffset,
230 uint8_t* dstBuffer, common::offset_t dstOffset, common::offset_t numValues,
231 const CompressionMetadata& /*metadata*/, const common::NullMask* /*nullMask*/) const final {
232 memcpy(dstBuffer + dstOffset * numBytesPerValue, srcBuffer + srcOffset * numBytesPerValue,
234 }
235
236 static inline uint64_t numValues(uint64_t dataSize, const common::LogicalType& logicalType) {
237 auto numBytesPerValue = getDataTypeSizeInChunk(logicalType);
238 return numBytesPerValue == 0 ? UINT64_MAX : dataSize / numBytesPerValue;
239 }
240
241 inline uint64_t compressNextPage(const uint8_t*& srcBuffer, uint64_t numValuesRemaining,
242 uint8_t* dstBuffer, uint64_t dstBufferSize,
243 const struct CompressionMetadata& /*metadata*/) const override {
244 if (numBytesPerValue == 0) {
245 return 0;
246 }
247 uint64_t numValues = std::min(numValuesRemaining, dstBufferSize / numBytesPerValue);
248 uint64_t sizeToCopy = numValues * numBytesPerValue;
249 KU_ASSERT(sizeToCopy <= dstBufferSize);
250 std::memcpy(dstBuffer, srcBuffer, sizeToCopy);
251 srcBuffer += sizeToCopy;
252 return sizeToCopy;
253 }
254
255 inline void decompressFromPage(const uint8_t* srcBuffer, uint64_t srcOffset, uint8_t* dstBuffer,
256 uint64_t dstOffset, uint64_t numValues,
257 const CompressionMetadata& /*metadata*/) const override {
258 std::memcpy(dstBuffer + dstOffset * numBytesPerValue,
259 srcBuffer + srcOffset * numBytesPerValue, numValues * numBytesPerValue);
260 }
261
263
264protected:
265 const uint32_t numBytesPerValue;
266};
267
268template<typename T>
270 uint8_t bitWidth;
273};
274
275template<typename T>
277
278// Augmented with Frame of Reference encoding using an offset stored in the compression metadata
279template<IntegerBitpackingType T>
282
283public:
284 // This is an implementation detail of the fastpfor bitpacking algorithm
285 static constexpr uint64_t CHUNK_SIZE = 32;
286
287public:
288 IntegerBitpacking() = default;
290
291 void setValuesFromUncompressed(const uint8_t* srcBuffer, common::offset_t srcOffset,
292 uint8_t* dstBuffer, common::offset_t dstOffset, common::offset_t numValues,
293 const CompressionMetadata& metadata, const common::NullMask* nullMask) const final;
294
296
297 static inline uint64_t numValues(uint64_t dataSize, const BitpackInfo<T>& info) {
298 if (info.bitWidth == 0) {
299 return UINT64_MAX;
300 }
301 auto numValues = dataSize * 8 / info.bitWidth;
302 return numValues;
303 }
304
305 static inline uint64_t numValues(uint64_t dataSize, const CompressionMetadata& metadata) {
306 auto info = getPackingInfo(metadata);
307 return numValues(dataSize, info);
308 }
309
310 uint64_t compressNextPage(const uint8_t*& srcBuffer, uint64_t numValuesRemaining,
311 uint8_t* dstBuffer, uint64_t dstBufferSize,
312 const struct CompressionMetadata& metadata) const final;
313
314 void decompressFromPage(const uint8_t* srcBuffer, uint64_t srcOffset, uint8_t* dstBuffer,
315 uint64_t dstOffset, uint64_t numValues,
316 const struct CompressionMetadata& metadata) const final;
317
318 static bool canUpdateInPlace(std::span<T> value, const CompressionMetadata& metadata,
319 const std::optional<common::NullMask>& nullMask = std::nullopt,
320 uint64_t nullMaskOffset = 0);
321
325
326protected:
327 // Read multiple values from within a chunk. Cannot span multiple chunks.
328 void getValues(const uint8_t* chunkStart, uint8_t pos, uint8_t* dst, uint8_t numValuesToRead,
329 const BitpackInfo<T>& header) const;
330
331 inline const uint8_t* getChunkStart(const uint8_t* buffer, uint64_t pos,
332 uint8_t bitWidth) const {
333 // Order of operations is important so that pos is rounded down to a multiple of
334 // CHUNK_SIZE
335 return buffer + (pos / CHUNK_SIZE) * bitWidth * CHUNK_SIZE / 8;
336 }
337
338 void packPartialChunk(const U* srcBuffer, uint8_t* dstBuffer, size_t posInDst,
339 BitpackInfo<T> info, size_t remainingValues) const;
340
341 void copyValuesToTempChunkWithOffset(const U* srcBuffer, U* tmpBuffer, BitpackInfo<T> info,
342 size_t numValuesToCopy) const;
343
344 void setPartialChunkInPlace(const uint8_t* srcBuffer, common::offset_t posInSrc,
345 uint8_t* dstBuffer, common::offset_t posInDst, common::offset_t numValues,
346 const BitpackInfo<T>& header) const;
347};
348
350public:
351 BooleanBitpacking() = default;
353
354 void setValuesFromUncompressed(const uint8_t* srcBuffer, common::offset_t srcOffset,
355 uint8_t* dstBuffer, common::offset_t dstOffset, common::offset_t numValues,
356 const CompressionMetadata& metadata, const common::NullMask* nullMask) const final;
357
358 static inline uint64_t numValues(uint64_t dataSize) { return dataSize * 8; }
359
360 uint64_t compressNextPage(const uint8_t*& srcBuffer, uint64_t numValuesRemaining,
361 uint8_t* dstBuffer, uint64_t dstBufferSize,
362 const struct CompressionMetadata& metadata) const final;
363
364 void decompressFromPage(const uint8_t* srcBuffer, uint64_t srcOffset, uint8_t* dstBuffer,
365 uint64_t dstOffset, uint64_t numValues, const CompressionMetadata& metadata) const final;
366
367 void copyFromPage(const uint8_t* srcBuffer, uint64_t srcOffset, uint8_t* dstBuffer,
368 uint64_t dstOffset, uint64_t numValues, const CompressionMetadata& metadata) const;
369
373};
374
376public:
378
379protected:
380 explicit CompressedFunctor(const common::LogicalType& logicalType)
381 : constant{logicalType}, uncompressed{logicalType},
382 physicalType{logicalType.getPhysicalType()} {}
387};
388
390public:
392 : CompressedFunctor(logicalType) {}
394
395 void operator()(const uint8_t* frame, PageCursor& pageCursor, common::ValueVector* resultVector,
396 uint32_t posInVector, uint32_t numValuesToRead, const CompressionMetadata& metadata);
397};
398
400public:
402 : CompressedFunctor(logicalType) {}
404
405 void operator()(const uint8_t* frame, PageCursor& pageCursor, uint8_t* result,
406 uint32_t startPosInResult, uint64_t numValuesToRead, const CompressionMetadata& metadata);
407};
408
410public:
412 : CompressedFunctor(logicalType) {}
414
415 void operator()(uint8_t* frame, uint16_t posInFrame, const uint8_t* data,
416 common::offset_t dataOffset, common::offset_t numValues,
417 const CompressionMetadata& metadata, const common::NullMask* nullMask = nullptr);
418
419 void operator()(uint8_t* frame, uint16_t posInFrame, common::ValueVector* vector,
420 uint32_t posInVector, const CompressionMetadata& metadata);
421};
422
423} // namespace storage
424} // namespace kuzu
#define KU_ASSERT(condition)
Definition assert.h:19
Definition types.h:201
Definition null_mask.h:70
Definition value_vector.h:20
Definition compression.h:349
void setValuesFromUncompressed(const uint8_t *srcBuffer, common::offset_t srcOffset, uint8_t *dstBuffer, common::offset_t dstOffset, common::offset_t numValues, const CompressionMetadata &metadata, const common::NullMask *nullMask) const final
uint64_t compressNextPage(const uint8_t *&srcBuffer, uint64_t numValuesRemaining, uint8_t *dstBuffer, uint64_t dstBufferSize, const struct CompressionMetadata &metadata) const final
void decompressFromPage(const uint8_t *srcBuffer, uint64_t srcOffset, uint8_t *dstBuffer, uint64_t dstOffset, uint64_t numValues, const CompressionMetadata &metadata) const final
static uint64_t numValues(uint64_t dataSize)
Definition compression.h:358
CompressionType getCompressionType() const override
Definition compression.h:370
BooleanBitpacking(const BooleanBitpacking &)=default
void copyFromPage(const uint8_t *srcBuffer, uint64_t srcOffset, uint8_t *dstBuffer, uint64_t dstOffset, uint64_t numValues, const CompressionMetadata &metadata) const
Definition column_chunk_data.h:85
Definition compression.h:375
CompressedFunctor(const CompressedFunctor &)=default
CompressedFunctor(const common::LogicalType &logicalType)
Definition compression.h:380
const Uncompressed uncompressed
Definition compression.h:384
const ConstantCompression constant
Definition compression.h:383
const common::PhysicalTypeID physicalType
Definition compression.h:386
const BooleanBitpacking booleanBitpacking
Definition compression.h:385
Definition compression.h:140
virtual void setValuesFromUncompressed(const uint8_t *srcBuffer, common::offset_t srcOffset, uint8_t *dstBuffer, common::offset_t dstOffset, common::offset_t numValues, const CompressionMetadata &metadata, const common::NullMask *nullMask) const =0
virtual CompressionType getCompressionType() const =0
virtual ~CompressionAlg()=default
virtual void decompressFromPage(const uint8_t *srcBuffer, uint64_t srcOffset, uint8_t *dstBuffer, uint64_t dstOffset, uint64_t numValues, const CompressionMetadata &metadata) const =0
virtual uint64_t compressNextPage(const uint8_t *&srcBuffer, uint64_t numValuesRemaining, uint8_t *dstBuffer, uint64_t dstBufferSize, const struct CompressionMetadata &metadata) const =0
Definition compression.h:183
void decompressFromPage(const uint8_t *, uint64_t, uint8_t *dstBuffer, uint64_t dstOffset, uint64_t numValues, const CompressionMetadata &metadata) const override
static std::optional< CompressionMetadata > analyze(const ColumnChunkData &chunk)
uint64_t compressNextPage(const uint8_t *&, uint64_t, uint8_t *, uint64_t, const struct CompressionMetadata &) const override
Definition compression.h:192
CompressionType getCompressionType() const override
Definition compression.h:213
void setValuesFromUncompressed(const uint8_t *, common::offset_t, uint8_t *, common::offset_t, common::offset_t, const CompressionMetadata &, const common::NullMask *) const override
Definition compression.h:209
static void decompressValues(uint8_t *dstBuffer, uint64_t dstOffset, uint64_t numValues, common::PhysicalTypeID physicalType, uint32_t numBytesPerValue, const CompressionMetadata &metadata)
void copyFromPage(const uint8_t *, uint64_t, uint8_t *dstBuffer, uint64_t dstOffset, uint64_t numValues, const CompressionMetadata &metadata) const
ConstantCompression(const common::LogicalType &logicalType)
Definition compression.h:185
Definition compression.h:280
void packPartialChunk(const U *srcBuffer, uint8_t *dstBuffer, size_t posInDst, BitpackInfo< T > info, size_t remainingValues) const
CompressionType getCompressionType() const override
Definition compression.h:322
IntegerBitpacking(const IntegerBitpacking &)=default
static uint64_t numValues(uint64_t dataSize, const CompressionMetadata &metadata)
Definition compression.h:305
void decompressFromPage(const uint8_t *srcBuffer, uint64_t srcOffset, uint8_t *dstBuffer, uint64_t dstOffset, uint64_t numValues, const struct CompressionMetadata &metadata) const final
static bool canUpdateInPlace(std::span< T > value, const CompressionMetadata &metadata, const std::optional< common::NullMask > &nullMask=std::nullopt, uint64_t nullMaskOffset=0)
void setPartialChunkInPlace(const uint8_t *srcBuffer, common::offset_t posInSrc, uint8_t *dstBuffer, common::offset_t posInDst, common::offset_t numValues, const BitpackInfo< T > &header) const
static uint64_t numValues(uint64_t dataSize, const BitpackInfo< T > &info)
Definition compression.h:297
const uint8_t * getChunkStart(const uint8_t *buffer, uint64_t pos, uint8_t bitWidth) const
Definition compression.h:331
void setValuesFromUncompressed(const uint8_t *srcBuffer, common::offset_t srcOffset, uint8_t *dstBuffer, common::offset_t dstOffset, common::offset_t numValues, const CompressionMetadata &metadata, const common::NullMask *nullMask) const final
void copyValuesToTempChunkWithOffset(const U *srcBuffer, U *tmpBuffer, BitpackInfo< T > info, size_t numValuesToCopy) const
static constexpr uint64_t CHUNK_SIZE
Definition compression.h:285
void getValues(const uint8_t *chunkStart, uint8_t pos, uint8_t *dst, uint8_t numValuesToRead, const BitpackInfo< T > &header) const
uint64_t compressNextPage(const uint8_t *&srcBuffer, uint64_t numValuesRemaining, uint8_t *dstBuffer, uint64_t dstBufferSize, const struct CompressionMetadata &metadata) const final
static BitpackInfo< T > getPackingInfo(const CompressionMetadata &metadata)
ReadCompressedValuesFromPage(const ReadCompressedValuesFromPage &)=default
ReadCompressedValuesFromPage(const common::LogicalType &logicalType)
Definition compression.h:401
void operator()(const uint8_t *frame, PageCursor &pageCursor, uint8_t *result, uint32_t startPosInResult, uint64_t numValuesToRead, const CompressionMetadata &metadata)
ReadCompressedValuesFromPageToVector(const ReadCompressedValuesFromPageToVector &)=default
void operator()(const uint8_t *frame, PageCursor &pageCursor, common::ValueVector *resultVector, uint32_t posInVector, uint32_t numValuesToRead, const CompressionMetadata &metadata)
ReadCompressedValuesFromPageToVector(const common::LogicalType &logicalType)
Definition compression.h:391
Definition compression.h:221
CompressionType getCompressionType() const override
Definition compression.h:262
void setValuesFromUncompressed(const uint8_t *srcBuffer, common::offset_t srcOffset, uint8_t *dstBuffer, common::offset_t dstOffset, common::offset_t numValues, const CompressionMetadata &, const common::NullMask *) const final
Definition compression.h:229
static uint64_t numValues(uint64_t dataSize, const common::LogicalType &logicalType)
Definition compression.h:236
void decompressFromPage(const uint8_t *srcBuffer, uint64_t srcOffset, uint8_t *dstBuffer, uint64_t dstOffset, uint64_t numValues, const CompressionMetadata &) const override
Definition compression.h:255
Uncompressed(uint8_t numBytesPerValue)
Definition compression.h:225
const uint32_t numBytesPerValue
Definition compression.h:265
uint64_t compressNextPage(const uint8_t *&srcBuffer, uint64_t numValuesRemaining, uint8_t *dstBuffer, uint64_t dstBufferSize, const struct CompressionMetadata &) const override
Definition compression.h:241
Uncompressed(const common::LogicalType &logicalType)
Definition compression.h:223
Uncompressed(const Uncompressed &)=default
Definition compression.h:409
void operator()(uint8_t *frame, uint16_t posInFrame, const uint8_t *data, common::offset_t dataOffset, common::offset_t numValues, const CompressionMetadata &metadata, const common::NullMask *nullMask=nullptr)
void operator()(uint8_t *frame, uint16_t posInFrame, common::ValueVector *vector, uint32_t posInVector, const CompressionMetadata &metadata)
WriteCompressedValuesToPage(const WriteCompressedValuesToPage &)=default
WriteCompressedValuesToPage(const common::LogicalType &logicalType)
Definition compression.h:411
Definition numeric_utils.h:15
Definition compression.h:276
Definition compression.h:27
typename MakeUnSigned< T >::type MakeUnSignedT
Definition numeric_utils.h:48
PhysicalTypeID
Definition types.h:171
uint64_t offset_t
Definition internal_id_t.h:22
uint32_t getDataTypeSizeInChunk(const common::LogicalType &dataType)
std::pair< std::optional< StorageValue >, std::optional< StorageValue > > getMinMaxStorageValue(const uint8_t *data, uint64_t offset, uint64_t numValues, common::PhysicalTypeID physicalType, const common::NullMask *nullMask, bool valueRequiredIfUnsupported=false)
CompressionType
Definition compression.h:103
Definition alter_type.h:5
Definition int128_t.h:20
Definition compression.h:269
bool hasNegative
Definition compression.h:271
T offset
Definition compression.h:272
uint8_t bitWidth
Definition compression.h:270
Definition compression.h:111
std::string toString(const common::PhysicalTypeID physicalType) const
StorageValue max
Definition compression.h:116
CompressionType compression
Definition compression.h:117
CompressionMetadata(StorageValue min, StorageValue max, CompressionType compression)
Definition compression.h:120
uint8_t _padding[7]
Definition compression.h:118
StorageValue min
Definition compression.h:115
bool canUpdateInPlace(const uint8_t *data, uint32_t pos, uint64_t numValues, common::PhysicalTypeID physicalType, const std::optional< common::NullMask > &nullMask=std::nullopt) const
bool isConstant() const
Definition compression.h:122
uint64_t numValues(uint64_t dataSize, const common::LogicalType &dataType) const
Definition compression.h:30
T get() const
Definition compression.h:71
common::int128_t signedInt128
Definition compression.h:34
static std::optional< StorageValue > readFromVector(const common::ValueVector &vector, common::offset_t posInVector)
bool gt(const StorageValue &other, common::PhysicalTypeID type) const
int64_t signedInt
Definition compression.h:31
bool operator==(const StorageValue &other) const
Definition compression.h:60
StorageValue(T value)
Definition compression.h:39
StorageValue(T value)
Definition compression.h:56
double floatVal
Definition compression.h:33
StorageValue(T value)
Definition compression.h:50
StorageValue(T value)
Definition compression.h:44
StorageValue & operator=(const T &val)
Definition compression.h:66
uint64_t unsignedInt
Definition compression.h:32