| 1 | #include "duckdb/parser/expression/bound_expression.hpp" |
|---|---|
| 2 | |
| 3 | namespace duckdb { |
| 4 | |
| 5 | BoundExpression::BoundExpression(unique_ptr<Expression> expr_p) |
| 6 | : ParsedExpression(ExpressionType::INVALID, ExpressionClass::BOUND_EXPRESSION), expr(std::move(expr_p)) { |
| 7 | this->alias = expr->alias; |
| 8 | } |
| 9 | |
| 10 | unique_ptr<Expression> &BoundExpression::GetExpression(ParsedExpression &expr) { |
| 11 | auto &bound_expr = expr.Cast<BoundExpression>(); |
| 12 | if (!bound_expr.expr) { |
| 13 | throw InternalException("BoundExpression::GetExpression called on empty bound expression"); |
| 14 | } |
| 15 | return bound_expr.expr; |
| 16 | } |
| 17 | |
| 18 | string BoundExpression::ToString() const { |
| 19 | if (!expr) { |
| 20 | throw InternalException("ToString(): BoundExpression does not have a child"); |
| 21 | } |
| 22 | return expr->ToString(); |
| 23 | } |
| 24 | |
| 25 | bool BoundExpression::Equals(const BaseExpression &other) const { |
| 26 | return false; |
| 27 | } |
| 28 | hash_t BoundExpression::Hash() const { |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | unique_ptr<ParsedExpression> BoundExpression::Copy() const { |
| 33 | throw SerializationException("Cannot copy or serialize bound expression"); |
| 34 | } |
| 35 | |
| 36 | void BoundExpression::Serialize(FieldWriter &writer) const { |
| 37 | throw SerializationException("Cannot copy or serialize bound expression"); |
| 38 | } |
| 39 | |
| 40 | void BoundExpression::FormatSerialize(FormatSerializer &serializer) const { |
| 41 | throw SerializationException("Cannot copy or serialize bound expression"); |
| 42 | } |
| 43 | |
| 44 | } // namespace duckdb |
| 45 |