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::AsOfPayloadScanner Class Reference
Collaboration diagram for duckdb::AsOfPayloadScanner:

Public Types

using Types = vector<LogicalType>
using Columns = vector<column_t>

Public Member Functions

 AsOfPayloadScanner (const SortedRun &sorted_run, const SortStrategy &sort_strategy)
idx_t Base () const
idx_t Scanned () const
idx_t Remaining () const
idx_t NextSize () const
void SeekBlock (idx_t block_idx)
void SeekRow (idx_t row_idx)
bool Scan (DataChunk &chunk)

Private Types

using scan_t = bool (duckdb::AsOfPayloadScanner::*)()

Private Member Functions

template<SortKeyType SORT_KEY_TYPE>
bool TemplatedScan ()

Private Attributes

scan_t scan_func
const SortedRun & sorted_run
ExternalBlockIteratorState block_state
Vector sort_key_pointers = Vector(LogicalType::POINTER)
SortedRunScanState scan_state
const Columns scan_ids
DataChunk scan_chunk
const idx_t count
idx_t base = 0
idx_t scanned = 0
idx_t chunk_idx = 0

Constructor & Destructor Documentation

◆ AsOfPayloadScanner()

duckdb::AsOfPayloadScanner::AsOfPayloadScanner ( const SortedRun & sorted_run,
const SortStrategy & sort_strategy )
181938 : sorted_run(sorted_run), block_state(*sorted_run.key_data, sorted_run.payload_data.get()),
181939 scan_state(sorted_run.context, sorted_run.sort), scan_ids(sort_strategy.scan_ids), count(sorted_run.Count()) {
181940 scan_chunk.Initialize(sorted_run.context, sort_strategy.payload_types);
181941 const auto sort_key_type = sorted_run.key_data->GetLayout().GetSortKeyType();
181942 switch (sort_key_type) {
181944 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::NO_PAYLOAD_FIXED_8>;
181945 break;
181946 case SortKeyType::NO_PAYLOAD_FIXED_16:
181947 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::NO_PAYLOAD_FIXED_16>;
181948 break;
181949 case SortKeyType::NO_PAYLOAD_FIXED_24:
181950 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::NO_PAYLOAD_FIXED_24>;
181951 break;
181952 case SortKeyType::NO_PAYLOAD_FIXED_32:
181953 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::NO_PAYLOAD_FIXED_32>;
181954 break;
181955 case SortKeyType::NO_PAYLOAD_VARIABLE_32:
181956 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::NO_PAYLOAD_VARIABLE_32>;
181957 break;
181959 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::PAYLOAD_FIXED_16>;
181960 break;
181961 case SortKeyType::PAYLOAD_FIXED_24:
181962 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::PAYLOAD_FIXED_24>;
181963 break;
181964 case SortKeyType::PAYLOAD_FIXED_32:
181965 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::PAYLOAD_FIXED_32>;
181966 break;
181967 case SortKeyType::PAYLOAD_VARIABLE_32:
181968 scan_func = &AsOfPayloadScanner::TemplatedScan<SortKeyType::PAYLOAD_VARIABLE_32>;
181969 break;
181970 default:
181971 throw NotImplementedException("AsOfPayloadScanner for %s", EnumUtil::ToString(sort_key_type));
181972 }
181973}
@ NO_PAYLOAD_FIXED_8
Without payload.
Definition duckdb.cpp:55338
@ PAYLOAD_FIXED_16
With payload (requires row pointer in key).
Definition duckdb.cpp:55344

Member Function Documentation

◆ Base()

idx_t duckdb::AsOfPayloadScanner::Base ( ) const
inline
181868 {
181869 return base;
181870 }

◆ Scanned()

idx_t duckdb::AsOfPayloadScanner::Scanned ( ) const
inline
181871 {
181872 return scanned;
181873 }

◆ Remaining()

idx_t duckdb::AsOfPayloadScanner::Remaining ( ) const
inline
181874 {
181875 return count - scanned;
181876 }

◆ NextSize()

idx_t duckdb::AsOfPayloadScanner::NextSize ( ) const
inline
181877 {
181878 return MinValue<idx_t>(Remaining(), STANDARD_VECTOR_SIZE);
181879 }

◆ SeekBlock()

void duckdb::AsOfPayloadScanner::SeekBlock ( idx_t block_idx)
inline
181880 {
181881 chunk_idx = block_idx;
181882 base = MinValue<idx_t>(chunk_idx * STANDARD_VECTOR_SIZE, count);
181883 scanned = base;
181884 }

◆ SeekRow()

void duckdb::AsOfPayloadScanner::SeekRow ( idx_t row_idx)
inline
181885 {
181886 SeekBlock(row_idx / STANDARD_VECTOR_SIZE);
181887 }

◆ Scan()

bool duckdb::AsOfPayloadScanner::Scan ( DataChunk & chunk)
inline
181888 {
181889 // Free the previous blocks
181890 block_state.SetKeepPinned(true);
181891 block_state.SetPinPayload(true);
181892
181893 base = scanned;
181894 const auto result = (this->*scan_func)();
181895 chunk.ReferenceColumns(scan_chunk, scan_ids);
181896 scanned += scan_chunk.size();
181897 ++chunk_idx;
181898 return result;
181899 }
DUCKDB_API void ReferenceColumns(DataChunk &other, const vector< column_t > &column_ids)
Makes this DataChunk reference the specified columns in the other DataChunk.
Definition duckdb.cpp:116947

◆ TemplatedScan()

template<SortKeyType SORT_KEY_TYPE>
bool duckdb::AsOfPayloadScanner::TemplatedScan ( )
inlineprivate
181903 {
181904 using SORT_KEY = SortKey<SORT_KEY_TYPE>;
181905 using BLOCK_ITERATOR = block_iterator_t<ExternalBlockIteratorState, SORT_KEY>;
181906 BLOCK_ITERATOR itr(block_state, chunk_idx, 0);
181907
181908 const auto sort_keys = FlatVector::GetData<SORT_KEY *>(sort_key_pointers);
181909 const auto result_count = NextSize();
181910 for (idx_t i = 0; i < result_count; ++i) {
181911 const auto idx = block_state.GetIndex(chunk_idx, i);
181912 sort_keys[i] = &itr[idx];
181913 }
181914
181915 // Scan
181916 scan_chunk.Reset();
181917 scan_state.Scan(sorted_run, sort_key_pointers, result_count, scan_chunk);
181918 return scan_chunk.size() > 0;
181919 }
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

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