OmniSciDB  72c90bc290
 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
 
bool hasContextData () const
 
const RaExecutionDescgetContextData () const
 
const size_t inputCount () const
 
const RelAlgNodegetInput (const size_t idx) const
 
const std::vector< RelAlgNode
const * > 
getInputs () 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=RelRexToStringConfig::defaults()) const =0
 
virtual size_t size () const =0
 
virtual std::shared_ptr
< RelAlgNode
deepCopy () const =0
 
void clearContextData () const
 
virtual size_t toHash () const =0
 
- Public Member Functions inherited from RelAlgDagNode
 RelAlgDagNode ()
 
virtual void accept (Visitor &v, std::string name) const =0
 
virtual void acceptChildren (Visitor &v) const =0
 
virtual size_t getStepNumber () const
 
virtual void setStepNumber (size_t step) const
 
std::optional< size_t > getIdInPlanTree () const
 
void setIdInPlanTree (size_t id) const
 

Static Public Member Functions

static void resetRelAlgFirstId () noexcept
 

Protected Attributes

RelAlgInputs inputs_
 
unsigned id_
 
std::optional< size_t > hash_
 
- Protected Attributes inherited from RelAlgDagNode
size_t step_ {0}
 
std::optional< size_t > id_in_plan_tree_
 

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

Constructor & Destructor Documentation

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

Definition at line 830 of file RelAlgDag.h.

830  {})
831  : inputs_(std::move(inputs))
832  , id_(crt_id_++)
833  , context_data_(nullptr)
834  , is_nop_(false)
835  , query_plan_dag_("")
836  , query_plan_dag_hash_(0) {}
bool is_nop_
Definition: RelAlgDag.h:951
static thread_local unsigned crt_id_
Definition: RelAlgDag.h:953
std::string query_plan_dag_
Definition: RelAlgDag.h:955
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:950
size_t query_plan_dag_hash_
Definition: RelAlgDag.h:956
unsigned id_
Definition: RelAlgDag.h:946
RelAlgInputs inputs_
Definition: RelAlgDag.h:945
virtual RelAlgNode::~RelAlgNode ( )
inlinevirtual

Definition at line 838 of file RelAlgDag.h.

838 {}

Member Function Documentation

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

Definition at line 895 of file RelAlgDag.h.

References inputs_.

