taco-db  0.1.0
Public Member Functions | Protected Member Functions | List of all members
taco::PlanNode Class Referenceabstract

PlanNode is an abstract interface representing physical query plan that does not bound with any particular execution state. More...

#include <plan/PlanNode.h>

Inheritance diagram for taco::PlanNode:
taco::TreeNode taco::Aggregation taco::CartesianProduct taco::IndexScan taco::Limit taco::Projection taco::Selection taco::Sort taco::TableDelete taco::TableInsert taco::TableScan taco::TempTable

Public Member Functions

template<class ... UniquePtrs>
 PlanNode (NodeTag tag, UniquePtrs &&...input)
 Base constructor for all physical plan node. More...
 
virtual ~PlanNode ()
 Deconstructor of PlanExecState. More...
 
virtual std::unique_ptr< PlanExecStatecreate_exec_state () const =0
 Create the corresponding execution state for the physical plan so that it can be used as physical scan operator later. More...
 
virtual const Schemaget_output_schema () const =0
 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::TreeNode
template<class ... UniquePtrs>
 TreeNode (NodeTag tag, UniquePtrs &&...input)
 
virtual ~TreeNode ()
 
 TreeNode (TreeNode &&)=default
 
TreeNodeoperator= (TreeNode &&)=default
 
 TreeNode (const TreeNode &)=delete
 
TreeNodeoperator= (const TreeNode &)=delete
 
constexpr NodeTag get_tag () const
 
TreeNodeget_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
 
virtual void node_properties_to_string (std::string &buf, int indent) const =0
 

Protected Member Functions

PlanNodeget_child (size_t i) const
 Utility function to get the raw pointer of i-th child of this physical plan. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from taco::TreeNode
static void append_indent (std::string &buf, int indent)
 

Detailed Description

PlanNode is an abstract interface representing physical query plan that does not bound with any particular execution state.

More than one PlanExecState can be generated from the same physical plan, allowing multiple users executing the same plan at different stage concurrently. An instance of PlanNode should contain all information related to the plan itself (e.g. selection condition, projection attributes, etc) but not how far the users have retrieve its output record.

Constructor & Destructor Documentation

◆ PlanNode()

template<class ... UniquePtrs>
taco::PlanNode::PlanNode ( NodeTag  tag,
UniquePtrs &&...  input 
)
inline

Base constructor for all physical plan node.

It is marked with a node tag (see include/utils/tree/node_Tags.inc for more details) and unique pointers to all of its children execution states. The unique pointers to its children will be moved to TreeNode internal states after the construction so you don't have to remember it separately.

Note: You can use TAG(ClassName) to get the corresponding tag for a plan execution state. For example, TAG(Selection) will give you the tag of Selection.

◆ ~PlanNode()

virtual taco::PlanNode::~PlanNode ( )
inlinevirtual

Deconstructor of PlanExecState.

Member Function Documentation

◆ create_exec_state()

virtual std::unique_ptr<PlanExecState> taco::PlanNode::create_exec_state ( ) const
pure virtual

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.

Implemented in taco::TempTable, taco::TableScan, taco::TableInsert, taco::TableDelete, taco::Sort, taco::Selection, taco::Projection, taco::Limit, taco::IndexScan, taco::CartesianProduct, and taco::Aggregation.

◆ get_child()

PlanNode* taco::PlanNode::get_child ( size_t  i) const
inlineprotected

Utility function to get the raw pointer of i-th child of this physical plan.

◆ get_output_schema()

virtual const Schema* taco::PlanNode::get_output_schema ( ) const
pure virtual

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.

Implemented in taco::TempTable, taco::TableScan, taco::TableInsert, taco::TableDelete, taco::Sort, taco::Selection, taco::Projection, taco::Limit, taco::IndexScan, taco::CartesianProduct, and taco::Aggregation.


The documentation for this class was generated from the following file: