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
14namespace duckdb {
15
16//! ConstantExpression represents a constant value in the query
17class ConstantExpression : public ParsedExpression {
18public:
19 static constexpr const ExpressionClass TYPE = ExpressionClass::CONSTANT;
20
21public:
22 DUCKDB_API explicit ConstantExpression(Value val);
23
24 //! The constant value referenced
25 Value value;
26
27public:
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