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

Public Member Functions

 CollectionScanState (TableScanState &parent_p)
void Initialize (const QueryContext &context, const vector< LogicalType > &types)
const vector< StorageIndex > & GetColumnIds ()
ScanFilterInfo & GetFilterInfo ()
ScanSamplingInfo & GetSamplingInfo ()
TableScanOptions & GetOptions ()
optional_ptr< SegmentNode< RowGroup > > GetNextRowGroup (SegmentNode< RowGroup > &row_group) const
optional_ptr< SegmentNode< RowGroup > > GetNextRowGroup (SegmentLock &l, SegmentNode< RowGroup > &row_group) const
optional_ptr< SegmentNode< RowGroup > > GetRootSegment () const
bool Scan (DuckTransaction &transaction, DataChunk &result)
bool Scan (DataChunk &result, TableScanType type, optional_ptr< SegmentLock > l=nullptr)

Public Attributes

optional_ptr< SegmentNode< RowGroup > > row_group
 The current row_group we are scanning.
idx_t vector_index
 The vector index within the row_group.
idx_t max_row_group_row
 The maximum row within the row group.
unsafe_vector< ColumnScanState > column_scans
 Child column scans.
shared_ptr< RowGroupSegmentTree > row_groups
 Row group segment tree we are scanning.
idx_t max_row
 The total maximum row index.
idx_t batch_index
 The current batch index.
SelectionVector valid_sel
 The valid selection.
RandomEngine random
unique_ptr< RowGroupReorderer > reorderer
 Optional state for custom row group ordering.

Private Attributes

TableScanState & parent

Constructor & Destructor Documentation

◆ CollectionScanState()

duckdb::CollectionScanState::CollectionScanState ( TableScanState & parent_p)
explicit
437513 : row_group(nullptr), vector_index(0), max_row_group_row(0), row_groups(nullptr), max_row(0), batch_index(0),
437514 valid_sel(STANDARD_VECTOR_SIZE), random(-1), parent(parent_p) {
437515}
SelectionVector valid_sel
The valid selection.
Definition duckdb.cpp:75054
idx_t vector_index
The vector index within the row_group.
Definition duckdb.cpp:75042
shared_ptr< RowGroupSegmentTree > row_groups
Row group segment tree we are scanning.
Definition duckdb.cpp:75048
idx_t max_row_group_row
The maximum row within the row group.
Definition duckdb.cpp:75044
idx_t max_row
The total maximum row index.
Definition duckdb.cpp:75050
idx_t batch_index
The current batch index.
Definition duckdb.cpp:75052
optional_ptr< SegmentNode< RowGroup > > row_group
The current row_group we are scanning.
Definition duckdb.cpp:75040

Member Function Documentation

◆ Initialize()

void duckdb::CollectionScanState::Initialize ( const QueryContext & context,
const vector< LogicalType > & types )
433253 {
433254 auto &column_ids = GetColumnIds();
433255 D_ASSERT(column_scans.empty());
433256 column_scans.reserve(column_scans.size());
433257 for (idx_t i = 0; i < column_ids.size(); i++) {
433258 column_scans.emplace_back(*this);
433259 }
433260 for (idx_t i = 0; i < column_ids.size(); i++) {
433261 if (column_ids[i].IsRowIdColumn()) {
433262 continue;
433263 }
433264 auto index = column_ids[i].GetPrimaryIndex();
433265 auto &type = types[index];
433266 column_scans[i].Initialize(context, type, column_ids[i], &GetOptions());
433267 }
433268}
unsafe_vector< ColumnScanState > column_scans
Child column scans.
Definition duckdb.cpp:75046
index
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ GetColumnIds()

const vector< StorageIndex > & duckdb::CollectionScanState::GetColumnIds ( )
437475 {
437476 return parent.GetColumnIds();
437477}

◆ GetFilterInfo()

ScanFilterInfo & duckdb::CollectionScanState::GetFilterInfo ( )
437481 {
437482 return parent.GetFilterInfo();
437483}

◆ GetSamplingInfo()

ScanSamplingInfo & duckdb::CollectionScanState::GetSamplingInfo ( )
437485 {
437486 return parent.GetSamplingInfo();
437487}

◆ GetOptions()

TableScanOptions & duckdb::CollectionScanState::GetOptions ( )
437489 {
437490 return parent.options;
437491}

◆ GetNextRowGroup() [1/2]

optional_ptr< SegmentNode< RowGroup > > duckdb::CollectionScanState::GetNextRowGroup ( SegmentNode< RowGroup > & row_group) const
437517 {
437518 if (reorderer) {
437519 return reorderer->GetNextRowGroup(row_group);
437520 }
437521 return row_groups->GetNextSegment(row_group);
437522}
unique_ptr< RowGroupReorderer > reorderer
Optional state for custom row group ordering.
Definition duckdb.cpp:75059

◆ GetNextRowGroup() [2/2]

optional_ptr< SegmentNode< RowGroup > > duckdb::CollectionScanState::GetNextRowGroup ( SegmentLock & l,
SegmentNode< RowGroup > & row_group ) const
437525 {
437526 D_ASSERT(!reorderer);
437527 return row_groups->GetNextSegment(l, row_group);
437528}

◆ GetRootSegment()

optional_ptr< SegmentNode< RowGroup > > duckdb::CollectionScanState::GetRootSegment ( ) const
437530 {
437531 if (reorderer) {
437532 return reorderer->GetRootSegment(*row_groups);
437533 }
437534 return row_groups->GetRootSegment();
437535}

◆ Scan() [1/2]

bool duckdb::CollectionScanState::Scan ( DuckTransaction & transaction,
DataChunk & result )
437537 {
437538 while (row_group) {
437539 row_group->GetNode().Scan(TransactionData(transaction), *this, result);
437540 if (result.size() > 0) {
437541 return true;
437542 }
437543 if (max_row <= row_group->GetRowStart() + row_group->GetNode().count) {
437544 row_group = nullptr;
437545 return false;
437546 }
437547 do {
437548 row_group = GetNextRowGroup(*row_group).get();
437549 if (row_group) {
437550 if (row_group->GetRowStart() >= max_row) {
437551 row_group = nullptr;
437552 break;
437553 }
437554 bool scan_row_group = row_group->GetNode().InitializeScan(*this, *row_group);
437555 if (scan_row_group) {
437556 // scan this row group
437557 break;
437558 }
437559 }
437560 } while (row_group);
437561 }
437562 return false;
437563}

◆ Scan() [2/2]

bool duckdb::CollectionScanState::Scan ( DataChunk & result,
TableScanType type,
optional_ptr< SegmentLock > l = nullptr )
437565 {
437566 while (row_group) {
437567 row_group->GetNode().Scan(*this, result, type);
437568 if (result.size() > 0) {
437569 return true;
437570 }
437571 // move to the next row group
437572 if (l) {
437573 row_group = GetNextRowGroup(*l, *row_group).get();
437574 } else {
437575 row_group = GetNextRowGroup(*row_group).get();
437576 }
437577 if (row_group) {
437578 row_group->GetNode().InitializeScan(*this, *row_group);
437579 }
437580 }
437581 return false;
437582}

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