1 | #include "duckdb/main/relation/distinct_relation.hpp" |
---|---|
2 | #include "duckdb/main/client_context.hpp" |
3 | #include "duckdb/parser/query_node.hpp" |
4 | |
5 | namespace duckdb { |
6 | |
7 | DistinctRelation::DistinctRelation(shared_ptr<Relation> child_p) |
8 | : Relation(child_p->context, RelationType::DISTINCT_RELATION), child(move(child_p)) { |
9 | vector<ColumnDefinition> dummy_columns; |
10 | context.TryBindRelation(*this, dummy_columns); |
11 | } |
12 | |
13 | unique_ptr<QueryNode> DistinctRelation::GetQueryNode() { |
14 | auto child_node = child->GetQueryNode(); |
15 | child_node->modifiers.push_back(make_unique<DistinctModifier>()); |
16 | return child_node; |
17 | } |
18 | |
19 | string DistinctRelation::GetAlias() { |
20 | return child->GetAlias(); |
21 | } |
22 | |
23 | const vector<ColumnDefinition> &DistinctRelation::Columns() { |
24 | return child->Columns(); |
25 | } |
26 | |
27 | string DistinctRelation::ToString(idx_t depth) { |
28 | string str = RenderWhitespace(depth) + "Distinct\n"; |
29 | return str + child->ToString(depth + 1); |
30 | ; |
31 | } |
32 | |
33 | } // namespace duckdb |
34 |