1#include "duckdb/parser/expression/conjunction_expression.hpp"
2#include "duckdb/planner/expression/bound_cast_expression.hpp"
3#include "duckdb/planner/expression/bound_conjunction_expression.hpp"
4#include "duckdb/planner/expression_binder.hpp"
5
6namespace duckdb {
7
8BindResult ExpressionBinder::BindExpression(ConjunctionExpression &expr, idx_t depth) {
9 // first try to bind the children of the case expression
10 string error;
11 for (idx_t i = 0; i < expr.children.size(); i++) {
12 BindChild(expr&: expr.children[i], depth, error);
13 }
14 if (!error.empty()) {
15 return BindResult(error);
16 }
17 // the children have been successfully resolved
18 // cast the input types to boolean (if necessary)
19 // and construct the bound conjunction expression
20 auto result = make_uniq<BoundConjunctionExpression>(args&: expr.type);
21 for (auto &child_expr : expr.children) {
22 auto &child = BoundExpression::GetExpression(expr&: *child_expr);
23 result->children.push_back(x: BoundCastExpression::AddCastToType(context, expr: std::move(child), target_type: LogicalType::BOOLEAN));
24 }
25 // now create the bound conjunction expression
26 return BindResult(std::move(result));
27}
28
29} // namespace duckdb
30