/
parsed_expression.hpp
67 lines (56 loc) · 2.29 KB
/
parsed_expression.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//===----------------------------------------------------------------------===//
// DuckDB
//
// duckdb/parser/parsed_expression.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "duckdb/parser/base_expression.hpp"
#include "duckdb/common/vector.hpp"
#include "duckdb/common/string_util.hpp"
#include "duckdb/parser/qualified_name.hpp"
#include "duckdb/parser/expression_util.hpp"
namespace duckdb {
class Deserializer;
class Serializer;
//! The ParsedExpression class is a base class that can represent any expression
//! part of a SQL statement.
/*!
The ParsedExpression class is a base class that can represent any expression
part of a SQL statement. This is, for example, a column reference in a SELECT
clause, but also operators, aggregates or filters. The Expression is emitted by the parser and does not contain any
information about bindings to the catalog or to the types. ParsedExpressions are transformed into regular Expressions
in the Binder.
*/
class ParsedExpression : public BaseExpression {
public:
//! Create an Expression
ParsedExpression(ExpressionType type, ExpressionClass expression_class) : BaseExpression(type, expression_class) {
}
public:
bool IsAggregate() const override;
bool IsWindow() const override;
bool HasSubquery() const override;
bool IsScalar() const override;
bool HasParameter() const override;
bool Equals(const BaseExpression &other) const override;
hash_t Hash() const override;
//! Create a copy of this expression
virtual unique_ptr<ParsedExpression> Copy() const = 0;
virtual void Serialize(Serializer &serializer) const;
static unique_ptr<ParsedExpression> Deserialize(Deserializer &deserializer);
static bool Equals(const unique_ptr<ParsedExpression> &left, const unique_ptr<ParsedExpression> &right);
static bool ListEquals(const vector<unique_ptr<ParsedExpression>> &left,
const vector<unique_ptr<ParsedExpression>> &right);
protected:
//! Copy base Expression properties from another expression to this one,
//! used in Copy method
void CopyProperties(const ParsedExpression &other) {
type = other.type;
expression_class = other.expression_class;
alias = other.alias;
query_location = other.query_location;
}
};
} // namespace duckdb