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

Public Member Functions

 DuckTableScanState (ClientContext &context, const FunctionData *bind_data_p)
unique_ptr< LocalTableFunctionState > InitLocalState (ExecutionContext &context, TableFunctionInitInput &input) override
void TableScanFunc (ClientContext &context, TableFunctionInput &data_p, DataChunk &output) override
double TableScanProgress (ClientContext &context, const FunctionData *bind_data_p) const override
OperatorPartitionData TableScanGetPartitionData (ClientContext &context, TableFunctionGetPartitionInput &input) override
idx_t TableScanRowsScanned (LocalTableFunctionState &state) override
Public Member Functions inherited from duckdb::TableScanGlobalState
 TableScanGlobalState (ClientContext &context, const FunctionData *bind_data_p)
idx_t MaxThreads () const override
bool CanRemoveFilterColumns () const
Public Member Functions inherited from duckdb::GlobalTableFunctionState
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Public Attributes

ParallelTableScanState state
Public Attributes inherited from duckdb::TableScanGlobalState
idx_t max_threads
 The maximum number of threads for this table scan.
vector< idx_t > projection_ids
 The projected columns of this table scan.
vector< LogicalType > scanned_types
 The types of all scanned columns.

Private Attributes

const TableScanBindData & bind_data
DuckTableEntry & duck_table
DuckTransaction & tx
DataTable & storage
const idx_t total_rows

Additional Inherited Members

Static Public Attributes inherited from duckdb::GlobalTableFunctionState
static constexpr const int64_t MAX_THREADS = 999999999

Constructor & Destructor Documentation

◆ DuckTableScanState()

duckdb::DuckTableScanState::DuckTableScanState ( ClientContext & context,
const FunctionData * bind_data_p )
inline
251382 : TableScanGlobalState(context, bind_data_p), bind_data(bind_data_p->Cast<TableScanBindData>()),
251383 duck_table(bind_data.table.Cast<DuckTableEntry>()), tx(DuckTransaction::Get(context, duck_table.catalog)),
251384 storage(duck_table.GetStorage()), total_rows(storage.GetTotalRows()) {
251385 }

Member Function Documentation

◆ InitLocalState()

unique_ptr< LocalTableFunctionState > duckdb::DuckTableScanState::InitLocalState ( ExecutionContext & context,
TableFunctionInitInput & input )
inlineoverridevirtual

Implements duckdb::TableScanGlobalState.

251399 {
251400 auto l_state = make_uniq<TableScanLocalState>();
251401
251402 vector<StorageIndex> storage_ids;
251403 for (auto &col : input.column_indexes) {
251404 storage_ids.push_back(bind_data.table.GetStorageIndex(col));
251405 }
251406
251407 if (bind_data.order_options) {
251408 l_state->scan_state.table_state.reorderer = make_uniq<RowGroupReorderer>(*bind_data.order_options);
251409 l_state->scan_state.local_state.reorderer = make_uniq<RowGroupReorderer>(*bind_data.order_options);
251410 }
251411
251412 l_state->scan_state.Initialize(std::move(storage_ids), context.client, input.filters, input.sample_options);
251413
251414 l_state->rows_in_current_row_group = storage.NextParallelScan(context.client, state, l_state->scan_state);
251415 if (input.CanRemoveFilterColumns()) {
251416 l_state->all_columns.Initialize(context.client, scanned_types);
251417 }
251418
251419 l_state->scan_state.options.force_fetch_row = ClientConfig::GetConfig(context.client).force_fetch_row;
251420 return std::move(l_state);
251421 }
vector< LogicalType > scanned_types
The types of all scanned columns.
Definition duckdb.cpp:251199

◆ TableScanFunc()

void duckdb::DuckTableScanState::TableScanFunc ( ClientContext & context,
TableFunctionInput & data_p,
DataChunk & output )
inlineoverridevirtual

