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 sel_t getSelSize() const { return selVector->getSelSize(); }
31 SelectionVector& getSelVectorUnsafe() { return *selVector; }
32 std::shared_ptr<SelectionVector> getSelVectorShared() { return selVector; }
33 void setSelVector(std::shared_ptr<SelectionVector> selVector_) {
34 this->selVector = std::move(selVector_);
35 }
36
37 void slice(offset_t offset);
38
39private:
40 std::shared_ptr<SelectionVector> selVector;
41 // TODO: We should get rid of `fStateType` and merge DataChunkState with SelectionVector.
42 FStateType fStateType;
43};
44
45} // namespace common
46} // 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:33
DataChunkState(sel_t capacity)
Definition data_chunk_state.h:17
SelectionVector & getSelVectorUnsafe()
Definition data_chunk_state.h:31
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:32
sel_t getSelSize() const
Definition data_chunk_state.h:30
Definition sel_vector.h:12
constexpr uint64_t DEFAULT_VECTOR_CAPACITY
Definition constants.h:24
FStateType
Definition data_chunk_state.h:9
uint64_t sel_t
Definition types.h:27
uint64_t offset_t
Definition types.h:74
Definition array_utils.h:7