1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/planner/expression/bound_reference_expression.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/planner/expression.hpp"
12
13namespace duckdb {
14
15//! A BoundReferenceExpression represents a physical index into a DataChunk
16class BoundReferenceExpression : public Expression {
17public:
18 static constexpr const ExpressionClass TYPE = ExpressionClass::BOUND_REF;
19
20public:
21 BoundReferenceExpression(string alias, LogicalType type, idx_t index);
22 BoundReferenceExpression(LogicalType type, storage_t index);
23
24 //! Index used to access data in the chunks
25 storage_t index;
26
27public:
28 bool IsScalar() const override {
29 return false;
30 }
31 bool IsFoldable() const override {
32 return false;
33 }
34
35 string ToString() const override;
36
37 hash_t Hash() const override;
38 bool Equals(const BaseExpression &other) const override;
39
40 unique_ptr<Expression> Copy() override;
41
42 void Serialize(FieldWriter &writer) const override;
43 static unique_ptr<Expression> Deserialize(ExpressionDeserializationState &state, FieldReader &reader);
44};
45} // namespace duckdb
46