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::JoinRelationSetManager Class Reference

#include <duckdb.hpp>

Collaboration diagram for duckdb::JoinRelationSetManager:

Classes

struct  JoinRelationTreeNode
 Contains a node with a JoinRelationSet and child relations. More...

Public Member Functions

JoinRelationSet & GetJoinRelation (idx_t index)
 Create or get a JoinRelationSet from a single node with the given index.
JoinRelationSet & GetJoinRelation (const unordered_set< idx_t > &bindings)
 Create or get a JoinRelationSet from a set of relation bindings.
JoinRelationSet & GetJoinRelation (unsafe_unique_array< idx_t > relations, idx_t count)
 Create or get a JoinRelationSet from a (sorted, duplicate-free!) list of relations.
JoinRelationSet & Union (JoinRelationSet &left, JoinRelationSet &right)
 Union two sets of relations together and create a new relation set.
string ToString () const
void Print ()

Private Attributes

JoinRelationTreeNode root

Detailed Description

The JoinRelationTree is a structure holding all the created JoinRelationSet objects and allowing fast lookup on to them

Member Function Documentation

◆ GetJoinRelation() [1/3]

JoinRelationSet & duckdb::JoinRelationSetManager::GetJoinRelation ( idx_t index)

Create or get a JoinRelationSet from a single node with the given index.

312109 {
312110 // create a sorted vector of the relations
312111 auto relations = make_unsafe_uniq_array<idx_t>(1);
312112 relations[0] = index;
312113 idx_t count = 1;
312114 return GetJoinRelation(std::move(relations), count);
312115}
JoinRelationSet & GetJoinRelation(idx_t index)
Create or get a JoinRelationSet from a single node with the given index.
Definition duckdb.cpp:312109
index
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetJoinRelation() [2/3]

JoinRelationSet & duckdb::JoinRelationSetManager::GetJoinRelation ( const unordered_set< idx_t > & bindings)

Create or get a JoinRelationSet from a set of relation bindings.

312117 {
312118 // create a sorted vector of the relations
312119 unsafe_unique_array<idx_t> relations = bindings.empty() ? nullptr : make_unsafe_uniq_array<idx_t>(bindings.size());
312120 idx_t count = 0;
312121 for (auto &entry : bindings) {
312122 relations[count++] = entry;
312123 }
312124 std::sort(relations.get(), relations.get() + count);
312125 return GetJoinRelation(std::move(relations), count);
312126}
Here is the call graph for this function:

◆ GetJoinRelation() [3/3]

JoinRelationSet & duckdb::JoinRelationSetManager::GetJoinRelation ( unsafe_unique_array< idx_t > relations,
idx_t count )

Create or get a JoinRelationSet from a (sorted, duplicate-free!) list of relations.

312087 {
312088 // now look it up in the tree
312089 reference<JoinRelationTreeNode> info(root);
312090 for (idx_t i = 0; i < count; i++) {
312091 auto entry = info.get().children.find(relations[i]);
312092 if (entry == info.get().children.end()) {
312093 // node not found, create it
312094 auto insert_it = info.get().children.insert(make_pair(relations[i], make_uniq<JoinRelationTreeNode>()));
312095 entry = insert_it.first;
312096 }
312097 // move to the next node
312098 info = *entry->second;
312099 }
312100 // now check if the JoinRelationSet has already been created
312101 if (!info.get().relation) {
312102 // if it hasn't we need to create it
312103 info.get().relation = make_uniq<JoinRelationSet>(std::move(relations), count);
312104 }
312105 return *info.get().relation;
312106}

◆ Union()

JoinRelationSet & duckdb::JoinRelationSetManager::Union ( JoinRelationSet & left,
JoinRelationSet & right )

Union two sets of relations together and create a new relation set.

312128 {
312129 auto relations = make_unsafe_uniq_array<idx_t>(left.count + right.count);
312130 idx_t count = 0;
312131 // move through the left and right relations, eliminating duplicates
312132 idx_t i = 0, j = 0;
312133 while (true) {
312134 if (i == left.count) {
312135 // exhausted left relation, add remaining of right relation
312136 for (; j < right.count; j++) {
312137 relations[count++] = right.relations[j];
312138 }
312139 break;
312140 } else if (j == right.count) {
312141 // exhausted right relation, add remaining of left
312142 for (; i < left.count; i++) {
312143 relations[count++] = left.relations[i];
312144 }
312145 break;
312146 } else if (left.relations[i] < right.relations[j]) {
312147 // left is smaller, progress left and add it to the set
312148 relations[count++] = left.relations[i];
312149 i++;
312150 } else if (left.relations[i] > right.relations[j]) {
312151 // right is smaller, progress right and add it to the set
312152 relations[count++] = right.relations[j];
312153 j++;
312154 } else {
312155 D_ASSERT(left.relations[i] == right.relations[j]);
312156 relations[count++] = left.relations[i];
312157 i++;
312158 j++;
312159 }
312160 }
312161 return GetJoinRelation(std::move(relations), count);
312162}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToString()

string duckdb::JoinRelationSetManager::ToString ( ) const
312206 {
312207 return JoinRelationTreeNodeToString(&root);
312208}

◆ Print()

void duckdb::JoinRelationSetManager::Print ( )
312210 {
312211 Printer::Print(ToString());
312212}
static DUCKDB_API void Print(OutputStream stream, const string &str)
Print the object to the stream.
Definition duckdb.cpp:92556

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