15class ExpressionEvaluator;
18namespace transaction {
55 nullState = std::make_unique<ChunkState>(
false );
60 nullState = std::make_unique<ChunkState>(
false );
78 childState.resetState();
99 return reinterpret_cast<T*
>(
buffer.get())[pos];
105 reinterpret_cast<T*
>(
buffer.get())[pos] = val;
145 uint32_t numValuesToAppend);
147 virtual void flush(BMFileHandle& dataFH);
181 virtual void resize(uint64_t newCapacity);
184 uint64_t& numValues_);
205 template<
typename TARGET>
209 template<
typename TARGET>
227 uint64_t getBufferSize(uint64_t capacity_)
const;
235 std::function<std::pair<StorageValue, StorageValue>(
const uint8_t*, uint64_t)>;
277 uint32_t numValuesToAppend)
override;
321 uint64_t numBits,
bool invert =
false) {
323 reinterpret_cast<uint64_t*
>(
buffer.get()), dstOffset, numBits, invert)) {
333 uint32_t numValuesToAppend)
override;
359 commonTableID{common::INVALID_TABLE_ID} {}
363 commonTableID{common::INVALID_TABLE_ID} {}
382 uint32_t numValuesToAppend)
override;
400 bool enableCompression, uint64_t capacity,
ResidencyState residencyState,
401 bool hasNullData =
true);
407 return std::make_unique<NullChunkData>(capacity, enableCompression, type);
#define KU_ASSERT(condition)
Definition assert.h:19
Definition deserializer.h:15
Definition null_mask.h:70
static bool copyNullMask(const uint64_t *srcNullEntries, uint64_t srcOffset, uint64_t *dstNullEntries, uint64_t dstOffset, uint64_t numBitsToCopy, bool invert=false)
static bool isNull(const uint64_t *nullEntries, uint32_t pos)
Definition null_mask.h:112
static void setNull(uint64_t *nullEntries, uint32_t pos, bool isNull)
Definition sel_vector.h:12
Definition serializer.h:15
Definition value_vector.h:20
Definition column_chunk_data.h:266
void append(ColumnChunkData *other, common::offset_t startPosInOtherChunk, uint32_t numValuesToAppend) override
void append(common::ValueVector *vector, const common::SelectionVector &sel) final
void write(const common::ValueVector *vector, common::offset_t offsetInVector, common::offset_t offsetInChunk) override
void lookup(common::offset_t offsetInChunk, common::ValueVector &output, common::sel_t posInOutputVector) const override
BoolChunkData(uint64_t capacity, bool enableCompression, ResidencyState type, bool hasNullChunk)
Definition column_chunk_data.h:268
void write(ColumnChunkData *chunk, ColumnChunkData *dstOffsets, common::RelMultiplicity multiplicity) final
BoolChunkData(bool enableCompression, const ColumnChunkMetadata &metadata, bool hasNullData)
Definition column_chunk_data.h:272
void write(ColumnChunkData *srcChunk, common::offset_t srcOffsetInChunk, common::offset_t dstOffsetInChunk, common::offset_t numValuesToCopy) override
void scan(common::ValueVector &output, common::offset_t offset, common::length_t length, common::sel_t posInOutputVector=0) const override
Definition column_chunk_data.h:85
uint64_t numValues
Definition column_chunk_data.h:245
const TARGET & cast() const
Definition column_chunk_data.h:210
const NullChunkData & getNullData() const
Definition column_chunk_data.h:115
std::function< std::pair< StorageValue, StorageValue >(const uint8_t *, uint64_t)> get_min_max_func_t
Definition column_chunk_data.h:234
uint32_t numBytesPerValue
Definition column_chunk_data.h:240
uint64_t getCapacity() const
Definition column_chunk_data.h:190
virtual bool numValuesSanityCheck() const
const common::LogicalType & getDataType() const
Definition column_chunk_data.h:120
void setValue(T val, common::offset_t pos)
Definition column_chunk_data.h:102
std::unique_ptr< NullChunkData > nullData
Definition column_chunk_data.h:244
uint64_t getNumBytesPerValue() const
Definition column_chunk_data.h:157
std::unique_ptr< NullChunkData > moveNullData()
Definition column_chunk_data.h:117
ColumnChunkMetadata metadata
Definition column_chunk_data.h:250
virtual void initializeScanState(ChunkState &state) const
get_metadata_func_t getMetadataFunction
Definition column_chunk_data.h:247
virtual void copyVectorToBuffer(common::ValueVector *vector, common::offset_t startPosInChunk, const common::SelectionVector &selVector)
virtual void resetToEmpty()
bool isCompressionEnabled() const
Definition column_chunk_data.h:122
virtual void copy(ColumnChunkData *srcChunk, common::offset_t srcOffsetInChunk, common::offset_t dstOffsetInChunk, common::offset_t numValuesToCopy)
virtual void write(ColumnChunkData *srcChunk, common::offset_t srcOffsetInChunk, common::offset_t dstOffsetInChunk, common::offset_t numValuesToCopy)
virtual void scan(common::ValueVector &output, common::offset_t offset, common::length_t length, common::sel_t posInOutputVector=0) const
ColumnChunkMetadata & getMetadata()
Definition column_chunk_data.h:123
virtual void lookup(common::offset_t offsetInChunk, common::ValueVector &output, common::sel_t posInOutputVector) const
std::optional< common::NullMask > getNullMask() const
bool enableCompression
Definition column_chunk_data.h:239
virtual void resetNumValuesFromMetadata()
virtual uint64_t getNumValues() const
Definition column_chunk_data.h:191
ColumnChunkData(common::LogicalType dataType, uint64_t capacity, bool enableCompression, ResidencyState residencyState, bool hasNullData)
flush_buffer_func_t flushBufferFunction
Definition column_chunk_data.h:246
TARGET & cast()
Definition column_chunk_data.h:206
ColumnChunkMetadata flushBuffer(BMFileHandle *dataFH, common::page_idx_t startPageIdx, const ColumnChunkMetadata &metadata) const
uint8_t * getData() const
Definition column_chunk_data.h:158
T getValue(common::offset_t pos) const
Definition column_chunk_data.h:96
ColumnChunkData(common::LogicalType dataType, bool enableCompression, const ColumnChunkMetadata &metadata, bool hasNullData)
ResidencyState getResidencyState() const
Definition column_chunk_data.h:121
bool isNull(common::offset_t pos) const
virtual void append(common::ValueVector *vector, const common::SelectionVector &selVector)
const ColumnChunkMetadata & getMetadata() const
Definition column_chunk_data.h:127
static common::page_idx_t getNumPagesForBytes(uint64_t numBytes)
Definition column_chunk_data.h:152
common::LogicalType & getDataType()
Definition column_chunk_data.h:119
common::LogicalType dataType
Definition column_chunk_data.h:238
void setMetadata(const ColumnChunkMetadata &metadata_)
Definition column_chunk_data.h:131
virtual void syncNumValues()
Definition column_chunk_data.h:195
void initializeFunction(bool enableCompression)
virtual void setNumValues(uint64_t numValues_)
virtual void setToInMemory()
virtual void flush(BMFileHandle &dataFH)
void setNullData(std::unique_ptr< NullChunkData > nullData_)
Definition column_chunk_data.h:112
virtual void resetToAllNull()
virtual void write(ColumnChunkData *chunk, ColumnChunkData *offsetsInChunk, common::RelMultiplicity multiplicity)
virtual void resize(uint64_t newCapacity)
NullChunkData * getNullData()
Definition column_chunk_data.h:114
static std::unique_ptr< ColumnChunkData > deserialize(common::Deserializer &deSer)
virtual void write(const common::ValueVector *vector, common::offset_t offsetInVector, common::offset_t offsetInChunk)
std::unique_ptr< uint8_t[]> buffer
Definition column_chunk_data.h:243
void setToOnDisk(const ColumnChunkMetadata &metadata)
virtual void finalize()
Definition column_chunk_data.h:185
uint64_t capacity
Definition column_chunk_data.h:242
ResidencyState residencyState
Definition column_chunk_data.h:237
uint64_t bufferSize
Definition column_chunk_data.h:241
virtual uint64_t getEstimatedMemoryUsage() const
virtual bool sanityCheck() const
virtual ~ColumnChunkData()=default
bool hasNullData() const
Definition column_chunk_data.h:113
virtual ColumnChunkMetadata getMetadataToFlush() const
virtual void serialize(common::Serializer &serializer) const
virtual void append(ColumnChunkData *other, common::offset_t startPosInOtherChunk, uint32_t numValuesToAppend)
std::function< ColumnChunkMetadata(const uint8_t *, uint64_t, uint64_t, uint64_t, StorageValue, StorageValue)> get_metadata_func_t
Definition column_chunk_data.h:232
void populateWithDefaultVal(evaluator::ExpressionEvaluator &defaultEvaluator, uint64_t &numValues_)
std::function< ColumnChunkMetadata(const uint8_t *, uint64_t, BMFileHandle *, common::page_idx_t, const ColumnChunkMetadata &)> flush_buffer_func_t
Definition column_chunk_data.h:230
Definition column_chunk_data.h:352
void copyVectorToBuffer(common::ValueVector *vector, common::offset_t startPosInChunk, const common::SelectionVector &selVector) override
void append(ColumnChunkData *other, common::offset_t startPosInOtherChunk, uint32_t numValuesToAppend) override
common::offset_t & operator[](common::offset_t pos)
Definition column_chunk_data.h:390
void setTableID(common::table_id_t tableID)
Definition column_chunk_data.h:384
void write(const common::ValueVector *vector, common::offset_t offsetInVector, common::offset_t offsetInChunk) override
void lookup(common::offset_t offsetInChunk, common::ValueVector &output, common::sel_t posInOutputVector) const override
void append(common::ValueVector *vector, const common::SelectionVector &selVector) override
InternalIDChunkData(uint64_t capacity, bool enableCompression, ResidencyState residencyState)
Definition column_chunk_data.h:356
void scan(common::ValueVector &output, common::offset_t offset, common::length_t length, common::sel_t posInOutputVector=0) const override
common::offset_t operator[](common::offset_t pos) const
Definition column_chunk_data.h:387
void copyInt64VectorToBuffer(common::ValueVector *vector, common::offset_t startPosInChunk, const common::SelectionVector &selVector) const
InternalIDChunkData(bool enableCompression, const ColumnChunkMetadata &metadata)
Definition column_chunk_data.h:360
common::table_id_t getTableID() const
Definition column_chunk_data.h:385
Definition column_chunk_data.h:292
void resetToAllNull() override
Definition column_chunk_data.h:315
void serialize(common::Serializer &serializer) const override
static std::unique_ptr< NullChunkData > deserialize(common::Deserializer &deSer)
void copyFromBuffer(uint64_t *srcBuffer, uint64_t srcOffset, uint64_t dstOffset, uint64_t numBits, bool invert=false)
Definition column_chunk_data.h:320
common::NullMask getNullMask() const
Definition column_chunk_data.h:343
void write(ColumnChunkData *srcChunk, common::offset_t srcOffsetInChunk, common::offset_t dstOffsetInChunk, common::offset_t numValuesToCopy) override
bool mayHaveNull() const
Definition column_chunk_data.h:305
void write(const common::ValueVector *vector, common::offset_t offsetInVector, common::offset_t offsetInChunk) override
NullChunkData(uint64_t capacity, bool enableCompression, ResidencyState type)
Definition column_chunk_data.h:294
NullChunkData(bool enableCompression, const ColumnChunkMetadata &metadata)
Definition column_chunk_data.h:297
void setNull(common::offset_t pos, bool isNull)
bool mayHaveNullValue
Definition column_chunk_data.h:349
void resetToEmpty() override
Definition column_chunk_data.h:307
void scan(common::ValueVector &output, common::offset_t offset, common::length_t length, common::sel_t posInOutputVector=0) const override
void append(ColumnChunkData *other, common::offset_t startPosInOtherChunk, uint32_t numValuesToAppend) override
bool isNull(common::offset_t pos) const
Definition column_chunk_data.h:302
void resetToNoNull()
Definition column_chunk_data.h:311
uint64_t length_t
Definition types.h:53
uint32_t idx_t
Definition types.h:39
RelMultiplicity
Definition rel_multiplicity.h:9
uint32_t page_idx_t
Definition types.h:26
uint64_t table_id_t
Definition internal_id_t.h:14
uint64_t sel_t
Definition types.h:24
TO ku_dynamic_cast(FROM old)
Definition cast.h:11
uint64_t offset_t
Definition internal_id_t.h:22
CompressionType
Definition compression.h:103
ResidencyState
Definition residency_state.h:11
Definition alter_type.h:5
static constexpr uint64_t PAGE_4KB_SIZE
Definition constants.h:62
Definition column_chunk_data.h:45
std::vector< ChunkState > childrenStates
Definition column_chunk_data.h:51
void resetState()
Definition column_chunk_data.h:72
ChunkState & getChildState(common::idx_t childIdx)
Definition column_chunk_data.h:63
std::unique_ptr< ChunkState > nullState
Definition column_chunk_data.h:49
ColumnChunkMetadata metadata
Definition column_chunk_data.h:47
ChunkState(bool hasNull=true)
Definition column_chunk_data.h:53
uint64_t numValuesPerPage
Definition column_chunk_data.h:48
Column * column
Definition column_chunk_data.h:46
const ChunkState & getChildState(common::idx_t childIdx) const
Definition column_chunk_data.h:67
ChunkState(ColumnChunkMetadata metadata, uint64_t numValuesPerPage)
Definition column_chunk_data.h:58
Definition column_chunk_data.h:398
static std::unique_ptr< ColumnChunkData > createColumnChunkData(common::LogicalType dataType, bool enableCompression, uint64_t capacity, ResidencyState residencyState, bool hasNullData=true)
static std::unique_ptr< ColumnChunkData > createColumnChunkData(common::LogicalType dataType, bool enableCompression, ColumnChunkMetadata &metadata, bool hasNullData)
static std::unique_ptr< ColumnChunkData > createNullChunkData(bool enableCompression, uint64_t capacity, ResidencyState type)
Definition column_chunk_data.h:405
Definition compression.h:30