| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/parser/expression/bound_expression.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/exception.hpp" |
| 12 | #include "duckdb/common/field_writer.hpp" |
| 13 | #include "duckdb/parser/parsed_expression.hpp" |
| 14 | #include "duckdb/planner/expression.hpp" |
| 15 | |
| 16 | namespace duckdb { |
| 17 | |
| 18 | //! BoundExpression is an intermediate dummy class used by the binder. It is a ParsedExpression but holds an Expression. |
| 19 | //! It represents a successfully bound expression. It is used in the Binder to prevent re-binding of already bound parts |
| 20 | //! when dealing with subqueries. |
| 21 | class BoundExpression : public ParsedExpression { |
| 22 | public: |
| 23 | static constexpr const ExpressionClass TYPE = ExpressionClass::BOUND_EXPRESSION; |
| 24 | |
| 25 | public: |
| 26 | BoundExpression(unique_ptr<Expression> expr); |
| 27 | |
| 28 | unique_ptr<Expression> expr; |
| 29 | |
| 30 | public: |
| 31 | static unique_ptr<Expression> &GetExpression(ParsedExpression &expr); |
| 32 | |
| 33 | string ToString() const override; |
| 34 | |
| 35 | bool Equals(const BaseExpression &other) const override; |
| 36 | hash_t Hash() const override; |
| 37 | |
| 38 | unique_ptr<ParsedExpression> Copy() const override; |
| 39 | |
| 40 | void Serialize(FieldWriter &writer) const override; |
| 41 | |
| 42 | void FormatSerialize(FormatSerializer &serializer) const override; |
| 43 | }; |
| 44 | |
| 45 | } // namespace duckdb |
| 46 |