Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::roaring::ContainerCompressionState Struct Reference
Collaboration diagram for duckdb::roaring::ContainerCompressionState:

Public Types

using append_func_t = void (*)(ContainerCompressionState &, bool, uint16_t)

Public Member Functions

void Append (bool null, uint16_t amount=1)
void OverrideArray (data_ptr_t &destination, bool nulls, idx_t count)
void OverrideRun (data_ptr_t &destination, idx_t count)
void OverrideUncompressed (data_ptr_t &destination)
void Finalize ()
ContainerMetadata GetResult ()
void Reset ()

Public Attributes

uint16_t length = 0
 Buffered append state (we don't want to append every bit separately).
bool last_bit_set
uint16_t appended_count = 0
 Total amount of values covered by the container.
uint16_t null_count = 0
 How many of the total are null.
bool last_is_null = false
RunContainerRLEPair * runs
uint8_t * compressed_runs
uint8_t * compressed_arrays [2]
uint16_t * arrays [2]
RunContainerRLEPair base_runs [COMPRESSED_RUN_THRESHOLD]
 The runs (for sequential nulls).
uint16_t base_arrays [2][COMPRESSED_ARRAY_THRESHOLD]
 The indices (for nulls | non-nulls).
uint16_t run_idx
uint16_t array_idx [2]
uint8_t * array_counts [2]
uint8_t * run_counts
uint8_t base_compressed_arrays [2][MAX_ARRAY_IDX]
uint8_t base_compressed_runs [MAX_RUN_IDX *2]
uint8_t base_array_counts [2][COMPRESSED_SEGMENT_COUNT]
uint8_t base_run_counts [COMPRESSED_SEGMENT_COUNT]
validity_t * uncompressed = nullptr
bool finalized = false
 Whether the state has been finalized.
append_func_t append_function
 The function called to append to the state.

Constructor & Destructor Documentation

◆ ContainerCompressionState()

duckdb::roaring::ContainerCompressionState::ContainerCompressionState ( )
404508 {
404509 Reset();
404510}

Member Function Documentation

◆ Append()

void duckdb::roaring::ContainerCompressionState::Append ( bool null,
uint16_t amount = 1 )
404582 {
404583 append_function(*this, null, amount);
404584 last_is_null = null;
404585 null_count += null * amount;
404586 appended_count += amount;
404587}
uint16_t null_count
How many of the total are null.
Definition duckdb.cpp:403387
append_func_t append_function
The function called to append to the state.
Definition duckdb.cpp:403415
uint16_t appended_count
Total amount of values covered by the container.
Definition duckdb.cpp:403385

◆ OverrideArray()

void duckdb::roaring::ContainerCompressionState::OverrideArray ( data_ptr_t & destination,
bool nulls,
idx_t count )
404589 {
404590 if (nulls) {
404591 append_function = AppendToArray<true>;
404592 } else {
404593 append_function = AppendToArray<false>;
404594 }
404595
404596 if (count >= COMPRESSED_ARRAY_THRESHOLD) {
404597 memset(destination, 0, sizeof(uint8_t) * COMPRESSED_SEGMENT_COUNT);
404598 array_counts[nulls] = reinterpret_cast<uint8_t *>(destination);
404599 auto data_start = destination + sizeof(uint8_t) * COMPRESSED_SEGMENT_COUNT;
404600 compressed_arrays[nulls] = reinterpret_cast<uint8_t *>(data_start);
404601 } else {
404602 destination = AlignPointer<sizeof(uint16_t)>(destination);
404603 arrays[nulls] = reinterpret_cast<uint16_t *>(destination);
404604 }
404605}
::uint8_t uint8_t
::uint16_t uint16_t

◆ OverrideRun()

void duckdb::roaring::ContainerCompressionState::OverrideRun ( data_ptr_t & destination,
idx_t count )
404607 {
404608 append_function = AppendRun;
404609
404610 if (count >= COMPRESSED_RUN_THRESHOLD) {
404611 memset(destination, 0, sizeof(uint8_t) * COMPRESSED_SEGMENT_COUNT);
404612 run_counts = reinterpret_cast<uint8_t *>(destination);
404613 auto data_start = destination + sizeof(uint8_t) * COMPRESSED_SEGMENT_COUNT;
404614 compressed_runs = reinterpret_cast<uint8_t *>(data_start);
404615 } else {
404616 destination = AlignPointer<sizeof(RunContainerRLEPair)>(destination);
404617 runs = reinterpret_cast<RunContainerRLEPair *>(destination);
404618 }
404619}

◆ OverrideUncompressed()

void duckdb::roaring::ContainerCompressionState::OverrideUncompressed ( data_ptr_t & destination)
404621 {
404622 append_function = AppendBitset;
404623 destination = AlignPointer<sizeof(idx_t)>(destination);
404624 uncompressed = reinterpret_cast<validity_t *>(destination);
404625}

◆ Finalize()

void duckdb::roaring::ContainerCompressionState::Finalize ( )
404627 {
404628 D_ASSERT(!finalized);
404629 if (appended_count && last_is_null && run_idx < MAX_RUN_IDX) {
404630 if (run_idx < COMPRESSED_RUN_THRESHOLD) {
404631 auto &last_run = runs[run_idx];
404632 // End the last run
404633 last_run.length = (appended_count - last_run.start);
404634 }
404635 compressed_runs[(run_idx * 2) + 1] = static_cast<uint8_t>(appended_count % COMPRESSED_SEGMENT_SIZE);
404636 if (appended_count != ROARING_CONTAINER_SIZE) {
404638 }
404639 run_idx++;
404640 }
404641 finalized = true;
404642}
static constexpr uint16_t COMPRESSED_SEGMENT_SHIFT_AMOUNT
compresed segment size is 256, instead of division we can make use of shifting
Definition duckdb.cpp:403112
bool finalized
Whether the state has been finalized.
Definition duckdb.cpp:403413

◆ GetResult()

ContainerMetadata duckdb::roaring::ContainerCompressionState::GetResult ( )
404644 {
404645 if (uncompressed) {
404646 return ContainerMetadata::BitsetContainer(appended_count);
404647 }
404648 D_ASSERT(finalized);
404649 return ContainerMetadata::CreateMetadata(appended_count, array_idx[NULLS], array_idx[NON_NULLS], run_idx);
404650}

◆ Reset()

void duckdb::roaring::ContainerCompressionState::Reset ( )
404652 {
404653 length = 0;
404654
404655 appended_count = 0;
404656 null_count = 0;
404657 run_idx = 0;
404658 array_idx[NON_NULLS] = 0;
404659 array_idx[NULLS] = 0;
404660 finalized = false;
404661 last_is_null = false;
404662
404663 // Reset the arrays + runs
404664 arrays[NULLS] = base_arrays[NULLS];
404665 arrays[NON_NULLS] = base_arrays[NON_NULLS];
404666 runs = base_runs;
404667
404668 compressed_arrays[NULLS] = base_compressed_arrays[NULLS];
404669 compressed_arrays[NON_NULLS] = base_compressed_arrays[NON_NULLS];
404670 compressed_runs = base_compressed_runs;
404671
404672 array_counts[NULLS] = base_array_counts[NULLS];
404673 array_counts[NON_NULLS] = base_array_counts[NON_NULLS];
404674 run_counts = base_run_counts;
404675
404676 memset(array_counts[NULLS], 0, sizeof(uint8_t) * COMPRESSED_SEGMENT_COUNT);
404677 memset(array_counts[NON_NULLS], 0, sizeof(uint8_t) * COMPRESSED_SEGMENT_COUNT);
404678 memset(run_counts, 0, sizeof(uint8_t) * COMPRESSED_SEGMENT_COUNT);
404679 uncompressed = nullptr;
404680}
uint16_t length
Buffered append state (we don't want to append every bit separately).
Definition duckdb.cpp:403381
RunContainerRLEPair base_runs[COMPRESSED_RUN_THRESHOLD]
The runs (for sequential nulls).
Definition duckdb.cpp:403396
uint16_t base_arrays[2][COMPRESSED_ARRAY_THRESHOLD]
The indices (for nulls | non-nulls).
Definition duckdb.cpp:403398

The documentation for this struct was generated from the following file: