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

Static Public Member Functions

static bool ListEquals (const vector< unique_ptr< ParsedExpression > > &a, const vector< unique_ptr< ParsedExpression > > &b)
 ListEquals: check if a list of two expressions is equal (order is important).
static bool ListEquals (const vector< unique_ptr< Expression > > &a, const vector< unique_ptr< Expression > > &b)
static bool SetEquals (const vector< unique_ptr< ParsedExpression > > &a, const vector< unique_ptr< ParsedExpression > > &b)
 SetEquals: check if two sets of expressions are equal (order is not important).
static bool SetEquals (const vector< unique_ptr< Expression > > &a, const vector< unique_ptr< Expression > > &b)

Static Private Member Functions

template<class T>
static bool ExpressionListEquals (const vector< unique_ptr< T > > &a, const vector< unique_ptr< T > > &b)
template<class T, class EXPRESSION_MAP>
static bool ExpressionSetEquals (const vector< unique_ptr< T > > &a, const vector< unique_ptr< T > > &b)

Member Function Documentation

◆ ListEquals() [1/2]

bool duckdb::ExpressionUtil::ListEquals ( const vector< unique_ptr< ParsedExpression > > & a,
const vector< unique_ptr< ParsedExpression > > & b )
static

ListEquals: check if a list of two expressions is equal (order is important).

337971 {
337972 return ExpressionListEquals<ParsedExpression>(a, b);
337973}
Here is the caller graph for this function:

◆ ListEquals() [2/2]

bool duckdb::ExpressionUtil::ListEquals ( const vector< unique_ptr< Expression > > & a,
const vector< unique_ptr< Expression > > & b )
static
337975 {
337976 return ExpressionListEquals<Expression>(a, b);
337977}

◆ SetEquals() [1/2]

bool duckdb::ExpressionUtil::SetEquals ( const vector< unique_ptr< ParsedExpression > > & a,
const vector< unique_ptr< ParsedExpression > > & b )
static

SetEquals: check if two sets of expressions are equal (order is not important).

337980 {
337981 return ExpressionSetEquals<ParsedExpression, parsed_expression_map_t<idx_t>>(a, b);
337982}
Here is the caller graph for this function:

◆ SetEquals() [2/2]

bool duckdb::ExpressionUtil::SetEquals ( const vector< unique_ptr< Expression > > & a,
const vector< unique_ptr< Expression > > & b )
static
337984 {
337985 return ExpressionSetEquals<Expression, expression_map_t<idx_t>>(a, b);
337986}

◆ ExpressionListEquals()

template<class T>
bool duckdb::ExpressionUtil::ExpressionListEquals ( const vector< unique_ptr< T > > & a,
const vector< unique_ptr< T > > & b )
staticprivate
337925 {
337926 if (a.size() != b.size()) {
337927 return false;
337928 }
337929 for (idx_t i = 0; i < a.size(); i++) {
337930 if (!(*a[i] == *b[i])) {
337931 return false;
337932 }
337933 }
337934 return true;
337935}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ ExpressionSetEquals()

template<class T, class EXPRESSION_MAP>
bool duckdb::ExpressionUtil::ExpressionSetEquals ( const vector< unique_ptr< T > > & a,
const vector< unique_ptr< T > > & b )
staticprivate
337938 {
337939 if (a.size() != b.size()) {
337940 return false;
337941 }
337942 // we create a map of expression -> count for the left side
337943 // we keep the count because the same expression can occur multiple times (e.g. "1 AND 1" is legal)
337944 // in this case we track the following value: map["Constant(1)"] = 2
337945 EXPRESSION_MAP map;
337946 for (idx_t i = 0; i < a.size(); i++) {
337947 map[*a[i]]++;
337948 }
337949 // now on the right side we reduce the counts again
337950 // if the conjunctions are identical, all the counts will be 0 after the
337951 for (auto &expr : b) {
337952 auto entry = map.find(*expr);
337953 // first we check if we can find the expression in the map at all
337954 if (entry == map.end()) {
337955 return false;
337956 }
337957 // if we found it we check the count; if the count is already 0 we return false
337958 // this happens if e.g. the left side contains "1 AND X", and the right side contains "1 AND 1"
337959 // "1" is contained in the map, however, the right side contains the expression twice
337960 // hence we know the children are not identical in this case because the LHS and RHS have a different count for
337961 // the Constant(1) expression
337962 if (entry->second == 0) {
337963 return false;
337964 }
337965 entry->second--;
337966 }
337967 return true;
337968}

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