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::RoaringAnalyzeState Struct Reference
Inheritance diagram for duckdb::roaring::RoaringAnalyzeState:
Collaboration diagram for duckdb::roaring::RoaringAnalyzeState:

Public Member Functions

 RoaringAnalyzeState (const CompressionInfo &info)
ContainerMetadata GetResult ()
bool HasEnoughSpaceInSegment (idx_t required_space)
void FlushSegment ()
void FlushContainer ()
template<PhysicalType TYPE>
void Analyze (Vector &input, idx_t count)
Public Member Functions inherited from duckdb::AnalyzeState
 AnalyzeState (const CompressionInfo &info)
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static void HandleByte (RoaringAnalyzeState &state, uint8_t array_index)
static void HandleRaggedByte (RoaringAnalyzeState &state, uint8_t array_index, idx_t relevant_bits)
static void HandleAllValid (RoaringAnalyzeState &state, idx_t amount)
static void HandleNoneValid (RoaringAnalyzeState &state, idx_t amount)
static idx_t Count (RoaringAnalyzeState &state)
static void Flush (RoaringAnalyzeState &state)

Public Attributes

unsafe_unique_array< BitmaskTableEntry > bitmask_table
uint16_t one_count = 0
 Analyze phase.
uint16_t zero_count = 0
 The amount of unset bits found.
