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

Public Types

using EXACT_TYPE = typename FloatingToExact<T>::TYPE

Public Member Functions

 PatasScanState (ColumnSegment &segment)
idx_t LeftInGroup () const
bool GroupFinished () const
template<class EXACT_TYPE, bool SKIP = false>
void ScanGroup (EXACT_TYPE *values, idx_t group_size)
void SkipGroup ()
template<bool SKIP = false>
void LoadGroup (EXACT_TYPE *value_buffer)
void Skip (ColumnSegment &segment, idx_t skip_count)
 Skip the next 'skip_count' values, we don't store the values.
Public Member Functions inherited from duckdb::SegmentScanState
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Public Attributes

BufferHandle handle
data_ptr_t metadata_ptr
data_ptr_t segment_data
idx_t total_value_count = 0
PatasGroupState< EXACT_TYPE > group_state
ColumnSegment & segment
idx_t count

Constructor & Destructor Documentation

◆ PatasScanState()

template<class T>
duckdb::PatasScanState< T >::PatasScanState ( ColumnSegment & segment)
inlineexplicit
402223 : segment(segment), count(segment.count) {
402225
402226 handle = buffer_manager.Pin(segment.block);
402227 // ScanStates never exceed the boundaries of a Segment,
402228 // but are not guaranteed to start at the beginning of the Block
402229 segment_data = handle.Ptr() + segment.GetBlockOffset();
402230 auto metadata_offset = Load<uint32_t>(segment_data);
402231 metadata_ptr = segment_data + metadata_offset;
402232 }
Definition duckdb.cpp:402219

Member Function Documentation

◆ LeftInGroup()

template<class T>
idx_t duckdb::PatasScanState< T >::LeftInGroup ( ) const
inline
402243 {
402245 }

◆ GroupFinished()

template<class T>
bool duckdb::PatasScanState< T >::GroupFinished ( ) const
inline
402247 {
402248 return (total_value_count % PatasPrimitives::PATAS_GROUP_SIZE) == 0;
402249 }

◆ ScanGroup()

template<class T>
template<class EXACT_TYPE, bool SKIP = false>
void duckdb::PatasScanState< T >::ScanGroup ( EXACT_TYPE * values,
idx_t group_size )
inline
402253 {
402255 D_ASSERT(group_size <= LeftInGroup());
402256
402257 if (GroupFinished() && total_value_count < count) {
402259 LoadGroup<SKIP>(values);
402260 total_value_count += group_size;
402261 return;
402262 } else {
402263 // Even if SKIP is given, group size is not big enough to be able to fully skip the entire group
402264 LoadGroup<false>(group_state.values);
402265 }
402266 }
402267 group_state.template Scan<SKIP>((uint8_t *)values, group_size);
402268
402269 total_value_count += group_size;
402270 }

◆ SkipGroup()

template<class T>
void duckdb::PatasScanState< T >::SkipGroup ( )
inline
402273 {
402274 // Skip the offset indicating where the data starts
402275 metadata_ptr -= sizeof(uint32_t);
402276 idx_t group_size = MinValue((idx_t)PatasPrimitives::PATAS_GROUP_SIZE, count - total_value_count);
402277 // Skip the blocks of packed data
402278 metadata_ptr -= sizeof(uint16_t) * group_size;
402279
402280 total_value_count += group_size;
402281 }

◆ LoadGroup()

template<class T>
template<bool SKIP = false>
void duckdb::PatasScanState< T >::LoadGroup ( EXACT_TYPE * value_buffer)
inline
402284 {
402285 group_state.Reset();
402286
402287 // Load the offset indicating where a groups data starts
402288 metadata_ptr -= sizeof(uint32_t);
402289 auto data_byte_offset = Load<uint32_t>(metadata_ptr);
402290 D_ASSERT(data_byte_offset < segment.GetBlockSize());
402291
402292 // Initialize the byte_reader with the data values for the group
402293 group_state.Init(segment_data + data_byte_offset);
402294
402295 idx_t group_size = MinValue((idx_t)PatasPrimitives::PATAS_GROUP_SIZE, (count - total_value_count));
402296
402297 // Read the compacted blocks of (7 + 6 + 3 bits) value stats
402298 metadata_ptr -= sizeof(uint16_t) * group_size;
402299 group_state.LoadPackedData((uint16_t *)metadata_ptr, group_size);
402300
402301 // Read all the values to the specified 'value_buffer'
402302 group_state.template LoadValues<SKIP>(value_buffer, group_size);
402303 }

◆ Skip()

template<class T>
void duckdb::PatasScanState< T >::Skip ( ColumnSegment & segment,
idx_t skip_count )
inline

Skip the next 'skip_count' values, we don't store the values.

402307 {
402308 using EXACT_TYPE = typename FloatingToExact<T>::TYPE;
402309
402310 if (total_value_count != 0 && !GroupFinished()) {
402311 // Finish skipping the current group
402312 idx_t to_skip = LeftInGroup();
402313 skip_count -= to_skip;
402314 ScanGroup<EXACT_TYPE, true>(nullptr, to_skip);
402315 }
402316 // Figure out how many entire groups we can skip
402317 // For these groups, we don't even need to process the metadata or values
402319 for (idx_t i = 0; i < groups_to_skip; i++) {
402320 SkipGroup();
402321 }
402323 if (skip_count == 0) {
402324 return;
402325 }
402326 // For the last group that this skip (partially) touches, we do need to
402327 // load the metadata and values into the group_state
402328 ScanGroup<EXACT_TYPE, true>(nullptr, skip_count);
402329 }

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