42 requires std::integral<T> && std::numeric_limits<T>::is_signed
49 requires std::integral<T> && (!std::numeric_limits<T>::is_signed)
55 requires std::is_floating_point<T>::value
62 return this->signedInt == other.
signedInt;
65 template<StorageValueType T>
70 template<StorageValueType T>
74 }
else if constexpr (std::integral<T>) {
75 if constexpr (std::numeric_limits<T>::is_signed) {
80 }
else if constexpr (std::is_floating_point<T>()) {
91static_assert(std::is_trivial_v<StorageValue>);
131 const std::optional<common::NullMask>& nullMask = std::nullopt)
const;
170 uint8_t* dstBuffer, uint64_t dstBufferSize,
177 uint8_t* dstBuffer, uint64_t dstOffset, uint64_t numValues,
187 dataType{logicalType.getPhysicalType()} {}
202 uint8_t* dstBuffer, uint64_t dstOffset, uint64_t numValues,
216 uint8_t numBytesPerValue;
242 uint8_t* dstBuffer, uint64_t dstBufferSize,
250 std::memcpy(dstBuffer, srcBuffer, sizeToCopy);
251 srcBuffer += sizeToCopy;
279template<IntegerBitpackingType T>
311 uint8_t* dstBuffer, uint64_t dstBufferSize,
319 const std::optional<common::NullMask>& nullMask = std::nullopt,
320 uint64_t nullMaskOffset = 0);
328 void getValues(
const uint8_t* chunkStart, uint8_t pos, uint8_t* dst, uint8_t numValuesToRead,
332 uint8_t bitWidth)
const {
342 size_t numValuesToCopy)
const;
358 static inline uint64_t
numValues(uint64_t dataSize) {
return dataSize * 8; }
361 uint8_t* dstBuffer, uint64_t dstBufferSize,
367 void copyFromPage(
const uint8_t* srcBuffer, uint64_t srcOffset, uint8_t* dstBuffer,
405 void operator()(
const uint8_t* frame, PageCursor& pageCursor, uint8_t* result,
415 void operator()(uint8_t* frame, uint16_t posInFrame,
const uint8_t* data,
#define KU_ASSERT(condition)
Definition assert.h:19
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
BooleanBitpacking()=default
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
IntegerBitpacking()=default
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)
Definition compression.h:399
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)
Definition compression.h:389
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 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: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