OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RelAlgNode Class Referenceabstract

#include <RelAlgDag.h>

+ Inheritance diagram for RelAlgNode:
+ Collaboration diagram for RelAlgNode:

Public Member Functions

 RelAlgNode (RelAlgInputs inputs={})
 
virtual ~RelAlgNode ()
 
void resetQueryExecutionState ()
 
void setContextData (const RaExecutionDesc *context_data) const
 
void setOutputMetainfo (const std::vector< TargetMetaInfo > &targets_metainfo) const
 
void setQueryPlanDag (const std::string &extracted_query_plan_dag) const
 
std::string getQueryPlanDag () const
 
size_t getQueryPlanDagHash () const
 
const std::vector
< TargetMetaInfo > & 
getOutputMetainfo () const
 
unsigned getId () const
 
void setIdInPlanTree (size_t id) const
 
std::optional< size_t > getIdInPlanTree () const
 
bool hasContextData () const
 
const RaExecutionDescgetContextData () const
 
const size_t inputCount () const
 
const RelAlgNodegetInput (const size_t idx) const
 
std::shared_ptr< const RelAlgNodegetAndOwnInput (const size_t idx) const
 
void addManagedInput (std::shared_ptr< const RelAlgNode > input)
 
bool hasInput (const RelAlgNode *needle) const
 
virtual void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input)
 
void setRelNodeDagId (const size_t id) const
 
size_t getRelNodeDagId () const
 
bool isNop () const
 
void markAsNop ()
 
virtual std::string toString (RelRexToStringConfig config) const =0
 
virtual size_t toHash () const =0
 
virtual size_t size () const =0
 
virtual std::shared_ptr
< RelAlgNode
deepCopy () const =0
 
void clearContextData () const
 

Static Public Member Functions

static void resetRelAlgFirstId () noexcept
 

Protected Attributes

RelAlgInputs inputs_
 
const unsigned id_
 
std::optional< size_t > id_in_plan_tree_
 
std::optional< size_t > hash_
 

Private Attributes

const RaExecutionDesccontext_data_
 
bool is_nop_
 
std::vector< TargetMetaInfotargets_metainfo_
 
size_t dag_node_id_
 
std::string query_plan_dag_
 
size_t query_plan_dag_hash_
 

Static Private Attributes

static thread_local unsigned crt_id_ = FIRST_RA_NODE_ID
 

Detailed Description

Definition at line 772 of file RelAlgDag.h.

Constructor & Destructor Documentation

RelAlgNode::RelAlgNode ( RelAlgInputs  inputs = {})
inline

Definition at line 774 of file RelAlgDag.h.

774  {})
775  : inputs_(std::move(inputs))
776  , id_(crt_id_++)
777  , id_in_plan_tree_(std::nullopt)
778  , context_data_(nullptr)
779  , is_nop_(false)
780  , query_plan_dag_("")
781  , query_plan_dag_hash_(0) {}
bool is_nop_
Definition: RelAlgDag.h:893
static thread_local unsigned crt_id_
Definition: RelAlgDag.h:895
std::string query_plan_dag_
Definition: RelAlgDag.h:897
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:892
size_t query_plan_dag_hash_
Definition: RelAlgDag.h:898
std::optional< size_t > id_in_plan_tree_
Definition: RelAlgDag.h:888
RelAlgInputs inputs_
Definition: RelAlgDag.h:886
const unsigned id_
Definition: RelAlgDag.h:887
virtual RelAlgNode::~RelAlgNode ( )
inlinevirtual

Definition at line 783 of file RelAlgDag.h.

783 {}

Member Function Documentation

void RelAlgNode::addManagedInput ( std::shared_ptr< const RelAlgNode input)
inline

Definition at line 836 of file RelAlgDag.h.

References inputs_.

Referenced by RelLeftDeepInnerJoin::RelLeftDeepInnerJoin().

