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

Public Types

using EXACT_TYPE = typename FloatingToExact<T>::TYPE

Public Member Functions

 AlpScanState (ColumnSegment &segment)
idx_t LeftInVector () const
bool VectorFinished () const
template<class EXACT_TYPE, bool SKIP = false>
void ScanVector (T *values, idx_t vector_size)
void SkipVector ()
template<bool SKIP = false>
void LoadVector (T *value_buffer)
void Skip (ColumnSegment &col_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
AlpVectorState< T > vector_state
ColumnSegment & segment
idx_t count

Constructor & Destructor Documentation

◆ AlpScanState()

template<class T>
duckdb::AlpScanState< T >::AlpScanState ( ColumnSegment & segment)
inlineexplicit
393599 : segment(segment), count(segment.count) {
393601 handle = buffer_manager.Pin(segment.block);
393602 // ScanStates never exceed the boundaries of a Segment,
393603 // but are not guaranteed to start at the beginning of the Block
393604 segment_data = handle.Ptr() + segment.GetBlockOffset();
393605 auto metadata_offset = Load<uint32_t>(segment_data);
393606 metadata_ptr = segment_data + metadata_offset;
393607 }
Definition duckdb.cpp:393595

Member Function Documentation

◆ LeftInVector()

template<class T>
idx_t duckdb::AlpScanState< T >::LeftInVector ( ) const
inline
393618 {
393619 return AlpConstants::ALP_VECTOR_SIZE - (total_value_count % AlpConstants::ALP_VECTOR_SIZE);
393620 }

◆ VectorFinished()

template<class T>
bool duckdb::AlpScanState< T >::VectorFinished ( ) const
inline
393622 {
393623 return (total_value_count % AlpConstants::ALP_VECTOR_SIZE) == 0;
393624 }

◆ ScanVector()

template<class T>
template<class EXACT_TYPE, bool SKIP = false>
void duckdb::AlpScanState< T >::ScanVector ( T * values,
idx_t vector_size )
inline
393628 {
393630 D_ASSERT(vector_size <= LeftInVector());
393631 if (VectorFinished() && total_value_count < count) {
393633 LoadVector<SKIP>(values);
393634 total_value_count += vector_size;
393635 return;
393636 } else {
393637 // Even if SKIP is given, the vector size is not big enough to be able to fully skip the entire vector
393638 LoadVector<false>(vector_state.decoded_values);
393639 }
393640 }
393641 vector_state.template Scan<SKIP>((uint8_t *)values, vector_size);
393642
393643 total_value_count += vector_size;
393644 }

◆ SkipVector()

template<class T>
void duckdb::AlpScanState< T >::SkipVector ( )
inline
393647 {
393648 // Skip the offset indicating where the data starts
393649 metadata_ptr -= AlpConstants::METADATA_POINTER_SIZE;
393650 idx_t vector_size = MinValue((idx_t)AlpConstants::ALP_VECTOR_SIZE, count - total_value_count);
393651 total_value_count += vector_size;
393652 }

◆ LoadVector()

template<class T>
template<bool SKIP = false>
void duckdb::AlpScanState< T >::LoadVector ( T * value_buffer)
inline
393655 {
393656 vector_state.Reset();
393657
393658 // Load the offset (metadata) indicating where the vector data starts
393659 metadata_ptr -= AlpConstants::METADATA_POINTER_SIZE;
393660 auto data_byte_offset = Load<uint32_t>(metadata_ptr);
393661 D_ASSERT(data_byte_offset < segment.GetBlockSize());
393662
393663 idx_t vector_size = MinValue((idx_t)AlpConstants::ALP_VECTOR_SIZE, (count - total_value_count));
393664
393665 data_ptr_t vector_ptr = segment_data + data_byte_offset;
393666
393667 // Load the vector data
393668 vector_state.v_exponent = Load<uint8_t>(vector_ptr);
393670
393671 const bool uncompressed_mode = vector_state.v_exponent == AlpConstants::UNCOMPRESSED_MODE_SENTINEL;
393672 if (uncompressed_mode) {
393673 if (!SKIP) {
393674 // Read uncompressed values
393676 }
393677 return;
393678 }
393679 vector_state.v_factor = Load<uint8_t>(vector_ptr);
393681
393682 vector_state.exceptions_count = Load<uint16_t>(vector_ptr);
393684
393685 vector_state.frame_of_reference = Load<uint64_t>(vector_ptr);
393687
393688 vector_state.bit_width = Load<uint8_t>(vector_ptr);
393690
393691 D_ASSERT(vector_state.exceptions_count <= vector_size);
393692 D_ASSERT(vector_state.v_factor <= vector_state.v_exponent);
393693 D_ASSERT(vector_state.bit_width <= sizeof(uint64_t) * 8);
393694
393695 if (vector_state.bit_width > 0) {
393696 auto bp_size = BitpackingPrimitives::GetRequiredSize(vector_size, vector_state.bit_width);
393697 memcpy(vector_state.for_encoded, (void *)vector_ptr, bp_size);
393698 vector_ptr += bp_size;
393699 }
393700
393701 if (vector_state.exceptions_count > 0) {
393702 memcpy(vector_state.exceptions, (void *)vector_ptr, sizeof(EXACT_TYPE) * vector_state.exceptions_count);
393703 vector_ptr += sizeof(EXACT_TYPE) * vector_state.exceptions_count;
393704 memcpy(vector_state.exceptions_positions, (void *)vector_ptr,
393705 AlpConstants::EXCEPTION_POSITION_SIZE * vector_state.exceptions_count);
393706 }
393707
393708 // Decode all the vector values to the specified 'value_buffer'
393709 vector_state.template LoadValues<SKIP>(value_buffer, vector_size);
393710 }

◆ Skip()

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

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

393714 {
393715 if (total_value_count != 0 && !VectorFinished()) {
393716 // Finish skipping the current vector
393717 idx_t to_skip = MinValue<idx_t>(skip_count, LeftInVector());
393718 ScanVector<T, true>(nullptr, to_skip);
393719 skip_count -= to_skip;
393720 }
393721 // Figure out how many entire vectors we can skip
393722 // For these vectors, we don't even need to process the metadata or values
393724 for (idx_t i = 0; i < vectors_to_skip; i++) {
393725 SkipVector();
393726 }
393728 if (skip_count == 0) {
393729 return;
393730 }
393731 // For the last vector that this skip (partially) touches, we do need to
393732 // load the metadata and values into the vector_state because
393733 // we don't know exactly how many they are
393734 ScanVector<T, true>(nullptr, skip_count);
393735 }

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