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

Public Types

using CHIMP_TYPE = typename ChimpType<T>::TYPE

Public Member Functions

 ChimpScanState (ColumnSegment &segment)
idx_t LeftInGroup () const
bool GroupFinished () const
template<class CHIMP_TYPE>
void ScanGroup (CHIMP_TYPE *values, idx_t group_size)
void LoadGroup (CHIMP_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
idx_t total_value_count = 0
ChimpGroupState< CHIMP_TYPE > group_state
ColumnSegment & segment
idx_t segment_count

Constructor & Destructor Documentation

◆ ChimpScanState()

template<class T>
duckdb::ChimpScanState< T >::ChimpScanState ( ColumnSegment & segment)
inlineexplicit
397557 : segment(segment), segment_count(segment.count) {
397559
397560 handle = buffer_manager.Pin(segment.block);
397561 auto dataptr = handle.Ptr();
397562 // ScanStates never exceed the boundaries of a Segment,
397563 // but are not guaranteed to start at the beginning of the Block
397564 auto start_of_data_segment = dataptr + segment.GetBlockOffset() + ChimpPrimitives::HEADER_SIZE;
397565 group_state.Init(start_of_data_segment);
397566 auto metadata_offset = Load<uint32_t>(dataptr + segment.GetBlockOffset());
397567 metadata_ptr = dataptr + segment.GetBlockOffset() + metadata_offset;
397568 }
Definition duckdb.cpp:397553

Member Function Documentation

◆ LeftInGroup()

template<class T>
idx_t duckdb::ChimpScanState< T >::LeftInGroup ( ) const
inline
397578 {
397580 }

◆ GroupFinished()

template<class T>
bool duckdb::ChimpScanState< T >::GroupFinished ( ) const
inline
397582 {
397583 return (total_value_count % ChimpPrimitives::CHIMP_SEQUENCE_SIZE) == 0;
397584 }

◆ ScanGroup()

template<class T>
template<class CHIMP_TYPE>
void duckdb::ChimpScanState< T >::ScanGroup ( CHIMP_TYPE * values,
idx_t group_size )
inline
397587 {
397589 D_ASSERT(group_size <= LeftInGroup());
397590
397591 if (GroupFinished() && total_value_count < segment_count) {
397593 LoadGroup(values);
397594 total_value_count += group_size;
397595 return;
397596 } else {
397597 LoadGroup(group_state.values);
397598 }
397599 }
397600 group_state.Scan(values, group_size);
397601 total_value_count += group_size;
397602 }
void LoadGroup(CHIMP_TYPE *value_buffer)
Definition duckdb.cpp:397604

◆ LoadGroup()

template<class T>
void duckdb::ChimpScanState< T >::LoadGroup ( CHIMP_TYPE * value_buffer)
inline

FIXME: If we change the order of this to flag -> leading_zero_blocks -> packed_data We can leave out the leading zero block count as well, because it can be derived from Extracting all the flags and counting the 3's

397604 {
397608
397609 // Load the offset indicating where a groups data starts
397610 metadata_ptr -= sizeof(uint32_t);
397611 auto data_byte_offset = Load<uint32_t>(metadata_ptr);
397612 D_ASSERT(data_byte_offset < segment.GetBlockSize());
397613 // Only used for point queries
397615
397616 // Load how many blocks of leading zero bits we have
397617 metadata_ptr -= sizeof(uint8_t);
397618 auto leading_zero_block_count = Load<uint8_t>(metadata_ptr);
397620
397621 // Load the leading zero block count
397622 metadata_ptr -= 3ULL * leading_zero_block_count;
397623 const auto leading_zero_block_ptr = metadata_ptr;
397624
397625 // Figure out how many flags there are
397626 D_ASSERT(segment_count >= total_value_count);
397627 auto group_size = MinValue<idx_t>(segment_count - total_value_count, ChimpPrimitives::CHIMP_SEQUENCE_SIZE);
397628 // Reduce by one, because the first value of a group does not have a flag
397629 auto flag_count = group_size - 1;
397631
397632 // Load the flags
397633 metadata_ptr -= flag_byte_count;
397634 auto flags = metadata_ptr;
397635 group_state.LoadFlags(flags, flag_count);
397636
397637 // Load the leading zero blocks
397638 group_state.LoadLeadingZeros(leading_zero_block_ptr, (uint32_t)leading_zero_block_count * 8);
397639
397640 // Load packed data blocks
397641 auto packed_data_block_count = group_state.CalculatePackedDataCount();
397642 metadata_ptr -= packed_data_block_count * 2;
397643 if ((uint64_t)metadata_ptr & 1) {
397644 // Align on a two-byte boundary
397645 metadata_ptr--;
397646 }
397647 group_state.LoadPackedData((uint16_t *)metadata_ptr, packed_data_block_count);
397648
397649 group_state.Reset();
397650
397651 // Load all values for the group
397652 group_state.LoadValues(value_buffer, group_size);
397653 }
static T AlignValue(T n)
Align value (ceiling) (not for pointer types).
Definition duckdb.hpp:2126
Here is the call graph for this function:

◆ Skip()

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

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

397658 {
397659 using INTERNAL_TYPE = typename ChimpType<T>::TYPE;
397661
397662 while (skip_count) {
397663 auto skip_size = MinValue(skip_count, LeftInGroup());
397664 ScanGroup<CHIMP_TYPE>(buffer, skip_size);
397666 }
397667 }

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