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::RLEState< T > Struct Template Reference
Collaboration diagram for duckdb::RLEState< T >:

Public Member Functions

template<class OP>
void Flush ()
template<class OP = EmptyRLEWriter>
void Update (const T *data, ValidityMask &validity, idx_t idx)

Public Attributes

idx_t seen_count
T last_value
rle_count_t last_seen_count
void * dataptr
bool all_null = true

Constructor & Destructor Documentation

◆ RLEState()

template<class T>
duckdb::RLEState< T >::RLEState ( )
inline
402471 : seen_count(0), last_value(NullValue<T>()), last_seen_count(0), dataptr(nullptr) {
402472 }
Definition duckdb.cpp:402470

Member Function Documentation

◆ Flush()

template<class T>
template<class OP>
void duckdb::RLEState< T >::Flush ( )
inline
402482 {
402483 OP::template Operation<T>(last_value, last_seen_count, dataptr, all_null);
402484 }

◆ Update()

template<class T>
template<class OP = EmptyRLEWriter>
void duckdb::RLEState< T >::Update ( const T * data,
ValidityMask & validity,
idx_t idx )
inline
402487 {
402488 if (validity.RowIsValid(idx)) {
402489 if (all_null) {
402490 // no value seen yet
402491 // assign the current value, and increment the seen_count
402492 // note that we increment last_seen_count rather than setting it to 1
402493 // this is intentional: this is the first VALID value we see
402494 // but it might not be the first value in case of nulls!
402495 last_value = data[idx];
402496 seen_count++;
402497 last_seen_count++;
402498 all_null = false;
402499 } else if (last_value == data[idx]) {
402500 // the last value is identical to this value: increment the last_seen_count
402501 last_seen_count++;
402502 } else {
402503 // the values are different
402504 // issue the callback on the last value
402505 // edge case: if a value has exactly 2^16 repeated values, we can end up here with last_seen_count = 0
402506 if (last_seen_count > 0) {
402507 Flush<OP>();
402508 seen_count++;
402509 }
402510
402511 // increment the seen_count and put the new value into the RLE slot
402512 last_value = data[idx];
402513 last_seen_count = 1;
402514 }
402515 } else {
402516 // NULL value: we merely increment the last_seen_count
402517 last_seen_count++;
402518 }
402519 if (last_seen_count == NumericLimits<rle_count_t>::Maximum()) {
402520 // we have seen the same value so many times in a row we are at the limit of what fits in our count
402521 // write away the value and move to the next value
402522 Flush<OP>();
402523 last_seen_count = 0;
402524 seen_count++;
402525 }
402526 }

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