1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/parser/expression/constant_expression.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/common/types/value.hpp" |
12 | #include "duckdb/parser/parsed_expression.hpp" |
13 | |
14 | namespace duckdb { |
15 | |
16 | //! ConstantExpression represents a constant value in the query |
17 | class ConstantExpression : public ParsedExpression { |
18 | public: |
19 | static constexpr const ExpressionClass TYPE = ExpressionClass::CONSTANT; |
20 | |
21 | public: |
22 | DUCKDB_API explicit ConstantExpression(Value val); |
23 | |
24 | //! The constant value referenced |
25 | Value value; |
26 | |
27 | public: |
28 | string ToString() const override; |
29 | |
30 | static bool Equal(const ConstantExpression &a, const ConstantExpression &b); |
31 | hash_t Hash() const override; |
32 | |
33 | unique_ptr<ParsedExpression> Copy() const override; |
34 | |
35 | void Serialize(FieldWriter &writer) const override; |
36 | static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source); |
37 | |
38 | void FormatSerialize(FormatSerializer &serializer) const override; |
39 | static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer); |
40 | }; |
41 | |
42 | } // namespace duckdb |
43 |