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

Public Member Functions

 HashJoinGlobalSinkState (const PhysicalHashJoin &op_p, ClientContext &context_p)
void ScheduleFinalize (Pipeline &pipeline, Event &event)
void InitializeProbeSpill ()
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

ClientContext & context
const PhysicalHashJoin & op
const idx_t num_threads
unique_ptr< TemporaryMemoryState > temporary_memory_state
 Temporary memory state for managing this operator's memory usage.
unique_ptr< JoinHashTable > hash_table
 Global HT used by the join.
unique_ptr< PerfectHashJoinExecutor > perfect_join_executor
 The perfect hash join executor (if any).
bool finalized
 Whether or not the hash table has been finalized.
atomic< idx_t > active_local_states
 The number of active local states.
bool external
 Whether we are doing an external + some sizes.
idx_t total_size
idx_t max_partition_size
idx_t max_partition_count
idx_t probe_side_requirement
vector< unique_ptr< JoinHashTable > > local_hash_tables
 Hash tables built by each thread.
vector< LogicalType > probe_types
 Excess probe data gathered during Sink.
unique_ptr< JoinHashTable::ProbeSpill > probe_spill
atomic< bool > scanned_data
 Whether or not we have started scanning data using GetData.
bool skip_filter_pushdown = false
unique_ptr< JoinFilterGlobalState > global_filter_state
Public Attributes inherited from duckdb::GlobalSinkState
SinkFinalizeType state

Constructor & Destructor Documentation

◆ HashJoinGlobalSinkState()

duckdb::HashJoinGlobalSinkState::HashJoinGlobalSinkState ( const PhysicalHashJoin & op_p,
ClientContext & context_p )
inline
184348 : context(context_p), op(op_p),
184349 num_threads(NumericCast<idx_t>(TaskScheduler::GetScheduler(context).NumberOfThreads())),
184350 temporary_memory_state(TemporaryMemoryManager::Get(context).Register(context)), finalized(false),
184351 active_local_states(0), total_size(0), max_partition_size(0), max_partition_count(0),
184352 probe_side_requirement(0), scanned_data(false) {
184353 hash_table = op.InitializeHashTable(context);
184354
184355 // For perfect hash join
184356 perfect_join_executor = make_uniq<PerfectHashJoinExecutor>(op, *hash_table);
184357 bool use_perfect_hash = false;
184358 if (op.conditions.size() == 1 && !op.join_stats.empty() && op.join_stats[1] &&
184359 TypeIsIntegral(op.join_stats[1]->GetType().InternalType()) && NumericStats::HasMinMax(*op.join_stats[1])) {
184360 use_perfect_hash = perfect_join_executor->CanDoPerfectHashJoin(op, NumericStats::Min(*op.join_stats[1]),
184361 NumericStats::Max(*op.join_stats[1]));
184362 }
184363 // For external hash join
184364 external = ClientConfig::GetConfig(context).force_external;
184365 // Set probe types
184366 probe_types = op.children[0].get().GetTypes();
184367 probe_types.emplace_back(LogicalType::HASH);
184368
184369 if (op.filter_pushdown) {
184370 if (op.filter_pushdown->probe_info.empty() && use_perfect_hash) {
184371 // Only computing min/max to check for perfect HJ, but we already can
184372 skip_filter_pushdown = true;
184373 }
184374 global_filter_state = op.filter_pushdown->GetGlobalState(context, op);
184375 }
184376 }
unique_ptr< PerfectHashJoinExecutor > perfect_join_executor
The perfect hash join executor (if any).
Definition duckdb.cpp:184397
atomic< bool > scanned_data
Whether or not we have started scanning data using GetData.
Definition duckdb.cpp:184418
bool finalized
Whether or not the hash table has been finalized.
Definition duckdb.cpp:184399
unique_ptr< JoinHashTable > hash_table
Global HT used by the join.
Definition duckdb.cpp:184395
unique_ptr< TemporaryMemoryState > temporary_memory_state
Temporary memory state for managing this operator's memory usage.
Definition duckdb.cpp:184392
atomic< idx_t > active_local_states
The number of active local states.
Definition duckdb.cpp:184401
vector< LogicalType > probe_types
Excess probe data gathered during Sink.
Definition duckdb.cpp:184414
bool external
Whether we are doing an external + some sizes.
Definition duckdb.cpp:184404
static TemporaryMemoryManager & Get(ClientContext &context)
Get the TemporaryMemoryManager.
Definition duckdb.cpp:443547
static DUCKDB_API Value Min(const BaseStatistics &stats)
Returns the min value - throws an exception if there is no min value.
Definition duckdb.cpp:424256
static DUCKDB_API Value Max(const BaseStatistics &stats)
Returns the max value - throws an exception if there is no max value.
Definition duckdb.cpp:424263
static DUCKDB_API bool HasMinMax(const BaseStatistics &stats)
Returns true if the stats has both a min and max value defined.
Definition duckdb.cpp:424237

◆ ~HashJoinGlobalSinkState()

duckdb::HashJoinGlobalSinkState::~HashJoinGlobalSinkState ( )
inlineoverride
184378 {
184379 DUCKDB_LOG(context, PhysicalOperatorLogType, op, "PhysicalHashJoin", "GetData",
184380 {{"total_probe_matches", to_string(hash_table->total_probe_matches)}});
184381 }
std::string to_string(const T &value)
Definition duckdb.cpp:19425

Member Function Documentation

◆ ScheduleFinalize()

void duckdb::HashJoinGlobalSinkState::ScheduleFinalize ( Pipeline & pipeline,
Event & event )
184801 {
184802 if (hash_table->Count() == 0) {
184803 hash_table->finalized = true;
184804 return;
184805 }
184806 hash_table->AllocatePointerTable();
184807
184808 auto new_init_event = make_shared_ptr<HashJoinTableInitEvent>(pipeline, *this);
184809 event.InsertEvent(new_init_event);
184810
184811 auto new_finalize_event = make_shared_ptr<HashJoinFinalizeEvent>(pipeline, *this);
184812 new_init_event->InsertEvent(std::move(new_finalize_event));
184813}

◆ InitializeProbeSpill()

void duckdb::HashJoinGlobalSinkState::InitializeProbeSpill ( )
184815 {
184816 auto guard = Lock();
184817 if (!probe_spill) {
184818 probe_spill = make_uniq<JoinHashTable::ProbeSpill>(*hash_table, context, probe_types);
184819 }
184820}

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