A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pdb::SimplePhysicalNode Class Reference

#include <SimplePhysicalNode.h>

+ Inheritance diagram for pdb::SimplePhysicalNode:
+ Collaboration diagram for pdb::SimplePhysicalNode:

Public Member Functions

 SimplePhysicalNode (string jobId, AtomicComputationPtr node, const Handle< ComputePlan > &computePlan, LogicalPlanPtr logicalPlan, ConfigurationPtr conf)
 
PhysicalOptimizerResultPtr analyze (const StatisticsPtr &stats, int nextStageID) override
 
PhysicalOptimizerResultPtr analyze (TupleSetJobStageBuilderPtr &shared_ptr, SimplePhysicalNodePtr &prevNode, const StatisticsPtr &stats, int nextStageID)
 
const AtomicComputationPtrgetNode () const
 
void addConsumer (const AbstractPhysicalNodePtr &consumer) override
 
bool hasConsumers () override
 
bool isConsuming (Handle< SetIdentifier > &set) override
 
double getCost (const StatisticsPtr &stats) override
 
SimplePhysicalNodePtr getSimpleNodeHandle ()
 
- Public Member Functions inherited from pdb::AbstractPhysicalNode
 AbstractPhysicalNode (string &jobId, const Handle< ComputePlan > &computePlan, LogicalPlanPtr &logicalPlan, ConfigurationPtr &conf)
 
AbstractPhysicalNodePtr getHandle ()
 
virtual void removeConsumer (const AbstractPhysicalNodePtr &consumer)
 
AbstractPhysicalNodePtr getConsumer (int idx)
 
size_t getNumConsumers ()
 
AbstractPhysicalNodePtr getProducer (int idx)
 
size_t getNumProducers ()
 
template<typename T >
std::shared_ptr< T > to ()
 

Protected Member Functions

virtual PhysicalOptimizerResultPtr analyzeSingleConsumer (TupleSetJobStageBuilderPtr &tupleStageBuilder, SimplePhysicalNodePtr &prevNode, const StatisticsPtr &stats, int nextStageID)
 
virtual PhysicalOptimizerResultPtr analyzeOutput (TupleSetJobStageBuilderPtr &tupleStageBuilder, SimplePhysicalNodePtr &prevNode, const StatisticsPtr &stats, int nextStageID)
 
virtual PhysicalOptimizerResultPtr analyzeMultipleConsumers (TupleSetJobStageBuilderPtr &ptr, SimplePhysicalNodePtr &prevNode, const StatisticsPtr &stats, int nextStageID)
 
std::string getNodeIdentifier () override
 
double getCost (Handle< SetIdentifier > source, const StatisticsPtr &stats)
 
const Handle< SetIdentifier > & getSourceSetIdentifier () const
 
- Protected Member Functions inherited from pdb::AbstractPhysicalNode
Handle< SetIdentifiergetSetIdentifierFromComputation (Handle< Computation > computation)
 

Protected Attributes

std::list< SimplePhysicalNodePtractiveConsumers
 
Handle< SetIdentifiersourceSetIdentifier
 
AtomicComputationPtr node
 
- Protected Attributes inherited from pdb::AbstractPhysicalNode
std::string jobId
 
Handle< ComputePlancomputePlan
 
LogicalPlanPtr logicalPlan
 
ConfigurationPtr conf
 
std::list
< AbstractPhysicalNodePtr
consumers
 
std::list
< AbstractPhysicalNodeWeakPtr
producers
 
AbstractPhysicalNodeWeakPtr handle
 

Detailed Description

Definition at line 33 of file SimplePhysicalNode.h.

Constructor & Destructor Documentation

pdb::SimplePhysicalNode::SimplePhysicalNode ( string  jobId,
AtomicComputationPtr  node,
const Handle< ComputePlan > &  computePlan,
LogicalPlanPtr  logicalPlan,
ConfigurationPtr  conf 
)

Definition at line 25 of file SimplePhysicalNode.cc.

+ Here is the call graph for this function:

Member Function Documentation

void pdb::SimplePhysicalNode::addConsumer ( const AbstractPhysicalNodePtr consumer)
overridevirtual

Adds a consumer to this node This method calls the base method but also adds the consumer to the list of

See Also
activeConsumers.
Parameters
consumer

Reimplemented from pdb::AbstractPhysicalNode.

Definition at line 116 of file SimplePhysicalNode.cc.

+ Here is the call graph for this function:

PhysicalOptimizerResultPtr pdb::SimplePhysicalNode::analyze ( const StatisticsPtr stats,
int  nextStageID 
)
overridevirtual

This method starts the analysis for the simple physical optimizer. What it does is it sets up a TupleStageBuilder and then calls recursively the other analyze method

Returns
the resulting partial plan if succeeded

Implements pdb::AbstractPhysicalNode.

Definition at line 43 of file SimplePhysicalNode.cc.

+ Here is the call graph for this function:

PhysicalOptimizerResultPtr pdb::SimplePhysicalNode::analyze ( TupleSetJobStageBuilderPtr shared_ptr,
SimplePhysicalNodePtr prevNode,
const StatisticsPtr stats,
int  nextStageID 
)

Depending on the number of active consumers this node has it either :

analyzeOutput - in the case this node does not have any consumers analyzeSingleConsumer - in the case there is just one consumer analyzeMultipleConsumers - in the case that this node has multiple consumers

Parameters
shared_ptr
Returns
the resulting partial plan if succeeded

Definition at line 86 of file SimplePhysicalNode.cc.

+ Here is the call graph for this function:

