OmniSciDB  c1a53651b2
 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 (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_
 
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
 

Friends

struct RelAlgDagSerializer
 

Detailed Description

Definition at line 838 of file RelAlgDag.h.

Constructor & Destructor Documentation

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

Definition at line 840 of file RelAlgDag.h.

840  {})
841  : inputs_(std::move(inputs))
842  , id_(crt_id_++)
843  , id_in_plan_tree_(std::nullopt)
844  , context_data_(nullptr)
845  , is_nop_(false)
846  , query_plan_dag_("")
847  , query_plan_dag_hash_(0) {}
bool is_nop_
Definition: RelAlgDag.h:959
static thread_local unsigned crt_id_
Definition: RelAlgDag.h:961
std::string query_plan_dag_
Definition: RelAlgDag.h:963
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:958
size_t query_plan_dag_hash_
Definition: RelAlgDag.h:964
std::optional< size_t > id_in_plan_tree_
Definition: RelAlgDag.h:954
unsigned id_
Definition: RelAlgDag.h:953
RelAlgInputs inputs_
Definition: RelAlgDag.h:952
virtual RelAlgNode::~RelAlgNode ( )
inlinevirtual

Definition at line 849 of file RelAlgDag.h.

849 {}

Member Function Documentation

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

Definition at line 902 of file RelAlgDag.h.

References inputs_.

