17 : selectedSize{0}, capacity{capacity}, selectedPositions{nullptr} {
18 selectedPositionsBuffer = std::make_unique<sel_t[]>(capacity);
40 void setToFiltered() { selectedPositions = selectedPositionsBuffer.get(); }
42 KU_ASSERT(size <= capacity && selectedPositionsBuffer);
43 selectedPositions = selectedPositionsBuffer.get();
48 return std::span<sel_t>(selectedPositionsBuffer.get(), capacity);
51 return std::span<const sel_t>(selectedPositions, selectedSize);
57 const auto start = selectedPositions[0];
58 for (
size_t i = start; i < start + selectedSize; i++) {
62 for (
size_t i = 0; i < selectedSize; i++) {
63 func(selectedPositions[i]);
75 selectedSize += increment;
80 return selectedPositions[index];
84 return selectedPositions[index];
90 std::unique_ptr<sel_t[]> selectedPositionsBuffer;
91 sel_t* selectedPositions;
#define KUZU_API
Definition api.h:25
#define KU_ASSERT(condition)
Definition assert.h:19
Definition sel_vector.h:12
void setToUnfiltered()
Definition sel_vector.h:30
void forEach(Func &&func) const
Definition sel_vector.h:55
bool isContinuous() const
Definition sel_vector.h:25
void setToFiltered()
Definition sel_vector.h:40
SelectionVector()
Definition sel_vector.h:22
sel_t & operator[](sel_t index)
Definition sel_vector.h:82
void setToUnfiltered(sel_t size)
Definition sel_vector.h:33
static KUZU_API const std::array< sel_t, DEFAULT_VECTOR_CAPACITY > INCREMENTAL_SELECTED_POS
Definition sel_vector.h:14
bool isUnfiltered() const
Definition sel_vector.h:24
std::span< const sel_t > getSelectedPositions() const
Definition sel_vector.h:50
void setToFiltered(sel_t size)
Definition sel_vector.h:41
sel_t getSelSize() const
Definition sel_vector.h:68
void incrementSelSize(sel_t increment=1)
Definition sel_vector.h:73
std::span< sel_t > getMutableBuffer() const
Definition sel_vector.h:47
SelectionVector(sel_t capacity)
Definition sel_vector.h:16
sel_t operator[](sel_t index) const
Definition sel_vector.h:78
void setSelSize(sel_t size)
Definition sel_vector.h:69
constexpr uint64_t DEFAULT_VECTOR_CAPACITY
Definition constants.h:24
uint64_t sel_t
Definition types.h:27
Definition array_utils.h:7