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::RLECompressState< T, WRITE_STATISTICS > Struct Template Reference
Inheritance diagram for duckdb::RLECompressState< T, WRITE_STATISTICS >:
Collaboration diagram for duckdb::RLECompressState< T, WRITE_STATISTICS >:

Classes

struct  RLEWriter

Public Member Functions

idx_t MaxRLECount ()
 RLECompressState (ColumnDataCheckpointData &checkpoint_data_p, const CompressionInfo &info)
void CreateEmptySegment ()
void Append (UnifiedVectorFormat &vdata, idx_t count)
void WriteValue (T value, rle_count_t count, bool is_null)
void FlushSegment ()
void Finalize ()
Public Member Functions inherited from duckdb::CompressionState
 CompressionState (const CompressionInfo &info)
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Public Attributes

ColumnDataCheckpointData & checkpoint_data
const CompressionFunction & function
unique_ptr< ColumnSegment > current_segment
BufferHandle handle
RLEState< T > state
idx_t entry_count = 0
idx_t max_rle_count
Public Attributes inherited from duckdb::CompressionState
CompressionInfo info

Constructor & Destructor Documentation

◆ RLECompressState()

template<class T, bool WRITE_STATISTICS>
duckdb::RLECompressState< T, WRITE_STATISTICS >::RLECompressState ( ColumnDataCheckpointData & checkpoint_data_p,
const CompressionInfo & info )
inline
402586 : CompressionState(info), checkpoint_data(checkpoint_data_p),
402587 function(checkpoint_data.GetCompressionFunction(CompressionType::COMPRESSION_RLE)) {
402588 CreateEmptySegment();
402589
402590 state.dataptr = (void *)this;
402591 max_rle_count = MaxRLECount();
402592 }
Definition duckdb.cpp:402571

Member Function Documentation

◆ MaxRLECount()

template<class T, bool WRITE_STATISTICS>
idx_t duckdb::RLECompressState< T, WRITE_STATISTICS >::MaxRLECount ( )
inline
402580 {
402581 auto entry_size = sizeof(T) + sizeof(rle_count_t);
402582 return AlignValueFloor((info.GetBlockSize() - RLEConstants::RLE_HEADER_SIZE) / entry_size);
402583 }

◆ CreateEmptySegment()

template<class T, bool WRITE_STATISTICS>
void duckdb::RLECompressState< T, WRITE_STATISTICS >::CreateEmptySegment ( )
inline
402594 {
402595 auto &db = checkpoint_data.GetDatabase();
402596 auto &type = checkpoint_data.GetType();
402597
402598 auto column_segment =
402599 ColumnSegment::CreateTransientSegment(db, function, type, info.GetBlockSize(), info.GetBlockManager());
402600 current_segment = std::move(column_segment);
402601
402603 handle = buffer_manager.Pin(current_segment->block);
402604 }

◆ Append()

template<class T, bool WRITE_STATISTICS>
void duckdb::RLECompressState< T, WRITE_STATISTICS >::Append ( UnifiedVectorFormat & vdata,
idx_t count )
inline
402606 {
402608 for (idx_t i = 0; i < count; i++) {
402609 auto idx = vdata.sel->get_index(i);
402611 }
402612 }

◆ WriteValue()

template<class T, bool WRITE_STATISTICS>
void duckdb::RLECompressState< T, WRITE_STATISTICS >::WriteValue ( T value,
rle_count_t count,
bool is_null )
inline
402614 {
402615 // write the RLE entry
402616 auto handle_ptr = handle.Ptr() + RLEConstants::RLE_HEADER_SIZE;
402617 auto data_pointer = reinterpret_cast<T *>(handle_ptr);
402618 auto index_pointer = reinterpret_cast<rle_count_t *>(handle_ptr + max_rle_count * sizeof(T));
402619 data_pointer[entry_count] = value;
402620 index_pointer[entry_count] = count;
402621 entry_count++;
402622
402623 // update meta data
402624 if (WRITE_STATISTICS) {
402625 if (!is_null) {
402626 current_segment->stats.statistics.SetHasNoNullFast();
402627 current_segment->stats.statistics.UpdateNumericStats<T>(value);
402628 } else {
402629 current_segment->stats.statistics.SetHasNullFast();
402630 }
402631 }
402632 current_segment->count += count;
402633
402634 if (entry_count == max_rle_count) {
402635 // we have finished writing this segment: flush it and create a new segment
402636 FlushSegment();
402637 CreateEmptySegment();
402638 entry_count = 0;
402639 }
402640 }

◆ FlushSegment()

template<class T, bool WRITE_STATISTICS>
void duckdb::RLECompressState< T, WRITE_STATISTICS >::FlushSegment ( )
inline
402642 {
402643 // flush the segment
402644 // we compact the segment by moving the counts so they are directly next to the values
402645 idx_t counts_size = sizeof(rle_count_t) * entry_count;
402646 idx_t original_rle_offset = RLEConstants::RLE_HEADER_SIZE + max_rle_count * sizeof(T);
402647 idx_t minimal_rle_offset = RLEConstants::RLE_HEADER_SIZE + sizeof(T) * entry_count;
402650 auto data_ptr = handle.Ptr();
402653 }
402655 // store the final RLE offset within the segment
402657 handle.Destroy();
402658
402659 auto &state = checkpoint_data.GetCheckpointState();
402660 state.FlushSegment(std::move(current_segment), std::move(handle), total_segment_size);
402661 }
static T AlignValue(T n)
Align value (ceiling) (not for pointer types).
Definition duckdb.hpp:2126

◆ Finalize()

template<class T, bool WRITE_STATISTICS>
void duckdb::RLECompressState< T, WRITE_STATISTICS >::Finalize ( )
inline
402663 {
402665
402666 FlushSegment();
402667 current_segment.reset();
402668 }

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