902  {
903  inputs_.push_back(input);
904  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:952
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 949 of file RelAlgDag.h.

References context_data_.

949 { context_data_ = nullptr; }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:958
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 897 of file RelAlgDag.h.

References CHECK_LT, and inputs_.

Referenced by get_left_deep_join_root().

897  {
898  CHECK_LT(idx, inputs_.size());
899  return inputs_[idx];
900  }
#define CHECK_LT(x, y)
Definition: Logger.h:303
RelAlgInputs inputs_
Definition: RelAlgDag.h:952

+ Here is the caller graph for this function:

const RaExecutionDesc* RelAlgNode::getContextData ( ) const
inline

Definition at line 888 of file RelAlgDag.h.

References context_data_.

Referenced by RelAlgExecutor::executeRelAlgStep().

888 { return context_data_; }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:958

+ Here is the caller graph for this function:

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

Definition at line 884 of file RelAlgDag.h.

References id_in_plan_tree_.

Referenced by RexInput::toString().

884 { return id_in_plan_tree_; }
std::optional< size_t > id_in_plan_tree_
Definition: RelAlgDag.h:954

+ Here is the caller graph for this function:

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

Definition at line 892 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(), 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().

892  {
893  CHECK_LT(idx, inputs_.size());
894  return inputs_[idx].get();
895  }
#define CHECK_LT(x, y)
Definition: Logger.h:303
RelAlgInputs inputs_
Definition: RelAlgDag.h:952

+ 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 872 of file RelAlgDag.h.

References query_plan_dag_.

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

Definition at line 928 of file RelAlgDag.h.

References dag_node_id_.

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

928 { return dag_node_id_; }
size_t dag_node_id_
Definition: RelAlgDag.h:962

+ Here is the caller graph for this function:

bool RelAlgNode::hasContextData ( ) const
inline

Definition at line 886 of file RelAlgDag.h.

References context_data_.

Referenced by RelAlgExecutor::executeRelAlgStep().

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

+ Here is the caller graph for this function:

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

Definition at line 906 of file RelAlgDag.h.

References inputs_.

906  {
907  for (auto& input_ptr : inputs_) {
908  if (input_ptr.get() == needle) {
909  return true;
910  }
911  }
912  return false;
913  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:952
const size_t RelAlgNode::inputCount ( ) const
inline

Definition at line 890 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().

890 { return inputs_.size(); }
RelAlgInputs inputs_
Definition: RelAlgDag.h:952

+ Here is the caller graph for this function:

bool RelAlgNode::isNop ( ) const
inline

Definition at line 930 of file RelAlgDag.h.

References is_nop_.

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

Definition at line 932 of file RelAlgDag.h.

References is_nop_.

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

932 { is_nop_ = true; }
bool is_nop_
Definition: RelAlgDag.h:959

+ 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 915 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().

916  {
917  for (auto& input_ptr : inputs_) {
918  if (input_ptr == old_input) {
919  input_ptr = input;
920  break;
921  }
922  }
923  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:952

+ Here is the caller graph for this function:

void RelAlgNode::resetQueryExecutionState ( )
inline

Definition at line 851 of file RelAlgDag.h.

References context_data_, and targets_metainfo_.

851  {
852  context_data_ = nullptr;
853  targets_metainfo_ = {};
854  }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:958
std::vector< TargetMetaInfo > targets_metainfo_
Definition: RelAlgDag.h:960
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:961

+ Here is the caller graph for this function:

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

Definition at line 856 of file RelAlgDag.h.

References CHECK, and context_data_.

856  {
858  context_data_ = context_data;
859  }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:958
#define CHECK(condition)
Definition: Logger.h:291
void RelAlgNode::setIdInPlanTree ( size_t  id) const
inline

Definition at line 882 of file RelAlgDag.h.

References id_in_plan_tree_.

882 { id_in_plan_tree_ = id; }
std::optional< size_t > id_in_plan_tree_
Definition: RelAlgDag.h:954
void RelAlgNode::setOutputMetainfo ( std::vector< TargetMetaInfo targets_metainfo) const
inline

Definition at line 861 of file RelAlgDag.h.

References targets_metainfo_.

Referenced by RelAlgExecutor::createAggregateWorkUnit(), RelAlgExecutor::createCompoundWorkUnit(), RelAlgExecutor::createFilterWorkUnit(), RelAlgExecutor::createProjectWorkUnit(), RelAlgExecutor::createSortInputWorkUnit(), RelAlgExecutor::createTableFunctionWorkUnit(), RelAlgExecutor::createUnionWorkUnit(), RelAlgExecutor::executeLogicalValues(), RelAlgExecutor::executeSort(), RelAlgExecutor::executeUnion(), and RaExecutionSequence::next().

861  {
862  targets_metainfo_ = std::move(targets_metainfo);
863  }
std::vector< TargetMetaInfo > targets_metainfo_
Definition: RelAlgDag.h:960

+ Here is the caller graph for this function:

void RelAlgNode::setQueryPlanDag ( const std::string &  extracted_query_plan_dag) const
inline

Definition at line 865 of file RelAlgDag.h.

References query_plan_dag_, and query_plan_dag_hash_.

Referenced by QueryPlanDagExtractor::extractQueryPlanDag().

865  {
866  if (!extracted_query_plan_dag.empty()) {
867  query_plan_dag_ = extracted_query_plan_dag;
868  query_plan_dag_hash_ = boost::hash_value(extracted_query_plan_dag);
869  }
870  }
std::string query_plan_dag_
Definition: RelAlgDag.h:963
size_t query_plan_dag_hash_
Definition: RelAlgDag.h:964

+ Here is the caller graph for this function:

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

Definition at line 926 of file RelAlgDag.h.

References dag_node_id_.

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

926 { dag_node_id_ = id; }
size_t dag_node_id_
Definition: RelAlgDag.h:962

+ 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(), RelAlgDag::registerQueryHint(), RexInput::toHash(), and RelTranslatedJoin::toHash().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend struct RelAlgDagSerializer
friend

Definition at line 966 of file RelAlgDag.h.

Member Data Documentation

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

Definition at line 961 of file RelAlgDag.h.

Referenced by resetRelAlgFirstId().

size_t RelAlgNode::dag_node_id_
mutableprivate

Definition at line 962 of file RelAlgDag.h.

Referenced by getRelNodeDagId(), and setRelNodeDagId().

unsigned RelAlgNode::id_
protected

Definition at line 953 of file RelAlgDag.h.

Referenced by getId().

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

Definition at line 954 of file RelAlgDag.h.

Referenced by getIdInPlanTree(), and setIdInPlanTree().

bool RelAlgNode::is_nop_
private

Definition at line 959 of file RelAlgDag.h.

Referenced by isNop(), and markAsNop().

std::string RelAlgNode::query_plan_dag_
mutableprivate

Definition at line 963 of file RelAlgDag.h.

Referenced by getQueryPlanDag(), and setQueryPlanDag().

size_t RelAlgNode::query_plan_dag_hash_
mutableprivate

Definition at line 964 of file RelAlgDag.h.

Referenced by getQueryPlanDagHash(), and setQueryPlanDag().

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

Definition at line 960 of file RelAlgDag.h.

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


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