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

#include <RelAlgDagBuilder.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 758 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 760 of file RelAlgDagBuilder.h.

760  {})
761  : inputs_(std::move(inputs))
762  , id_(crt_id_++)
763  , id_in_plan_tree_(std::nullopt)
764  , context_data_(nullptr)
765  , is_nop_(false)
766  , query_plan_dag_("")
767  , query_plan_dag_hash_(0) {}
static thread_local unsigned crt_id_
std::string query_plan_dag_
const RaExecutionDesc * context_data_
size_t query_plan_dag_hash_
std::optional< size_t > id_in_plan_tree_
RelAlgInputs inputs_
const unsigned id_
virtual RelAlgNode::~RelAlgNode ( )
inlinevirtual

Definition at line 769 of file RelAlgDagBuilder.h.

769 {}

Member Function Documentation

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

Definition at line 822 of file RelAlgDagBuilder.h.

References inputs_.

Referenced by RelLeftDeepInnerJoin::RelLeftDeepInnerJoin().

822  {
823  inputs_.push_back(input);
824  }
RelAlgInputs inputs_

+ 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 869 of file RelAlgDagBuilder.h.

References context_data_.

869 { context_data_ = nullptr; }
const RaExecutionDesc * context_data_
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 817 of file RelAlgDagBuilder.h.

References CHECK_LT, and inputs_.

Referenced by get_left_deep_join_root().

817  {
818  CHECK_LT(idx, inputs_.size());
819  return inputs_[idx];
820  }
#define CHECK_LT(x, y)
Definition: Logger.h:233
RelAlgInputs inputs_

+ Here is the caller graph for this function:

const RaExecutionDesc* RelAlgNode::getContextData ( ) const
inline

Definition at line 808 of file RelAlgDagBuilder.h.

References context_data_.

Referenced by RelAlgExecutor::executeRelAlgStep().

808 { return context_data_; }
const RaExecutionDesc * context_data_

+ Here is the caller graph for this function:

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

Definition at line 804 of file RelAlgDagBuilder.h.

References id_in_plan_tree_.

Referenced by RexInput::toString().

804 { return id_in_plan_tree_; }
std::optional< size_t > id_in_plan_tree_

+ Here is the caller graph for this function:

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

Definition at line 812 of file RelAlgDagBuilder.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{RelAlgDagBuilder.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().

812  {
813  CHECK_LT(idx, inputs_.size());
814  return inputs_[idx].get();
815  }
#define CHECK_LT(x, y)
Definition: Logger.h:233
RelAlgInputs inputs_

+ 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 792 of file RelAlgDagBuilder.h.

References query_plan_dag_.

792 { return query_plan_dag_; }
std::string query_plan_dag_
size_t RelAlgNode::getQueryPlanDagHash ( ) const
inline
size_t RelAlgNode::getRelNodeDagId ( ) const
inline

Definition at line 848 of file RelAlgDagBuilder.h.

References dag_node_id_.

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

848 { return dag_node_id_; }
size_t dag_node_id_

+ Here is the caller graph for this function:

bool RelAlgNode::hasContextData ( ) const
inline

Definition at line 806 of file RelAlgDagBuilder.h.

References context_data_.

Referenced by RelAlgExecutor::executeRelAlgStep().

806 { return !(context_data_ == nullptr); }
const RaExecutionDesc * context_data_

+ Here is the caller graph for this function:

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

Definition at line 826 of file RelAlgDagBuilder.h.

References inputs_.

826  {
827  for (auto& input_ptr : inputs_) {
828  if (input_ptr.get() == needle) {
829  return true;
830  }
831  }
832  return false;
833  }
RelAlgInputs inputs_
const size_t RelAlgNode::inputCount ( ) const
inline

Definition at line 810 of file RelAlgDagBuilder.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().

810 { return inputs_.size(); }
RelAlgInputs inputs_

+ Here is the caller graph for this function:

bool RelAlgNode::isNop ( ) const
inline

Definition at line 850 of file RelAlgDagBuilder.h.

References is_nop_.

850 { return is_nop_; }
void RelAlgNode::markAsNop ( )
inline

Definition at line 852 of file RelAlgDagBuilder.h.

References is_nop_.

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

852 { is_nop_ = true; }

+ 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 835 of file RelAlgDagBuilder.h.

References inputs_.

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

836  {
837  for (auto& input_ptr : inputs_) {
838  if (input_ptr == old_input) {
839  input_ptr = input;
840  break;
841  }
842  }
843  }
RelAlgInputs inputs_

+ Here is the caller graph for this function:

void RelAlgNode::resetQueryExecutionState ( )
inline

Definition at line 771 of file RelAlgDagBuilder.h.

References context_data_, and targets_metainfo_.

771  {
772  context_data_ = nullptr;
773  targets_metainfo_ = {};
774  }
const RaExecutionDesc * context_data_
std::vector< TargetMetaInfo > targets_metainfo_
void RelAlgNode::resetRelAlgFirstId ( )
staticnoexcept

Definition at line 47 of file RelAlgDagBuilder.cpp.

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

Referenced by RelAlgDagBuilder::RelAlgDagBuilder().

47  {
49 }
static thread_local unsigned crt_id_

+ Here is the caller graph for this function:

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

Definition at line 776 of file RelAlgDagBuilder.h.

References CHECK, and context_data_.

776  {
778  context_data_ = context_data;
779  }
const RaExecutionDesc * context_data_
#define CHECK(condition)
Definition: Logger.h:223
void RelAlgNode::setIdInPlanTree ( size_t  id) const
inline

Definition at line 802 of file RelAlgDagBuilder.h.

References id_in_plan_tree_.

802 { id_in_plan_tree_ = id; }
std::optional< size_t > id_in_plan_tree_
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 785 of file RelAlgDagBuilder.h.

References query_plan_dag_, and query_plan_dag_hash_.

Referenced by QueryPlanDagExtractor::extractQueryPlanDag().

785  {
786  if (!extracted_query_plan_dag.empty()) {
787  query_plan_dag_ = extracted_query_plan_dag;
788  query_plan_dag_hash_ = boost::hash_value(extracted_query_plan_dag);
789  }
790  }
std::string query_plan_dag_
size_t query_plan_dag_hash_

+ Here is the caller graph for this function:

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

Definition at line 846 of file RelAlgDagBuilder.h.

References dag_node_id_.

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

846 { dag_node_id_ = id; }
size_t dag_node_id_

+ 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(), RelAlgDagBuilder::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 881 of file RelAlgDagBuilder.h.

Referenced by resetRelAlgFirstId().

size_t RelAlgNode::dag_node_id_
mutableprivate

Definition at line 882 of file RelAlgDagBuilder.h.

Referenced by getRelNodeDagId(), and setRelNodeDagId().

const unsigned RelAlgNode::id_
protected

Definition at line 873 of file RelAlgDagBuilder.h.

Referenced by getId().

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

Definition at line 874 of file RelAlgDagBuilder.h.

Referenced by getIdInPlanTree(), and setIdInPlanTree().

bool RelAlgNode::is_nop_
private

Definition at line 879 of file RelAlgDagBuilder.h.

Referenced by isNop(), and markAsNop().

std::string RelAlgNode::query_plan_dag_
mutableprivate

Definition at line 883 of file RelAlgDagBuilder.h.

Referenced by getQueryPlanDag(), and setQueryPlanDag().

size_t RelAlgNode::query_plan_dag_hash_
mutableprivate

Definition at line 884 of file RelAlgDagBuilder.h.

Referenced by getQueryPlanDagHash(), and setQueryPlanDag().

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

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