836  {
837  inputs_.push_back(input);
838  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:886

+ Here is the caller graph for this function:

void RelAlgNode::clearContextData ( ) const
inline

Clears the ptr to the result for this descriptor. Is only used for overriding step results in distributed mode.

Definition at line 883 of file RelAlgDag.h.

References context_data_.

883 { context_data_ = nullptr; }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:892
virtual std::shared_ptr<RelAlgNode> RelAlgNode::deepCopy ( ) const
pure virtual
std::shared_ptr<const RelAlgNode> RelAlgNode::getAndOwnInput ( const size_t  idx) const
inline

Definition at line 831 of file RelAlgDag.h.

References CHECK_LT, and inputs_.

Referenced by get_left_deep_join_root().

831  {
832  CHECK_LT(idx, inputs_.size());
833  return inputs_[idx];
834  }
#define CHECK_LT(x, y)
Definition: Logger.h:232
RelAlgInputs inputs_
Definition: RelAlgDag.h:886

+ Here is the caller graph for this function:

const RaExecutionDesc* RelAlgNode::getContextData ( ) const
inline

Definition at line 822 of file RelAlgDag.h.

References context_data_.

Referenced by RelAlgExecutor::executeRelAlgStep().

822 { return context_data_; }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:892

+ Here is the caller graph for this function:

unsigned RelAlgNode::getId ( ) const
inline
std::optional<size_t> RelAlgNode::getIdInPlanTree ( ) const
inline

Definition at line 818 of file RelAlgDag.h.

References id_in_plan_tree_.

Referenced by RexInput::toString().

818 { return id_in_plan_tree_; }
std::optional< size_t > id_in_plan_tree_
Definition: RelAlgDag.h:888

+ Here is the caller graph for this function:

const RelAlgNode* RelAlgNode::getInput ( const size_t  idx) const
inline

Definition at line 826 of file RelAlgDag.h.

References CHECK_LT, and inputs_.

Referenced by anonymous_namespace{RelAlgOptimizer.cpp}::add_new_indices_for(), anonymous_namespace{RelAlgExecutor.cpp}::check_sort_node_source_constraint(), RelLogicalUnion::copyAndRedirectSource(), RelAlgExecutor::createAggregateWorkUnit(), RelAlgExecutor::createCompoundWorkUnit(), RelAlgExecutor::createProjectWorkUnit(), RelAlgExecutor::createSortInputWorkUnit(), RelAlgExecutor::createUnionWorkUnit(), RelAlgExecutor::executeProject(), RelAlgExecutor::executeRelAlgStep(), RelAlgExecutor::executeSort(), RelAlgExecutor::executeUnion(), QueryPlanDagExtractor::extractQueryPlanDagImpl(), anonymous_namespace{RelAlgOptimizer.cpp}::get_actual_source_size(), anonymous_namespace{RelAlgExecutor.cpp}::get_data_sink(), anonymous_namespace{RelAlgOptimizer.cpp}::get_field_name(), anonymous_namespace{QueryPlanDagExtractor.cpp}::get_input_idx(), anonymous_namespace{RelAlgExecutor.cpp}::get_left_deep_join_input_sizes(), anonymous_namespace{RelAlgExecutor.cpp}::get_targets_meta(), anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), anonymous_namespace{RelAlgOptimizer.cpp}::get_visible_projects(), RelAlgExecutor::getRelAlgTranslator(), QueryPlanDagExtractor::handleLeftDeepJoinTree(), anonymous_namespace{RelAlgOptimizer.cpp}::AvailabilityChecker::hasAllSrcReady(), hoist_filter_cond_to_cross_join(), anonymous_namespace{RelAlgOptimizer.cpp}::is_distinct(), RelProject::isIdentity(), anonymous_namespace{RelAlgDag.cpp}::isRenamedInput(), project_separates_sort(), anonymous_namespace{RelAlgOptimizer.cpp}::propagate_rex_input_renumber(), anonymous_namespace{RelLeftDeepInnerJoin.cpp}::RebindRexInputsFromLeftDeepJoin::RebindRexInputsFromLeftDeepJoin(), QueryPlanDagExtractor::register_and_visit(), anonymous_namespace{RelAlgExecutor.cpp}::synthesize_inputs(), tree_string(), RelAlgVisitor< std::vector< unsigned > >::visit(), RelRexDagVisitor::visit(), JoinTargetRebaser::visitInput(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitSort().

826  {
827  CHECK_LT(idx, inputs_.size());
828  return inputs_[idx].get();
829  }
#define CHECK_LT(x, y)
Definition: Logger.h:232
RelAlgInputs inputs_
Definition: RelAlgDag.h:886

+ Here is the caller graph for this function:

const std::vector<TargetMetaInfo>& RelAlgNode::getOutputMetainfo ( ) const
inline
std::string RelAlgNode::getQueryPlanDag ( ) const
inline

Definition at line 806 of file RelAlgDag.h.

References query_plan_dag_.

806 { return query_plan_dag_; }
std::string query_plan_dag_
Definition: RelAlgDag.h:897
size_t RelAlgNode::getQueryPlanDagHash ( ) const
inline
size_t RelAlgNode::getRelNodeDagId ( ) const
inline

Definition at line 862 of file RelAlgDag.h.

References dag_node_id_.

Referenced by RelAlgExecutor::executeTableFunction(), and QueryPlanDagExtractor::registerNodeToDagCache().

862 { return dag_node_id_; }
size_t dag_node_id_
Definition: RelAlgDag.h:896

+ Here is the caller graph for this function:

bool RelAlgNode::hasContextData ( ) const
inline

Definition at line 820 of file RelAlgDag.h.

References context_data_.

Referenced by RelAlgExecutor::executeRelAlgStep().

820 { return !(context_data_ == nullptr); }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:892

+ Here is the caller graph for this function:

bool RelAlgNode::hasInput ( const RelAlgNode needle) const
inline

Definition at line 840 of file RelAlgDag.h.

References inputs_.

840  {
841  for (auto& input_ptr : inputs_) {
842  if (input_ptr.get() == needle) {
843  return true;
844  }
845  }
846  return false;
847  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:886
const size_t RelAlgNode::inputCount ( ) const
inline

Definition at line 824 of file RelAlgDag.h.

References inputs_.

Referenced by anonymous_namespace{RelAlgOptimizer.cpp}::add_new_indices_for(), anonymous_namespace{RelAlgExecutor.cpp}::check_sort_node_source_constraint(), RelAlgExecutor::createAggregateWorkUnit(), RelAlgExecutor::createCompoundWorkUnit(), RelAlgExecutor::createFilterWorkUnit(), RelAlgExecutor::executeProject(), QueryPlanDagExtractor::extractQueryPlanDagImpl(), anonymous_namespace{RelAlgExecutor.cpp}::get_data_sink(), anonymous_namespace{QueryPlanDagExtractor.cpp}::get_input_idx(), anonymous_namespace{RelAlgExecutor.cpp}::get_join_source_used_inputs(), anonymous_namespace{RelAlgExecutor.cpp}::get_left_deep_join_input_sizes(), anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), anonymous_namespace{RelAlgOptimizer.cpp}::AvailabilityChecker::hasAllSrcReady(), anonymous_namespace{RelAlgOptimizer.cpp}::is_distinct(), RelProject::isIdentity(), anonymous_namespace{RelAlgExecutor.cpp}::left_deep_join_types(), project_separates_sort(), anonymous_namespace{RelLeftDeepInnerJoin.cpp}::RebindRexInputsFromLeftDeepJoin::RebindRexInputsFromLeftDeepJoin(), QueryPlanDagExtractor::register_and_visit(), anonymous_namespace{RelAlgExecutor.cpp}::synthesize_inputs(), tree_string(), RelAlgVisitor< std::vector< unsigned > >::visit(), RelRexDagVisitor::visit(), anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitLeftDeepInnerJoin(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitSort().

824 { return inputs_.size(); }
RelAlgInputs inputs_
Definition: RelAlgDag.h:886

+ Here is the caller graph for this function:

bool RelAlgNode::isNop ( ) const
inline

Definition at line 864 of file RelAlgDag.h.

References is_nop_.

864 { return is_nop_; }
bool is_nop_
Definition: RelAlgDag.h:893
void RelAlgNode::markAsNop ( )
inline

Definition at line 866 of file RelAlgDag.h.

References is_nop_.

Referenced by anonymous_namespace{RelAlgDag.cpp}::mark_nops().

866 { is_nop_ = true; }
bool is_nop_
Definition: RelAlgDag.h:893

+ Here is the caller graph for this function:

virtual void RelAlgNode::replaceInput ( std::shared_ptr< const RelAlgNode old_input,
std::shared_ptr< const RelAlgNode input 
)
inlinevirtual

Reimplemented in RelTableFunction, RelCompound, RelFilter, RelTranslatedJoin, RelJoin, and RelProject.

Definition at line 849 of file RelAlgDag.h.

References inputs_.

Referenced by RelProject::replaceInput(), RelJoin::replaceInput(), RelFilter::replaceInput(), RelCompound::replaceInput(), RelTableFunction::replaceInput(), and anonymous_namespace{RelAlgOptimizer.cpp}::try_insert_coalesceable_proj().

850  {
851  for (auto& input_ptr : inputs_) {
852  if (input_ptr == old_input) {
853  input_ptr = input;
854  break;
855  }
856  }
857  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:886

+ Here is the caller graph for this function:

void RelAlgNode::resetQueryExecutionState ( )
inline

Definition at line 785 of file RelAlgDag.h.

References context_data_, and targets_metainfo_.

785  {
786  context_data_ = nullptr;
787  targets_metainfo_ = {};
788  }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:892
std::vector< TargetMetaInfo > targets_metainfo_
Definition: RelAlgDag.h:894
void RelAlgNode::resetRelAlgFirstId ( )
staticnoexcept

Definition at line 46 of file RelAlgDag.cpp.

References crt_id_, and anonymous_namespace{RelAlgDag.cpp}::FIRST_RA_NODE_ID.

Referenced by RelAlgDagBuilder::buildDag().

46  {
48 }
static thread_local unsigned crt_id_
Definition: RelAlgDag.h:895

+ Here is the caller graph for this function:

void RelAlgNode::setContextData ( const RaExecutionDesc context_data) const
inline

Definition at line 790 of file RelAlgDag.h.

References CHECK, and context_data_.

790  {
792  context_data_ = context_data;
793  }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:892
#define CHECK(condition)
Definition: Logger.h:222
void RelAlgNode::setIdInPlanTree ( size_t  id) const
inline

Definition at line 816 of file RelAlgDag.h.

References id_in_plan_tree_.

816 { id_in_plan_tree_ = id; }
std::optional< size_t > id_in_plan_tree_
Definition: RelAlgDag.h:888
void RelAlgNode::setOutputMetainfo ( const std::vector< TargetMetaInfo > &  targets_metainfo) const
inline
void RelAlgNode::setQueryPlanDag ( const std::string &  extracted_query_plan_dag) const
inline

Definition at line 799 of file RelAlgDag.h.

References query_plan_dag_, and query_plan_dag_hash_.

Referenced by QueryPlanDagExtractor::extractQueryPlanDag().

799  {
800  if (!extracted_query_plan_dag.empty()) {
801  query_plan_dag_ = extracted_query_plan_dag;
802  query_plan_dag_hash_ = boost::hash_value(extracted_query_plan_dag);
803  }
804  }
std::string query_plan_dag_
Definition: RelAlgDag.h:897
size_t query_plan_dag_hash_
Definition: RelAlgDag.h:898

+ Here is the caller graph for this function:

void RelAlgNode::setRelNodeDagId ( const size_t  id) const
inline

Definition at line 860 of file RelAlgDag.h.

References dag_node_id_.

Referenced by QueryPlanDagExtractor::extractQueryPlanDagImpl(), and QueryPlanDagExtractor::validateNodeId().

860 { dag_node_id_ = id; }
size_t dag_node_id_
Definition: RelAlgDag.h:896

+ Here is the caller graph for this function:

virtual size_t RelAlgNode::toHash ( ) const
pure virtual

Implemented in RelLogicalUnion, RelLogicalValues, RelTableFunction, RelModify, RelSort, RelCompound, RelLeftDeepInnerJoin, RelFilter, RelTranslatedJoin, RelJoin, RelAggregate, RelProject, and RelScan.

Referenced by QueryPlanDagCache::addNodeIfAbsent(), RelAlgDag::getQueryHint(), RexInput::toHash(), and RelTranslatedJoin::toHash().

+ Here is the caller graph for this function:

Member Data Documentation

const RaExecutionDesc* RelAlgNode::context_data_
mutableprivate
thread_local unsigned RelAlgNode::crt_id_ = FIRST_RA_NODE_ID
staticprivate

Definition at line 895 of file RelAlgDag.h.

Referenced by resetRelAlgFirstId().

size_t RelAlgNode::dag_node_id_
mutableprivate

Definition at line 896 of file RelAlgDag.h.

Referenced by getRelNodeDagId(), and setRelNodeDagId().

const unsigned RelAlgNode::id_
protected

Definition at line 887 of file RelAlgDag.h.

Referenced by getId().

std::optional<size_t> RelAlgNode::id_in_plan_tree_
mutableprotected

Definition at line 888 of file RelAlgDag.h.

Referenced by getIdInPlanTree(), and setIdInPlanTree().

bool RelAlgNode::is_nop_
private

Definition at line 893 of file RelAlgDag.h.

Referenced by isNop(), and markAsNop().

std::string RelAlgNode::query_plan_dag_
mutableprivate

Definition at line 897 of file RelAlgDag.h.

Referenced by getQueryPlanDag(), and setQueryPlanDag().

size_t RelAlgNode::query_plan_dag_hash_
mutableprivate

Definition at line 898 of file RelAlgDag.h.

Referenced by getQueryPlanDagHash(), and setQueryPlanDag().

std::vector<TargetMetaInfo> RelAlgNode::targets_metainfo_
mutableprivate

Definition at line 894 of file RelAlgDag.h.

Referenced by getOutputMetainfo(), resetQueryExecutionState(), and setOutputMetainfo().


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