895  {
896  inputs_.push_back(input);
897  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:945
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 940 of file RelAlgDag.h.

References context_data_.

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

References CHECK_LT, and inputs_.

Referenced by get_left_deep_join_root().

890  {
891  CHECK_LT(idx, inputs_.size());
892  return inputs_[idx];
893  }
#define CHECK_LT(x, y)
Definition: Logger.h:303
RelAlgInputs inputs_
Definition: RelAlgDag.h:945

+ Here is the caller graph for this function:

const RaExecutionDesc* RelAlgNode::getContextData ( ) const
inline

Definition at line 873 of file RelAlgDag.h.

References context_data_.

Referenced by RelAlgExecutor::executeRelAlgStep().

873 { return context_data_; }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:950

+ Here is the caller graph for this function:

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

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

877  {
878  CHECK_LT(idx, inputs_.size());
879  return inputs_[idx].get();
880  }
#define CHECK_LT(x, y)
Definition: Logger.h:303
RelAlgInputs inputs_
Definition: RelAlgDag.h:945

+ Here is the caller graph for this function:

const std::vector<RelAlgNode const*> RelAlgNode::getInputs ( ) const
inline

Definition at line 882 of file RelAlgDag.h.

References inputs_, and anonymous_namespace{Utm.h}::n.

Referenced by RelProject::acceptChildren(), RelAggregate::acceptChildren(), RelJoin::acceptChildren(), RelTranslatedJoin::acceptChildren(), RelFilter::acceptChildren(), RelLeftDeepInnerJoin::acceptChildren(), RelCompound::acceptChildren(), RelSort::acceptChildren(), RelModify::acceptChildren(), RelTableFunction::acceptChildren(), RelLogicalValues::acceptChildren(), and RelLogicalUnion::acceptChildren().

882  {
883  std::vector<RelAlgNode const*> ret;
884  for (auto& n : inputs_) {
885  ret.push_back(n.get());
886  }
887  return ret;
888  }
constexpr double n
Definition: Utm.h:38
RelAlgInputs inputs_
Definition: RelAlgDag.h:945

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

References query_plan_dag_.

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

Definition at line 921 of file RelAlgDag.h.

References dag_node_id_.

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

921 { return dag_node_id_; }
size_t dag_node_id_
Definition: RelAlgDag.h:954

+ Here is the caller graph for this function:

bool RelAlgNode::hasContextData ( ) const
inline

Definition at line 871 of file RelAlgDag.h.

References context_data_.

Referenced by RelAlgExecutor::executeRelAlgStep().

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

+ Here is the caller graph for this function:

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

Definition at line 899 of file RelAlgDag.h.

References inputs_.

899  {
900  for (auto& input_ptr : inputs_) {
901  if (input_ptr.get() == needle) {
902  return true;
903  }
904  }
905  return false;
906  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:945
const size_t RelAlgNode::inputCount ( ) const
inline

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

875 { return inputs_.size(); }
RelAlgInputs inputs_
Definition: RelAlgDag.h:945

+ Here is the caller graph for this function:

bool RelAlgNode::isNop ( ) const
inline

Definition at line 923 of file RelAlgDag.h.

References is_nop_.

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

Definition at line 925 of file RelAlgDag.h.

References is_nop_.

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

925 { is_nop_ = true; }
bool is_nop_
Definition: RelAlgDag.h:951

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

909  {
910  for (auto& input_ptr : inputs_) {
911  if (input_ptr == old_input) {
912  input_ptr = input;
913  break;
914  }
915  }
916  }
RelAlgInputs inputs_
Definition: RelAlgDag.h:945

+ Here is the caller graph for this function:

void RelAlgNode::resetQueryExecutionState ( )
inline

Definition at line 840 of file RelAlgDag.h.

References context_data_, and targets_metainfo_.

840  {
841  context_data_ = nullptr;
842  targets_metainfo_ = {};
843  }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:950
std::vector< TargetMetaInfo > targets_metainfo_
Definition: RelAlgDag.h:952
void RelAlgNode::resetRelAlgFirstId ( )
staticnoexcept

Definition at line 47 of file RelAlgDag.cpp.

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

Referenced by RelAlgDagBuilder::buildDag().

47  {
49 }
static thread_local unsigned crt_id_
Definition: RelAlgDag.h:953

+ Here is the caller graph for this function:

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

Definition at line 845 of file RelAlgDag.h.

References CHECK, and context_data_.

845  {
847  context_data_ = context_data;
848  }
const RaExecutionDesc * context_data_
Definition: RelAlgDag.h:950
#define CHECK(condition)
Definition: Logger.h:291
void RelAlgNode::setOutputMetainfo ( std::vector< TargetMetaInfo targets_metainfo) const
inline

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

850  {
851  targets_metainfo_ = std::move(targets_metainfo);
852  }
std::vector< TargetMetaInfo > targets_metainfo_
Definition: RelAlgDag.h:952

+ Here is the caller graph for this function:

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

Definition at line 854 of file RelAlgDag.h.

References hash_value(), query_plan_dag_, and query_plan_dag_hash_.

Referenced by QueryPlanDagExtractor::extractQueryPlanDag().

854  {
855  if (!extracted_query_plan_dag.empty()) {
856  query_plan_dag_ = extracted_query_plan_dag;
857  query_plan_dag_hash_ = boost::hash_value(extracted_query_plan_dag);
858  }
859  }
std::string query_plan_dag_
Definition: RelAlgDag.h:955
size_t query_plan_dag_hash_
Definition: RelAlgDag.h:956
std::size_t hash_value(RexAbstractInput const &rex_ab_input)
Definition: RelAlgDag.cpp:3525

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 919 of file RelAlgDag.h.

References dag_node_id_.

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

919 { dag_node_id_ = id; }
size_t dag_node_id_
Definition: RelAlgDag.h:954

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

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend struct RelAlgDagSerializer
friend

Definition at line 958 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 953 of file RelAlgDag.h.

Referenced by resetRelAlgFirstId().

size_t RelAlgNode::dag_node_id_
mutableprivate

Definition at line 954 of file RelAlgDag.h.

Referenced by getRelNodeDagId(), and setRelNodeDagId().

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

Definition at line 947 of file RelAlgDag.h.

Referenced by hash_value().

unsigned RelAlgNode::id_
protected

Definition at line 946 of file RelAlgDag.h.

Referenced by getId().

bool RelAlgNode::is_nop_
private

Definition at line 951 of file RelAlgDag.h.

Referenced by isNop(), and markAsNop().

std::string RelAlgNode::query_plan_dag_
mutableprivate

Definition at line 955 of file RelAlgDag.h.

Referenced by getQueryPlanDag(), and setQueryPlanDag().

size_t RelAlgNode::query_plan_dag_hash_
mutableprivate

Definition at line 956 of file RelAlgDag.h.

Referenced by getQueryPlanDagHash(), and setQueryPlanDag().

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

Definition at line 952 of file RelAlgDag.h.

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


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