1#include "duckdb/planner/expression/bound_constant_expression.hpp"
2
3#include "duckdb/common/types/hash.hpp"
4#include "duckdb/common/value_operations/value_operations.hpp"
5
6using namespace duckdb;
7using namespace std;
8
9BoundConstantExpression::BoundConstantExpression(Value value)
10 : Expression(ExpressionType::VALUE_CONSTANT, ExpressionClass::BOUND_CONSTANT, value.type), value(value) {
11}
12
13string BoundConstantExpression::ToString() const {
14 return value.ToString();
15}
16
17bool BoundConstantExpression::Equals(const BaseExpression *other_) const {
18 if (!BaseExpression::Equals(other_)) {
19 return false;
20 }
21 auto other = (BoundConstantExpression *)other_;
22 return value == other->value;
23}
24
25hash_t BoundConstantExpression::Hash() const {
26 hash_t result = Expression::Hash();
27 return CombineHash(ValueOperations::Hash(value), result);
28}
29
30unique_ptr<Expression> BoundConstantExpression::Copy() {
31 auto copy = make_unique<BoundConstantExpression>(value);
32 copy->CopyProperties(*this);
33 return move(copy);
34}
35