Implements duckdb::TableScanGlobalState.

251423 {
251424 auto &l_state = data_p.local_state->Cast<TableScanLocalState>();
251425 l_state.scan_state.options.force_fetch_row = ClientConfig::GetConfig(context).force_fetch_row;
251426
251427 do {
251428 if (bind_data.is_create_index) {
251429 storage.CreateIndexScan(l_state.scan_state, output);
251430 } else if (CanRemoveFilterColumns()) {
251431 l_state.all_columns.Reset();
251432 storage.Scan(tx, l_state.all_columns, l_state.scan_state);
251433 output.ReferenceColumns(l_state.all_columns, projection_ids);
251434 } else {
251435 storage.Scan(tx, output, l_state.scan_state);
251436 }
251437 if (output.size() > 0) {
251438 return;
251439 }
251440
251441 // We have fully processed a row group. Add to scanned_rows
251442 l_state.rows_scanned += l_state.rows_in_current_row_group;
251443 l_state.rows_in_current_row_group = storage.NextParallelScan(context, state, l_state.scan_state);
251444
251445 if (data_p.results_execution_mode == AsyncResultsExecutionMode::TASK_EXECUTOR) {
251446 // We can avoid looping, and just return as appropriate
251447 if (l_state.rows_in_current_row_group == 0) {
251448 data_p.async_result = AsyncResultType::FINISHED;
251449 } else {
251450 data_p.async_result = AsyncResultType::HAVE_MORE_OUTPUT;
251451 }
251452 return;
251453 }
251454 if (l_state.rows_in_current_row_group == 0) {
251455 return;
251456 }
251457
251458 // Before looping back, check if we are interrupted
251459 if (context.interrupted) {
251460 throw InterruptException();
251461 }
251462 } while (true);
251463 }
vector< idx_t > projection_ids
The projected columns of this table scan.
Definition duckdb.cpp:251197

◆ TableScanProgress()

double duckdb::DuckTableScanState::TableScanProgress ( ClientContext & context,
const FunctionData * bind_data_p ) const
inlineoverridevirtual

Implements duckdb::TableScanGlobalState.

251465 {
251466 // The table is empty or smaller than the standard vector size.
251467 if (total_rows == 0) {
251468 return 100;
251469 }
251470
251471 idx_t scanned_rows = state.scan_state.processed_rows;
251472 scanned_rows += state.local_state.processed_rows;
251473 auto percentage = 100 * (static_cast<double>(scanned_rows) / static_cast<double>(total_rows));
251474 if (percentage > 100) {
251475 // If the last chunk has fewer elements than STANDARD_VECTOR_SIZE, and if our percentage is over 100,
251476 // then we finished this table.
251477 return 100;
251478 }
251479 return percentage;
251480 }
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ TableScanGetPartitionData()

OperatorPartitionData duckdb::DuckTableScanState::TableScanGetPartitionData ( ClientContext & context,
TableFunctionGetPartitionInput & input )
inlineoverridevirtual

Implements duckdb::TableScanGlobalState.

251483 {
251484 auto &l_state = input.local_state->Cast<TableScanLocalState>();
251485 if (l_state.scan_state.table_state.row_group) {
251486 return OperatorPartitionData(l_state.scan_state.table_state.batch_index);
251487 }
251488 if (l_state.scan_state.local_state.row_group) {
251489 return OperatorPartitionData(l_state.scan_state.table_state.batch_index +
251490 l_state.scan_state.local_state.batch_index);
251491 }
251492 return OperatorPartitionData(0);
251493 }

◆ TableScanRowsScanned()

idx_t duckdb::DuckTableScanState::TableScanRowsScanned ( LocalTableFunctionState & state)
inlineoverridevirtual

Implements duckdb::TableScanGlobalState.

251495 {
251496 auto &l_state = state.Cast<TableScanLocalState>();
251497 return l_state.rows_scanned;
251498 }

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