1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/planner/tableref/bound_pivotref.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/planner/binder.hpp"
12#include "duckdb/planner/bound_tableref.hpp"
13#include "duckdb/planner/expression.hpp"
14#include "duckdb/parser/tableref/pivotref.hpp"
15#include "duckdb/function/aggregate_function.hpp"
16
17namespace duckdb {
18
19struct BoundPivotInfo {
20 //! The number of group columns
21 idx_t group_count;
22 //! The set of types
23 vector<LogicalType> types;
24 //! The set of values to pivot on
25 vector<string> pivot_values;
26 //! The set of aggregate functions that is being executed
27 vector<unique_ptr<Expression>> aggregates;
28};
29
30class BoundPivotRef : public BoundTableRef {
31public:
32 static constexpr const TableReferenceType TYPE = TableReferenceType::PIVOT;
33
34public:
35 explicit BoundPivotRef() : BoundTableRef(TableReferenceType::PIVOT) {
36 }
37
38 idx_t bind_index;
39 //! The binder used to bind the child of the pivot
40 shared_ptr<Binder> child_binder;
41 //! The child node of the pivot
42 unique_ptr<BoundTableRef> child;
43 //! The bound pivot info
44 BoundPivotInfo bound_pivot;
45};
46} // namespace duckdb
47