1 | #include "duckdb/planner/expression/bound_comparison_expression.hpp" |
2 | |
3 | using namespace duckdb; |
4 | using namespace std; |
5 | |
6 | BoundComparisonExpression::BoundComparisonExpression(ExpressionType type, unique_ptr<Expression> left, |
7 | unique_ptr<Expression> right) |
8 | : Expression(type, ExpressionClass::BOUND_COMPARISON, TypeId::BOOL), left(move(left)), right(move(right)) { |
9 | } |
10 | |
11 | string BoundComparisonExpression::ToString() const { |
12 | return left->GetName() + ExpressionTypeToOperator(type) + right->GetName(); |
13 | } |
14 | |
15 | bool BoundComparisonExpression::Equals(const BaseExpression *other_) const { |
16 | if (!BaseExpression::Equals(other_)) { |
17 | return false; |
18 | } |
19 | auto other = (BoundComparisonExpression *)other_; |
20 | if (!Expression::Equals(left.get(), other->left.get())) { |
21 | return false; |
22 | } |
23 | if (!Expression::Equals(right.get(), other->right.get())) { |
24 | return false; |
25 | } |
26 | return true; |
27 | } |
28 | |
29 | unique_ptr<Expression> BoundComparisonExpression::Copy() { |
30 | auto copy = make_unique<BoundComparisonExpression>(type, left->Copy(), right->Copy()); |
31 | copy->CopyProperties(*this); |
32 | return move(copy); |
33 | } |
34 | |