1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/parser/expression_util.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/parser/base_expression.hpp" |
12 | #include "duckdb/common/vector.hpp" |
13 | |
14 | namespace duckdb { |
15 | class ParsedExpression; |
16 | class Expression; |
17 | |
18 | class ExpressionUtil { |
19 | public: |
20 | //! ListEquals: check if a list of two expressions is equal (order is important) |
21 | static bool ListEquals(const vector<unique_ptr<ParsedExpression>> &a, |
22 | const vector<unique_ptr<ParsedExpression>> &b); |
23 | static bool ListEquals(const vector<unique_ptr<Expression>> &a, const vector<unique_ptr<Expression>> &b); |
24 | //! SetEquals: check if two sets of expressions are equal (order is not important) |
25 | static bool SetEquals(const vector<unique_ptr<ParsedExpression>> &a, const vector<unique_ptr<ParsedExpression>> &b); |
26 | static bool SetEquals(const vector<unique_ptr<Expression>> &a, const vector<unique_ptr<Expression>> &b); |
27 | |
28 | private: |
29 | template <class T> |
30 | static bool ExpressionListEquals(const vector<unique_ptr<T>> &a, const vector<unique_ptr<T>> &b); |
31 | template <class T, class EXPRESSION_MAP> |
32 | static bool ExpressionSetEquals(const vector<unique_ptr<T>> &a, const vector<unique_ptr<T>> &b); |
33 | }; |
34 | |
35 | } // namespace duckdb |
36 |