Kùzu C++ API
Loading...
Searching...
No Matches
data_chunk.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
6#include "copy_constructors.h"
7#include "data_chunk_state.h"
8#include "value_vector.h"
9
10namespace kuzu {
11namespace common {
12
13// A DataChunk represents tuples as a set of value vectors and a selector array.
14// The data chunk represents a subset of a relation i.e., a set of tuples as
15// lists of the same length. It is appended into DataChunks and passed as intermediate
16// representations between operators.
17// A data chunk further contains a DataChunkState, which keeps the data chunk's size, selector, and
18// currIdx (used when flattening and implies the value vector only contains the elements at currIdx
19// of each value vector).
20class DataChunk {
21public:
23 explicit DataChunk(uint32_t numValueVectors)
24 : DataChunk(numValueVectors, std::make_shared<DataChunkState>()){};
25
26 DataChunk(uint32_t numValueVectors, const std::shared_ptr<DataChunkState>& state)
27 : valueVectors(numValueVectors), state{state} {};
29
30 void insert(uint32_t pos, std::shared_ptr<ValueVector> valueVector);
31
33
34 inline uint32_t getNumValueVectors() const { return valueVectors.size(); }
35
36 inline std::shared_ptr<ValueVector> getValueVector(uint64_t valueVectorPos) {
37 return valueVectors[valueVectorPos];
38 }
39
40public:
41 std::vector<std::shared_ptr<ValueVector>> valueVectors;
42 std::shared_ptr<DataChunkState> state;
43};
44
45} // namespace common
46} // namespace kuzu
Definition data_chunk.h:20
DELETE_COPY_DEFAULT_MOVE(DataChunk)
std::shared_ptr< DataChunkState > state
Definition data_chunk.h:42
std::shared_ptr< ValueVector > getValueVector(uint64_t valueVectorPos)
Definition data_chunk.h:36
DataChunk(uint32_t numValueVectors)
Definition data_chunk.h:23
DataChunk()
Definition data_chunk.h:22
uint32_t getNumValueVectors() const
Definition data_chunk.h:34
void insert(uint32_t pos, std::shared_ptr< ValueVector > valueVector)
std::vector< std::shared_ptr< ValueVector > > valueVectors
Definition data_chunk.h:41
DataChunk(uint32_t numValueVectors, const std::shared_ptr< DataChunkState > &state)
Definition data_chunk.h:26
Definition data_chunk_state.h:14
Definition alter_type.h:5