taco-db
0.1.0
|
Aggregation
is the physical plan for aggregations.
More...
#include <plan/Aggregation.h>
Public Member Functions | |
~Aggregation () override | |
void | node_properties_to_string (std::string &buf, int indent) const override |
std::unique_ptr< PlanExecState > | create_exec_state () const override |
Create the corresponding execution state for the physical plan so that it can be used as physical scan operator later. More... | |
const Schema * | get_output_schema () const override |
Each physical plan should link a schema for its output relation, incidating what fields are included in its output records. More... | |
Public Member Functions inherited from taco::PlanNode | |
template<class ... UniquePtrs> | |
PlanNode (NodeTag tag, UniquePtrs &&...input) | |
Base constructor for all physical plan node. More... | |
virtual | ~PlanNode () |
Deconstructor of PlanExecState. More... | |
Public Member Functions inherited from taco::TreeNode | |
template<class ... UniquePtrs> | |
TreeNode (NodeTag tag, UniquePtrs &&...input) | |
virtual | ~TreeNode () |
TreeNode (TreeNode &&)=default | |
TreeNode & | operator= (TreeNode &&)=default |
TreeNode (const TreeNode &)=delete | |
TreeNode & | operator= (const TreeNode &)=delete |
constexpr NodeTag | get_tag () const |
TreeNode * | get_input (size_t i) const |
template<class Node > | |
Node * | get_input_as (size_t i) const |
std::string | to_string () const |
void | node_to_string (std::string &buf, int indent) const |
Prints the node contents to a string buffer. More... | |
const char * | node_name () const |
Static Public Member Functions | |
static std::unique_ptr< Aggregation > | Create (std::unique_ptr< PlanNode > &&child, std::vector< std::unique_ptr< ExprNode >> &&exprs, const std::vector< AggType > &aggtyps) |
Static Public Member Functions inherited from taco::TreeNode | |
static void | append_indent (std::string &buf, int indent) |
Private Member Functions | |
Aggregation (std::unique_ptr< PlanNode > &&child, std::vector< std::unique_ptr< ExprNode >> &&exprs, const std::vector< AggType > &aggtyps) | |
Friends | |
class | AggregationState |
Additional Inherited Members | |
Protected Member Functions inherited from taco::PlanNode | |
PlanNode * | get_child (size_t i) const |
Utility function to get the raw pointer of i-th child of this physical plan. More... | |
Aggregation
is the physical plan for aggregations.
This physical plan should remember its child plan, aggregation types, and a set of expressions conducted on input columns from its child. By the end of construction, it should also look up and remember corresponding aggregation functions for further execution.
You should use g_catcache->FindAggregationByTidAndOprType
to locate the aggregation id given the type of the aggregation (see include/catalog/aggtyp.h), and the type of operand (i.e., the aggregated expression). Then you can leverage g_catcache->FindAggregation(aggregation_id)
to get the construct containing function IDs for initialize, accumulate and finalize function of a particular aggregation operator defined by apptyp
.
Later on, to use these aggregate functions during execution, you can simply look up function IDs through FindBuiltinFuction()
to get the raw function pointer and call the function through FunctionCall()
.
The output schema of aggregation should be based on the aggregation output of all aggregating expressions. It can be derived from the return types of aggregation expressions.
|
override |
|
private |
|
static |
|
overridevirtual |
Create the corresponding execution state for the physical plan so that it can be used as physical scan operator later.
This should create an execution state matching the current physical plan, all its descendant execution states, and link them together.
Implements taco::PlanNode.
|
overridevirtual |
Each physical plan should link a schema for its output relation, incidating what fields are included in its output records.
This function returns the output schema of this physical plan.
NOTE: if you want to create a schema owned by the plan, you should make sure ComputeLayout()
is called upon the newly created plan so that it can be used in serialize/deserialize records.
Implements taco::PlanNode.
|
overridevirtual |
Implements taco::TreeNode.
|
friend |