//===----------------------------------------------------------------------===// // DuckDB // // duckdb/planner/expression/bound_columnref_expression.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/planner/column_binding.hpp" #include "duckdb/planner/expression.hpp" namespace duckdb { class FieldReader; class FieldWriter; //! A BoundColumnRef expression represents a ColumnRef expression that was bound to an actual table and column index. It //! is not yet executable, however. The ColumnBindingResolver transforms the BoundColumnRefExpressions into //! BoundExpressions, which refer to indexes into the physical chunks that pass through the executor. class BoundColumnRefExpression : public Expression { public: static constexpr const ExpressionClass TYPE = ExpressionClass::BOUND_COLUMN_REF; public: BoundColumnRefExpression(LogicalType type, ColumnBinding binding, idx_t depth = 0); BoundColumnRefExpression(string alias, LogicalType type, ColumnBinding binding, idx_t depth = 0); //! Column index set by the binder, used to generate the final BoundExpression ColumnBinding binding; //! The subquery depth (i.e. depth 0 = current query, depth 1 = parent query, depth 2 = parent of parent, etc...). //! This is only non-zero for correlated expressions inside subqueries. idx_t depth; public: bool IsScalar() const override { return false; } bool IsFoldable() const override { return false; } string ToString() const override; string GetName() const override; bool Equals(const BaseExpression &other) const override; hash_t Hash() const override; unique_ptr Copy() override; void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionDeserializationState &state, FieldReader &reader); }; } // namespace duckdb