1#include "duckdb/planner/expression/bound_unnest_expression.hpp"
2
3#include "duckdb/common/types/hash.hpp"
4#include "duckdb/common/string_util.hpp"
5
6using namespace duckdb;
7using namespace std;
8
9BoundUnnestExpression::BoundUnnestExpression(SQLType sql_return_type)
10 : Expression(ExpressionType::BOUND_UNNEST, ExpressionClass::BOUND_UNNEST, GetInternalType(sql_return_type)),
11 sql_return_type(sql_return_type) {
12}
13
14bool BoundUnnestExpression::IsFoldable() const {
15 return false;
16}
17
18string BoundUnnestExpression::ToString() const {
19 return "UNNEST(" + child->ToString() + ")";
20}
21
22hash_t BoundUnnestExpression::Hash() const {
23 hash_t result = Expression::Hash();
24 return CombineHash(result, duckdb::Hash("unnest"));
25}
26
27bool BoundUnnestExpression::Equals(const BaseExpression *other_) const {
28 if (!BaseExpression::Equals(other_)) {
29 return false;
30 }
31 auto other = (BoundUnnestExpression *)other_;
32 if (!Expression::Equals(child.get(), other->child.get())) {
33 return false;
34 }
35 return true;
36}
37
38unique_ptr<Expression> BoundUnnestExpression::Copy() {
39 auto copy = make_unique<BoundUnnestExpression>(sql_return_type);
40 copy->child = child->Copy();
41 return move(copy);
42}
43