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

Public Member Functions

 OuterJoinMarker (bool enabled)
bool Enabled () const
void Initialize (idx_t count)
 Initializes the outer join counter.
void Reset ()
 Resets the outer join counter.
void SetMatch (idx_t position)
 Sets an indiivdual match.
void SetMatches (const SelectionVector &sel, idx_t count, idx_t base_idx=0)
 Sets multiple matches.
void ConstructLeftJoinResult (DataChunk &left, DataChunk &result)
 Constructs a left-join result based on which tuples have not found matches.
idx_t MaxThreads () const
 Returns the maximum number of threads that can be associated with an right-outer join scan.
void InitializeScan (ColumnDataCollection &data, OuterJoinGlobalScanState &gstate)
 Initialize a scan.
void InitializeScan (OuterJoinGlobalScanState &gstate, OuterJoinLocalScanState &lstate)
 Initialize a local scan.
void Scan (OuterJoinGlobalScanState &gstate, OuterJoinLocalScanState &lstate, DataChunk &result)
 Perform the scan.
const bool * GetMatches () const
 Read-only matches vector.

Private Attributes

bool enabled
unsafe_unique_array< bool > found_match
idx_t count

Constructor & Destructor Documentation

◆ OuterJoinMarker()

duckdb::OuterJoinMarker::OuterJoinMarker ( bool enabled)
explicit
180906 : enabled(enabled_p), count(0) {
180907}

Member Function Documentation

◆ Enabled()

bool duckdb::OuterJoinMarker::Enabled ( ) const
inline
180861 {
180862 return enabled;
180863 }

◆ Initialize()

void duckdb::OuterJoinMarker::Initialize ( idx_t count)

Initializes the outer join counter.

180909 {
180910 if (!enabled) {
180911 return;
180912 }
180913 this->count = count_p;
180914 found_match = make_unsafe_uniq_array_uninitialized<bool>(count);
180915 Reset();
180916}
void Reset()
Resets the outer join counter.
Definition duckdb.cpp:180918
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Reset()

void duckdb::OuterJoinMarker::Reset ( )

Resets the outer join counter.

180918 {
180919 if (!enabled) {
180920 return;
180921 }
180922 memset(found_match.get(), 0, sizeof(bool) * count);
180923}
Here is the caller graph for this function:

◆ SetMatch()

void duckdb::OuterJoinMarker::SetMatch ( idx_t position)

Sets an indiivdual match.

180925 {
180926 if (!enabled) {
180927 return;
180928 }
180929 D_ASSERT(position < count);
180930 found_match[position] = true;
180931}

◆ SetMatches()

void duckdb::OuterJoinMarker::SetMatches ( const SelectionVector & sel,
idx_t count,
idx_t base_idx = 0 )

Sets multiple matches.

180933 {
180934 if (!enabled) {
180935 return;
180936 }
180937 for (idx_t i = 0; i < count; i++) {
180938 auto idx = sel.get_index(i);
180939 auto pos = base_idx + idx;
180940 D_ASSERT(pos < this->count);
180941 found_match[pos] = true;
180942 }
180943}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ ConstructLeftJoinResult()

void duckdb::OuterJoinMarker::ConstructLeftJoinResult ( DataChunk & left,
DataChunk & result )

Constructs a left-join result based on which tuples have not found matches.

180945 {
180946 if (!enabled) {
180947 return;
180948 }
180949 D_ASSERT(count == STANDARD_VECTOR_SIZE);
180950 SelectionVector remaining_sel(STANDARD_VECTOR_SIZE);
180951 idx_t remaining_count = 0;
180952 for (idx_t i = 0; i < left.size(); i++) {
180953 if (!found_match[i]) {
180954 remaining_sel.set_index(remaining_count++, i);
180955 }
180956 }
180957 if (remaining_count > 0) {
180958 result.Slice(left, remaining_sel, remaining_count);
180959 for (idx_t idx = left.ColumnCount(); idx < result.ColumnCount(); idx++) {
180960 result.data[idx].SetVectorType(VectorType::CONSTANT_VECTOR);
180961 ConstantVector::SetNull(result.data[idx], true);
180962 }
180963 }
180964}

◆ MaxThreads()

idx_t duckdb::OuterJoinMarker::MaxThreads ( ) const

Returns the maximum number of threads that can be associated with an right-outer join scan.

180966 {
180967 return count / (STANDARD_VECTOR_SIZE * 10ULL);
180968}

◆ InitializeScan() [1/2]

void duckdb::OuterJoinMarker::InitializeScan ( ColumnDataCollection & data,
OuterJoinGlobalScanState & gstate )

Initialize a scan.

180970 {
180971 gstate.data = &data;
180972 data.InitializeScan(gstate.global_scan);
180973}
Here is the call graph for this function:

◆ InitializeScan() [2/2]

void duckdb::OuterJoinMarker::InitializeScan ( OuterJoinGlobalScanState & gstate,
OuterJoinLocalScanState & lstate )

Initialize a local scan.

180975 {
180976 D_ASSERT(gstate.data);
180977 lstate.match_sel.Initialize(STANDARD_VECTOR_SIZE);
180978 gstate.data->InitializeScanChunk(lstate.scan_chunk);
180979}
Here is the call graph for this function:

◆ Scan()

void duckdb::OuterJoinMarker::Scan ( OuterJoinGlobalScanState & gstate,
OuterJoinLocalScanState & lstate,
DataChunk & result )

Perform the scan.

180981 {
180982 D_ASSERT(gstate.data);
180983 // fill in NULL values for the LHS
180984 while (gstate.data->Scan(gstate.global_scan, lstate.local_scan, lstate.scan_chunk)) {
180985 idx_t result_count = 0;
180986 // figure out which tuples didn't find a match in the RHS
180987 for (idx_t i = 0; i < lstate.scan_chunk.size(); i++) {
180988 if (!found_match[lstate.local_scan.current_row_index + i]) {
180989 lstate.match_sel.set_index(result_count++, i);
180990 }
180991 }
180992 if (result_count > 0) {
180993 // if there were any tuples that didn't find a match, output them
180994 idx_t left_column_count = result.ColumnCount() - lstate.scan_chunk.ColumnCount();
180995 for (idx_t i = 0; i < left_column_count; i++) {
180996 result.data[i].SetVectorType(VectorType::CONSTANT_VECTOR);
180997 ConstantVector::SetNull(result.data[i], true);
180998 }
180999 for (idx_t col_idx = left_column_count; col_idx < result.ColumnCount(); col_idx++) {
181000 result.data[col_idx].Slice(lstate.scan_chunk.data[col_idx - left_column_count], lstate.match_sel,
181001 result_count);
181002 }
181003 result.SetCardinality(result_count);
181004 return;
181005 }
181006 }
181007}
Here is the call graph for this function:

◆ GetMatches()

const bool * duckdb::OuterJoinMarker::GetMatches ( ) const
inline

Read-only matches vector.

180891 {
180892 return found_match.get();
180893 }

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