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

Public Types

using EXACT_TYPE = typename FloatingToExact<T>::TYPE

Public Member Functions

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

Constructor & Destructor Documentation

◆ AlpRDScanState()

template<class T>
duckdb::AlpRDScanState< T >::AlpRDScanState ( ColumnSegment & segment)
inlineexplicit
394708 : segment(segment), count(segment.count) {
394710
394711 handle = buffer_manager.Pin(segment.block);
394712 // ScanStates never exceed the boundaries of a Segment,
394713 // but are not guaranteed to start at the beginning of the Block
394714 segment_data = handle.Ptr() + segment.GetBlockOffset();
394715 auto metadata_offset = Load<uint32_t>(segment_data);
394716 metadata_ptr = segment_data + metadata_offset;
394717
394718 // Load the Right Bit Width which is in the segment header after the pointer to the first metadata
394719 vector_state.right_bit_width = Load<uint8_t>(segment_data + AlpRDConstants::METADATA_POINTER_SIZE);
394720 vector_state.left_bit_width =
394722
394727
394728 // Load the left parts dictionary which is after the segment header and is of a fixed size
394729 memcpy(vector_state.left_parts_dict, (void *)(segment_data + AlpRDConstants::HEADER_SIZE),
394731 }
Definition duckdb.cpp:394704

Member Function Documentation

◆ LeftInVector()

template<class T>
idx_t duckdb::AlpRDScanState< T >::LeftInVector ( ) const
inline
394742 {
394744 }

◆ VectorFinished()

template<class T>
bool duckdb::AlpRDScanState< T >::VectorFinished ( ) const
inline
394746 {
394747 return (total_value_count % AlpRDConstants::ALP_VECTOR_SIZE) == 0;
394748 }

◆ ScanVector()

template<class T>
template<class EXACT_TYPE, bool SKIP = false>
void duckdb::AlpRDScanState< T >::ScanVector ( EXACT_TYPE * values,
idx_t vector_size )
inline
394752 {
394754 D_ASSERT(vector_size <= LeftInVector());
394755 if (VectorFinished() && total_value_count < count) {
394757 LoadVector<SKIP>(values);
394758 total_value_count += vector_size;
394759 return;
394760 } else {
394761 // Even if SKIP is given, the vector size is not big enough to be able to fully skip the entire vector
394762 LoadVector<false>(vector_state.decoded_values);
394763 }
394764 }
394765 vector_state.template Scan<SKIP>((uint8_t *)values, vector_size);
394766
394767 total_value_count += vector_size;
394768 }

◆ SkipVector()

template<class T>
void duckdb::AlpRDScanState< T >::SkipVector ( )
inline
394771 {
394772 // Skip the offset indicating where the data starts
394774 idx_t vector_size = MinValue((idx_t)AlpRDConstants::ALP_VECTOR_SIZE, count - total_value_count);
394775 total_value_count += vector_size;
394776 }

◆ LoadVector()

template<class T>
template<bool SKIP = false>
void duckdb::AlpRDScanState< T >::LoadVector ( EXACT_TYPE * value_buffer)
inline
394779 {
394780 vector_state.Reset();
394781
394782 // Load the offset (metadata) indicating where the vector data starts
394784 auto data_byte_offset = Load<uint32_t>(metadata_ptr);
394785 D_ASSERT(data_byte_offset < segment.GetBlockSize());
394786
394787 idx_t vector_size = MinValue((idx_t)AlpRDConstants::ALP_VECTOR_SIZE, (count - total_value_count));
394788
394789 data_ptr_t vector_ptr = segment_data + data_byte_offset;
394790
394791 // Load the vector data
394792 vector_state.exceptions_count = Load<uint16_t>(vector_ptr);
394794
394795 const bool uncompressed_mode = vector_state.exceptions_count == AlpRDConstants::UNCOMPRESSED_MODE_SENTINEL;
394796 if (uncompressed_mode) {
394797 if (!SKIP) {
394798 // Read uncompressed values
394800 }
394801 return;
394802 }
394803
394804 auto left_bp_size = BitpackingPrimitives::GetRequiredSize(vector_size, vector_state.left_bit_width);
394805 auto right_bp_size = BitpackingPrimitives::GetRequiredSize(vector_size, vector_state.right_bit_width);
394806
394807 memcpy(vector_state.left_encoded, (void *)vector_ptr, left_bp_size);
394809
394810 memcpy(vector_state.right_encoded, (void *)vector_ptr, right_bp_size);
394812
394813 if (vector_state.exceptions_count > 0) {
394814 memcpy(vector_state.exceptions, (void *)vector_ptr,
394815 AlpRDConstants::EXCEPTION_SIZE * vector_state.exceptions_count);
394816 vector_ptr += AlpRDConstants::EXCEPTION_SIZE * vector_state.exceptions_count;
394817 memcpy(vector_state.exceptions_positions, (void *)vector_ptr,
394818 AlpRDConstants::EXCEPTION_POSITION_SIZE * vector_state.exceptions_count);
394819 }
394820
394821 // Decode all the vector values to the specified 'value_buffer'
394822 vector_state.template LoadValues<SKIP>(value_buffer, vector_size);
394823 }

◆ Skip()

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

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

394827 {
394828 if (total_value_count != 0 && !VectorFinished()) {
394829 // Finish skipping the current vector
394830 idx_t to_skip = MinValue<idx_t>(skip_count, LeftInVector());
394831 ScanVector<EXACT_TYPE, true>(nullptr, to_skip);
394832 skip_count -= to_skip;
394833 }
394834 // Figure out how many entire vectors we can skip
394835 // For these vectors, we don't even need to process the metadata or values
394837 for (idx_t i = 0; i < vectors_to_skip; i++) {
394838 SkipVector();
394839 }
394841 if (skip_count == 0) {
394842 return;
394843 }
394844 // For the last vector that this skip (partially) touches, we do need to
394845 // load the metadata and values into the vector_state because
394846 // we don't know exactly how many they are
394847 ScanVector<EXACT_TYPE, true>(nullptr, skip_count);
394848 }

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