uint16_t run_count = 0
 The amount of runs (of 0's) so far.
bool last_bit_set
 Whether the last bit was set or not.
uint16_t count = 0
 The total amount of bits covered (one_count + zero_count).
idx_t data_size = 0
 Flushed analyze data.
idx_t metadata_size = 0
idx_t segment_count = 0
 The total amount of segments to write.
idx_t current_count = 0
 The amount of values in the current segment;.
idx_t total_count = 0
 The total amount of data to serialize.
idx_t total_size = 0
 The total amount of bytes used to compress the whole segment.
ContainerMetadataCollection metadata_collection
 The container metadata, determining the type of each container to use during compression.
vector< ContainerMetadata > container_metadata
Public Attributes inherited from duckdb::AnalyzeState
CompressionInfo info

Constructor & Destructor Documentation

◆ RoaringAnalyzeState()

duckdb::roaring::RoaringAnalyzeState::RoaringAnalyzeState ( const CompressionInfo & info)
explicit
403981 : AnalyzeState(info), bitmask_table(CreateBitmaskTable()) {
403982}

Member Function Documentation

◆ HandleByte()

void duckdb::roaring::RoaringAnalyzeState::HandleByte ( RoaringAnalyzeState & state,
uint8_t array_index )
static
403984 {
403985 auto bit_info = state.bitmask_table[static_cast<uint8_t>(array_index)];
403986
403987 state.run_count +=
403988 bit_info.run_count + (bit_info.first_bit_set == false && (!state.count || state.last_bit_set == true));
403989 state.one_count += bit_info.valid_count;
403990 D_ASSERT(bit_info.valid_count <= 8);
403991 state.zero_count += 8 - bit_info.valid_count;
403992 state.last_bit_set = bit_info.last_bit_set;
403993 state.count += 8;
403994}
::uint8_t uint8_t

◆ HandleRaggedByte()

void duckdb::roaring::RoaringAnalyzeState::HandleRaggedByte ( RoaringAnalyzeState & state,
uint8_t array_index,
idx_t relevant_bits )
static
404006 {
404007 D_ASSERT(relevant_bits <= 8);
404008 for (idx_t i = 0; i < relevant_bits; i++) {
404009 const bool bit_set = array_index & (1 << i);
404010 HandleBit(state, bit_set);
404011 }
404012}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ HandleAllValid()

void duckdb::roaring::RoaringAnalyzeState::HandleAllValid ( RoaringAnalyzeState & state,
idx_t amount )
static
404014 {
404015 state.one_count += amount;
404016 state.last_bit_set = true;
404017 state.count += amount;
404018}

◆ HandleNoneValid()

void duckdb::roaring::RoaringAnalyzeState::HandleNoneValid ( RoaringAnalyzeState & state,
idx_t amount )
static
404020 {
404021 if (!state.count || (state.last_bit_set != false)) {
404022 state.run_count++;
404023 }
404024 state.zero_count += amount;
404025 state.last_bit_set = false;
404026 state.count += amount;
404027}

◆ Count()

idx_t duckdb::roaring::RoaringAnalyzeState::Count ( RoaringAnalyzeState & state)
static
404029 {
404030 return state.count;
404031}

◆ Flush()

void duckdb::roaring::RoaringAnalyzeState::Flush ( RoaringAnalyzeState & state)
static
404033 {
404034 state.FlushContainer();
404035}

◆ GetResult()

ContainerMetadata duckdb::roaring::RoaringAnalyzeState::GetResult ( )
404061 {
404062 return ContainerMetadata::CreateMetadata(count, zero_count, one_count, run_count);
404063}
uint16_t run_count
The amount of runs (of 0's) so far.
Definition duckdb.cpp:403330
uint16_t one_count
Analyze phase.
Definition duckdb.cpp:403326
uint16_t count
The total amount of bits covered (one_count + zero_count).
Definition duckdb.cpp:403334
uint16_t zero_count
The amount of unset bits found.
Definition duckdb.cpp:403328

◆ HasEnoughSpaceInSegment()

bool duckdb::roaring::RoaringAnalyzeState::HasEnoughSpaceInSegment ( idx_t required_space)
404037 {
404038 auto space_used = data_size + metadata_size;
404039 D_ASSERT(space_used <= info.GetBlockSize());
404040 idx_t remaining_space = info.GetBlockSize() - space_used;
404041 if (required_space > remaining_space) {
404042 return false;
404043 }
404044 return true;
404045}
idx_t data_size
Flushed analyze data.
Definition duckdb.cpp:403339

◆ FlushSegment()

void duckdb::roaring::RoaringAnalyzeState::FlushSegment ( )
404047 {
404048 auto space_used = data_size + metadata_size;
404049 if (!current_count) {
404050 D_ASSERT(!space_used);
404051 return;
404052 }
404053 metadata_collection.FlushSegment();
404054 total_size += space_used;
404055 data_size = 0;
404056 metadata_size = 0;
404057 current_count = 0;
404058 segment_count++;
404059}
idx_t segment_count
The total amount of segments to write.
Definition duckdb.cpp:403343
idx_t current_count
The amount of values in the current segment;.
Definition duckdb.cpp:403345
idx_t total_size
The total amount of bytes used to compress the whole segment.
Definition duckdb.cpp:403350
ContainerMetadataCollection metadata_collection
The container metadata, determining the type of each container to use during compression.
Definition duckdb.cpp:403352

◆ FlushContainer()

void duckdb::roaring::RoaringAnalyzeState::FlushContainer ( )
404065 {
404066 if (!count) {
404067 return;
404068 }
404069 auto metadata = GetResult();
404070 idx_t runs_count = metadata_collection.GetRunContainerCount();
404071 idx_t arrays_count = metadata_collection.GetArrayAndBitsetContainerCount();
404072
404073 if (metadata.IsRun()) {
404074 runs_count++;
404075 } else {
404076 arrays_count++;
404077 }
404078
404079 metadata_size = metadata_collection.GetMetadataSize(runs_count + arrays_count, runs_count, arrays_count);
404080
404081 data_size += metadata.GetDataSizeInBytes(count);
404082 if (!HasEnoughSpaceInSegment(metadata_size + data_size)) {
404083 FlushSegment();
404084 }
404085 container_metadata.push_back(metadata);
404086 metadata_collection.AddMetadata(metadata);
404087 current_count += count;
404088
404089 // Reset the container analyze state
404090 one_count = 0;
404091 zero_count = 0;
404092 run_count = 0;
404093 last_bit_set = false;
404094 count = 0;
404095}
bool last_bit_set
Whether the last bit was set or not.
Definition duckdb.cpp:403332

◆ Analyze()

template<PhysicalType TYPE>
void duckdb::roaring::RoaringAnalyzeState::Analyze ( Vector & input,
idx_t count )
inline
403315 {
403316 static_assert(AlwaysFalse<std::integral_constant<PhysicalType, TYPE>>::VALUE,
403317 "No specialization exists for this type");
403318 }

Member Data Documentation

◆ one_count

uint16_t duckdb::roaring::RoaringAnalyzeState::one_count = 0

Analyze phase.

The amount of set bits found

◆ data_size

idx_t duckdb::roaring::RoaringAnalyzeState::data_size = 0

Flushed analyze data.

The space used by the current segment


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