1#include "duckdb/planner/expression/bound_conjunction_expression.hpp"
2#include "duckdb/parser/expression/conjunction_expression.hpp"
3#include "duckdb/parser/expression_util.hpp"
4#include "duckdb/common/field_writer.hpp"
5
6namespace duckdb {
7
8BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type)
9 : Expression(type, ExpressionClass::BOUND_CONJUNCTION, LogicalType::BOOLEAN) {
10}
11
12BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type, unique_ptr<Expression> left,
13 unique_ptr<Expression> right)
14 : BoundConjunctionExpression(type) {
15 children.push_back(x: std::move(left));
16 children.push_back(x: std::move(right));
17}
18
19string BoundConjunctionExpression::ToString() const {
20 return ConjunctionExpression::ToString<BoundConjunctionExpression, Expression>(entry: *this);
21}
22
23bool BoundConjunctionExpression::Equals(const BaseExpression &other_p) const {
24 if (!Expression::Equals(other: other_p)) {
25 return false;
26 }
27 auto &other = other_p.Cast<BoundConjunctionExpression>();
28 return ExpressionUtil::SetEquals(a: children, b: other.children);
29}
30
31bool BoundConjunctionExpression::PropagatesNullValues() const {
32 return false;
33}
34
35unique_ptr<Expression> BoundConjunctionExpression::Copy() {
36 auto copy = make_uniq<BoundConjunctionExpression>(args&: type);
37 for (auto &expr : children) {
38 copy->children.push_back(x: expr->Copy());
39 }
40 copy->CopyProperties(other&: *this);
41 return std::move(copy);
42}
43
44void BoundConjunctionExpression::Serialize(FieldWriter &writer) const {
45 writer.WriteSerializableList(elements: children);
46}
47
48unique_ptr<Expression> BoundConjunctionExpression::Deserialize(ExpressionDeserializationState &state,
49 FieldReader &reader) {
50 auto children = reader.ReadRequiredSerializableList<Expression>(args&: state.gstate);
51 auto res = make_uniq<BoundConjunctionExpression>(args&: state.type);
52 res->children = std::move(children);
53 return std::move(res);
54}
55
56} // namespace duckdb
57