Kùzu C++ API
Loading...
Searching...
No Matches
data_chunk_state.h
Go to the documentation of this file.
1#pragma once
2
3#include "sel_vector.h"
4
5namespace kuzu {
6namespace common {
7
8// F stands for Factorization
9enum class FStateType : uint8_t {
10 FLAT = 0,
11 UNFLAT = 1,
12};
13
15public:
17 explicit DataChunkState(sel_t capacity) : fStateType{FStateType::UNFLAT} {
18 selVector = std::make_shared<SelectionVector>(capacity);
19 }
20
21 // returns a dataChunkState for vectors holding a single value.
22 static std::shared_ptr<DataChunkState> getSingleValueDataChunkState();
23
24 void initOriginalAndSelectedSize(uint64_t size) { selVector->setSelSize(size); }
25 bool isFlat() const { return fStateType == FStateType::FLAT; }
26 void setToFlat() { fStateType = FStateType::FLAT; }
27 void setToUnflat() { fStateType = FStateType::UNFLAT; }
28
29 const SelectionVector& getSelVector() const { return *selVector; }
30 SelectionVector& getSelVectorUnsafe() { return *selVector; }
31 std::shared_ptr<SelectionVector> getSelVectorShared() { return selVector; }
32 void setSelVector(std::shared_ptr<SelectionVector> selVector_) {
33 this->selVector = std::move(selVector_);
34 }
35
36 void slice(offset_t offset);
37
38private:
39 std::shared_ptr<SelectionVector> selVector;
40 // TODO: We should get rid of `fStateType` and merge DataChunkState with SelectionVector.
41 FStateType fStateType;
42};
43
44} // namespace common
45} // namespace kuzu
Definition data_chunk_state.h:14
void setToUnflat()
Definition data_chunk_state.h:27
bool isFlat() const
Definition data_chunk_state.h:25
void slice(offset_t offset)
static std::shared_ptr< DataChunkState > getSingleValueDataChunkState()
void setSelVector(std::shared_ptr< SelectionVector > selVector_)
Definition data_chunk_state.h:32
DataChunkState(sel_t capacity)
Definition data_chunk_state.h:17
SelectionVector & getSelVectorUnsafe()
Definition data_chunk_state.h:30
DataChunkState()
Definition data_chunk_state.h:16
void initOriginalAndSelectedSize(uint64_t size)
Definition data_chunk_state.h:24
const SelectionVector & getSelVector() const
Definition data_chunk_state.h:29
void setToFlat()
Definition data_chunk_state.h:26
std::shared_ptr< SelectionVector > getSelVectorShared()
Definition data_chunk_state.h:31
Definition sel_vector.h:12
constexpr uint64_t DEFAULT_VECTOR_CAPACITY
Definition constants.h:12
FStateType
Definition data_chunk_state.h:9
uint64_t sel_t
Definition types.h:24
uint64_t offset_t
Definition internal_id_t.h:22
Definition alter_type.h:5