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

Public Member Functions

 PositionalJoinGlobalState (ClientContext &context, const PhysicalPositionalJoin &op)
void InitializeScan ()
idx_t Refill ()
idx_t CopyData (DataChunk &output, const idx_t count, const idx_t col_offset)
void Execute (DataChunk &input, DataChunk &output)
void GetData (DataChunk &output)
Public Member Functions inherited from duckdb::GlobalSinkState
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const
virtual idx_t MaxThreads (idx_t source_max_threads)
Public Member Functions inherited from duckdb::StateWithBlockableTasks
unique_lock< mutex > Lock ()
void PreventBlocking (const unique_lock< mutex > &guard)
bool BlockTask (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
 Add a task to 'blocked_tasks' before returning SourceResultType::BLOCKED (must hold the lock).
bool CanBlock (const unique_lock< mutex > &guard) const
bool UnblockTasks (const unique_lock< mutex > &guard)
 Unblock all tasks (must hold the lock).
SinkResultType BlockSink (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
SourceResultType BlockSource (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
void VerifyLock (const unique_lock< mutex > &guard) const

Public Attributes

ColumnDataCollection rhs
ColumnDataAppendState append_state
mutex rhs_lock
bool initialized
ColumnDataScanState scan_state
DataChunk source
idx_t source_offset
bool exhausted
Public Attributes inherited from duckdb::GlobalSinkState
SinkFinalizeType state

Constructor & Destructor Documentation

◆ PositionalJoinGlobalState()

duckdb::PositionalJoinGlobalState::PositionalJoinGlobalState ( ClientContext & context,
const PhysicalPositionalJoin & op )
inlineexplicit
189649 : rhs(context, op.children[1].get().GetTypes()), initialized(false), source_offset(0), exhausted(false) {
189650 rhs.InitializeAppend(append_state);
189651 }

Member Function Documentation

◆ InitializeScan()

void duckdb::PositionalJoinGlobalState::InitializeScan ( )
189685 {
189686 if (!initialized) {
189687 // not initialized yet: initialize the scan
189688 initialized = true;
189689 rhs.InitializeScanChunk(source);
189690 rhs.InitializeScan(scan_state);
189691 }
189692}

◆ Refill()

idx_t duckdb::PositionalJoinGlobalState::Refill ( )
189694 {
189695 if (source_offset >= source.size()) {
189696 if (!exhausted) {
189697 source.Reset();
189698 rhs.Scan(scan_state, source);
189699 }
189700 source_offset = 0;
189701 }
189702
189703 const auto available = source.size() - source_offset;
189704 if (!available) {
189705 if (!exhausted) {
189706 source.Reset();
189707 for (idx_t i = 0; i < source.ColumnCount(); ++i) {
189708 auto &vec = source.data[i];
189709 vec.SetVectorType(VectorType::CONSTANT_VECTOR);
189710 ConstantVector::SetNull(vec, true);
189711 }
189712 exhausted = true;
189713 }
189714 }
189715
189716 return available;
189717}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ CopyData()

idx_t duckdb::PositionalJoinGlobalState::CopyData ( DataChunk & output,
const idx_t count,
const idx_t col_offset )
189719 {
189720 if (!source_offset && (source.size() >= count || exhausted)) {
189721 // Fast track: aligned and has enough data
189722 for (idx_t i = 0; i < source.ColumnCount(); ++i) {
189723 output.data[col_offset + i].Reference(source.data[i]);
189724 }
189725 source_offset += count;
189726 } else {
189727 // Copy data
189728 for (idx_t target_offset = 0; target_offset < count;) {
189729 const auto needed = count - target_offset;
189730 const auto available = exhausted ? needed : (source.size() - source_offset);
189731 const auto copy_size = MinValue(needed, available);
189732 const auto source_count = source_offset + copy_size;
189733 for (idx_t i = 0; i < source.ColumnCount(); ++i) {
189734 VectorOperations::Copy(source.data[i], output.data[col_offset + i], source_count, source_offset,
189735 target_offset);
189736 }
189737 target_offset += copy_size;
189738 source_offset += copy_size;
189739 Refill();
189740 }
189741 }
189742
189743 return source.ColumnCount();
189744}

◆ Execute()

void duckdb::PositionalJoinGlobalState::Execute ( DataChunk & input,
DataChunk & output )
189746 {
189747 lock_guard<mutex> client_guard(rhs_lock);
189748
189749 // Reference the input and assume it will be full
189750 const auto col_offset = input.ColumnCount();
189751 for (idx_t i = 0; i < col_offset; ++i) {
189752 output.data[i].Reference(input.data[i]);
189753 }
189754
189755 // Copy or reference the RHS columns
189756 const auto count = input.size();
189757 InitializeScan();
189758 Refill();
189759 CopyData(output, count, col_offset);
189760
189761 output.SetCardinality(count);
189762}
vector< Vector > data
The vectors owned by the DataChunk.
Definition duckdb.hpp:11445

◆ GetData()

void duckdb::PositionalJoinGlobalState::GetData ( DataChunk & output)
189774 {
189775 lock_guard<mutex> client_guard(rhs_lock);
189776
189777 InitializeScan();
189778 Refill();
189779
189780 // LHS exhausted
189781 if (exhausted) {
189782 // RHS exhausted too, so we are done
189783 output.SetCardinality(0);
189784 return;
189785 }
189786
189787 // LHS is all NULL
189788 const auto col_offset = output.ColumnCount() - source.ColumnCount();
189789 for (idx_t i = 0; i < col_offset; ++i) {
189790 auto &vec = output.data[i];
189791 vec.SetVectorType(VectorType::CONSTANT_VECTOR);
189792 ConstantVector::SetNull(vec, true);
189793 }
189794
189795 // RHS still has data, so copy it
189796 const auto count = MinValue<idx_t>(STANDARD_VECTOR_SIZE, source.size() - source_offset);
189797 CopyData(output, count, col_offset);
189798 output.SetCardinality(count);
189799}

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