-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
select_node.hpp
62 lines (54 loc) · 2.02 KB
/
select_node.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
//===----------------------------------------------------------------------===//
// DuckDB
//
// duckdb/parser/query_node/select_node.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "duckdb/parser/parsed_expression.hpp"
#include "duckdb/parser/query_node.hpp"
#include "duckdb/parser/sql_statement.hpp"
#include "duckdb/parser/tableref.hpp"
#include "duckdb/parser/parsed_data/sample_options.hpp"
#include "duckdb/parser/group_by_node.hpp"
namespace duckdb {
enum class AggregateHandling : uint8_t {
STANDARD_HANDLING, // standard handling as in the SELECT clause
NO_AGGREGATES_ALLOWED, // no aggregates allowed: any aggregates in this node will result in an error
FORCE_AGGREGATES // force aggregates: any non-aggregate select list entry will become a GROUP
};
//! SelectNode represents a standard SELECT statement
class SelectNode : public QueryNode {
public:
SelectNode() : QueryNode(QueryNodeType::SELECT_NODE), aggregate_handling(AggregateHandling::STANDARD_HANDLING) {
}
//! The projection list
vector<unique_ptr<ParsedExpression>> select_list;
//! The FROM clause
unique_ptr<TableRef> from_table;
//! The WHERE clause
unique_ptr<ParsedExpression> where_clause;
//! list of groups
GroupByNode groups;
//! HAVING clause
unique_ptr<ParsedExpression> having;
//! QUALIFY clause
unique_ptr<ParsedExpression> qualify;
//! Aggregate handling during binding
AggregateHandling aggregate_handling;
//! The SAMPLE clause
unique_ptr<SampleOptions> sample;
const vector<unique_ptr<ParsedExpression>> &GetSelectList() const override {
return select_list;
}
public:
bool Equals(const QueryNode *other) const override;
//! Create a copy of this SelectNode
unique_ptr<QueryNode> Copy() override;
//! Serializes a SelectNode to a stand-alone binary blob
void Serialize(Serializer &serializer) override;
//! Deserializes a blob back into a SelectNode
static unique_ptr<QueryNode> Deserialize(Deserializer &source);
};
} // namespace duckdb