PhysicalOptimizerResultPtr pdb::SimplePhysicalNode::analyzeMultipleConsumers ( TupleSetJobStageBuilderPtr ptr,
SimplePhysicalNodePtr prevNode,
const StatisticsPtr stats,
int  nextStageID 
)
protectedvirtual

This method is called if we have multiple consumers thus this node needs to materialized What it does it check whether we already need to materialize this node if not, it makes it materializable the it just creates a job stage

Parameters
tupleStageBuilder- the builder for the tuple set job stage, that contains all the computations in our pipeline so far.
prevNode- the previous node we are coming from to analyze this node
stats- the statistics about the sets that are in the catalog
nextStageID- the id of the next stage for this job
Returns
the result will contain a partial physical plan

Reimplemented in pdb::SimplePhysicalAggregationNode, and pdb::SimplePhysicalPartitionNode.

Definition at line 204 of file SimplePhysicalNode.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PhysicalOptimizerResultPtr pdb::SimplePhysicalNode::analyzeOutput ( TupleSetJobStageBuilderPtr tupleStageBuilder,
SimplePhysicalNodePtr prevNode,
const StatisticsPtr stats,
int  nextStageID 
)
protectedvirtual

This method is called if we do not have any consumers thus this is an output node What it does is, it just creates a job stage and returns a result with success

Parameters
tupleStageBuilder- the builder for the tuple set job stage, that contains all the computations in our pipeline so far.
prevNode- the previous node we are coming from to analyze this node
stats- the statistics about the sets that are in the catalog
nextStageID- the id of the next stage for this job
Returns
the result will contain a partial physical plan

Reimplemented in pdb::SimplePhysicalAggregationNode, pdb::SimplePhysicalPartitionNode, and pdb::SimplePhysicalJoinNode.

Definition at line 172 of file SimplePhysicalNode.cc.

+ Here is the caller graph for this function:

PhysicalOptimizerResultPtr pdb::SimplePhysicalNode::analyzeSingleConsumer ( TupleSetJobStageBuilderPtr tupleStageBuilder,
SimplePhysicalNodePtr prevNode,
const StatisticsPtr stats,
int  nextStageID 
)
protectedvirtual

This method is called in the case that we have just one consumer of this node What it does is, it just adds AtomicComputation associated with this node to the pipline we are building

Parameters
tupleStageBuilder- the builder for the tuple set job stage, that contains all the computations in our pipeline so far.
prevNode- the previous node we are coming from to analyze this node
stats- the statistics about the sets that are in the catalog
nextStageID- the id of the next stage for this job
Returns
the result will contain a partial physical plan

Reimplemented in pdb::SimplePhysicalJoinNode, pdb::SimplePhysicalAggregationNode, and pdb::SimplePhysicalPartitionNode.

Definition at line 143 of file SimplePhysicalNode.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double pdb::SimplePhysicalNode::getCost ( const StatisticsPtr stats)
overridevirtual

Return the cost by calling the

See Also
getCost method with the
sourceSetIdentifier as a parameter.
Parameters
stats- the statistics about the sets
Returns
the cost value

Implements pdb::AbstractPhysicalNode.

Definition at line 264 of file SimplePhysicalNode.cc.

double pdb::SimplePhysicalNode::getCost ( Handle< SetIdentifier source,
const StatisticsPtr stats 
)
protected

This method calculates the cost of the provided source. The cost is calculated by the formula : cost = number_of_bytes / 1000000

Parameters
source
stats
Returns
the const

Definition at line 124 of file SimplePhysicalNode.cc.

const AtomicComputationPtr & pdb::SimplePhysicalNode::getNode ( ) const

Returns the AtomicComputation associated with this AbstractPhysicalNode

Returns
the node

Definition at line 104 of file SimplePhysicalNode.cc.

string pdb::SimplePhysicalNode::getNodeIdentifier ( )
overrideprotectedvirtual

Returns the identifier of this node in this case in the form of <databaseName>:<setName>

Returns
the identifier

Implements pdb::AbstractPhysicalNode.

Definition at line 270 of file SimplePhysicalNode.cc.

SimplePhysicalNodePtr pdb::SimplePhysicalNode::getSimpleNodeHandle ( )

Returns the shared_pointer to this node

Returns
the handle

Definition at line 278 of file SimplePhysicalNode.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const Handle< SetIdentifier > & pdb::SimplePhysicalNode::getSourceSetIdentifier ( ) const
protected

This method returns the set identifier of the source if this node is a source, returns null otherwise

Returns
the set identifier

Definition at line 274 of file SimplePhysicalNode.cc.

bool pdb::SimplePhysicalNode::hasConsumers ( )
overridevirtual

Returns true if this node has any unprocessed consumers, false otherwise

Returns
the value

Implements pdb::AbstractPhysicalNode.

Definition at line 108 of file SimplePhysicalNode.cc.

bool pdb::SimplePhysicalNode::isConsuming ( Handle< SetIdentifier > &  set)
overridevirtual

Returns true if the set provided is consumed by some later stage in the planning

Parameters
set- the set identifier of the set we want to check
Returns
true if it does false otherwise

Implements pdb::AbstractPhysicalNode.

Definition at line 112 of file SimplePhysicalNode.cc.

Member Data Documentation

std::list<SimplePhysicalNodePtr> pdb::SimplePhysicalNode::activeConsumers
protected

A list of consumers of this node

Definition at line 179 of file SimplePhysicalNode.h.

AtomicComputationPtr pdb::SimplePhysicalNode::node
protected

The AtomicComputation associated with this node

Definition at line 189 of file SimplePhysicalNode.h.

Handle<SetIdentifier> pdb::SimplePhysicalNode::sourceSetIdentifier
protected

Source set associated with this node.

Definition at line 184 of file SimplePhysicalNode.h.


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