OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RelLeftDeepInnerJoin Class Reference

#include <RelAlgDag.h>

+ Inheritance diagram for RelLeftDeepInnerJoin:
+ Collaboration diagram for RelLeftDeepInnerJoin:

Public Member Functions

 RelLeftDeepInnerJoin ()=default
 
 RelLeftDeepInnerJoin (const std::shared_ptr< RelFilter > &filter, RelAlgInputs inputs, std::vector< std::shared_ptr< const RelJoin >> &original_joins)
 
virtual void acceptChildren (Visitor &v) const override
 
virtual void accept (Visitor &v, std::string name) const override
 
const RexScalargetInnerCondition () const
 
const RexScalargetOuterCondition (const size_t nesting_level) const
 
const JoinType getJoinType (const size_t nesting_level) const
 
std::string toString (RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
 
size_t size () const override
 
virtual size_t getOuterConditionsSize () const
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
bool coversOriginalNode (const RelAlgNode *node) const
 
const RelFiltergetOriginalFilter () const
 
std::vector< std::shared_ptr
< const RelJoin > > 
getOriginalJoins () const
 
virtual size_t toHash () const override
 
- Public Member Functions inherited from RelAlgNode
 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 ()
 
void clearContextData () const
 
- Public Member Functions inherited from RelAlgDagNode
 RelAlgDagNode ()
 
virtual size_t getStepNumber () const
 
virtual void setStepNumber (size_t step) const
 
std::optional< size_t > getIdInPlanTree () const
 
void setIdInPlanTree (size_t id) const
 

Private Attributes

std::unique_ptr< const RexScalarcondition_
 
std::vector< std::unique_ptr
< const RexScalar > > 
outer_conditions_per_level_
 
std::shared_ptr< RelFilteroriginal_filter_
 
std::vector< std::shared_ptr
< const RelJoin > > 
original_joins_
 

Friends

struct RelAlgDagSerializer
 
std::size_t hash_value (RelLeftDeepInnerJoin const &)
 

Additional Inherited Members

- Static Public Member Functions inherited from RelAlgNode
static void resetRelAlgFirstId () noexcept
 
- Protected Attributes inherited from RelAlgNode
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_
 

Detailed Description

Definition at line 1951 of file RelAlgDag.h.

Constructor & Destructor Documentation

RelLeftDeepInnerJoin::RelLeftDeepInnerJoin ( )
default
RelLeftDeepInnerJoin::RelLeftDeepInnerJoin ( const std::shared_ptr< RelFilter > &  filter,
RelAlgInputs  inputs,
std::vector< std::shared_ptr< const RelJoin >> &  original_joins 
)

Member Function Documentation

virtual void RelLeftDeepInnerJoin::accept ( Visitor v,
std::string  name 
) const
inlineoverridevirtual

Implements RelAlgDagNode.

Definition at line 1975 of file RelAlgDag.h.

References acceptChildren(), and RelAlgDagNode::Visitor::visit().

Referenced by TableFunctionsFactory_node.PrintNode::__str__().

1975  {
1976  if (v.visit(this, std::move(name))) {
1977  acceptChildren(v);
1978  }
1979  }
virtual void acceptChildren(Visitor &v) const override
Definition: RelAlgDag.h:1960
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void RelLeftDeepInnerJoin::acceptChildren ( Visitor v) const
inlineoverridevirtual

Implements RelAlgDagNode.

Definition at line 1960 of file RelAlgDag.h.

References RelAlgDagNode::accept(), getInnerCondition(), RelAlgNode::getInputs(), getOuterCondition(), getOuterConditionsSize(), and anonymous_namespace{Utm.h}::n.

Referenced by accept().

1960  {
1961  if (getInnerCondition()) {
1962  getInnerCondition()->accept(v, "inner condition");
1963  }
1964  for (size_t level = 1; level <= getOuterConditionsSize(); ++level) {
1965  if (getOuterCondition(level)) {
1966  getOuterCondition(level)->accept(v, "outer condition");
1967  }
1968  }
1969  for (auto& n : getInputs()) {
1970  if (n) {
1971  n->accept(v, "input");
1972  }
1973  }
1974  }
const RexScalar * getOuterCondition(const size_t nesting_level) const
virtual size_t getOuterConditionsSize() const
virtual void accept(Visitor &v, std::string name) const =0
const std::vector< RelAlgNode const * > getInputs() const
Definition: RelAlgDag.h:882
const RexScalar * getInnerCondition() const
constexpr double n
Definition: Utm.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool RelLeftDeepInnerJoin::coversOriginalNode ( const RelAlgNode node) const

Definition at line 149 of file RelLeftDeepInnerJoin.cpp.

References original_filter_, and original_joins_.

149  {
150  if (node == original_filter_.get()) {
151  return true;
152  }
153  for (const auto& original_join : original_joins_) {
154  if (original_join.get() == node) {
155  return true;
156  }
157  }
158  return false;
159 }
std::shared_ptr< RelFilter > original_filter_
Definition: RelAlgDag.h:2008
std::vector< std::shared_ptr< const RelJoin > > original_joins_
Definition: RelAlgDag.h:2009
std::shared_ptr< RelAlgNode > RelLeftDeepInnerJoin::deepCopy ( ) const
overridevirtual

Implements RelAlgNode.

Definition at line 144 of file RelLeftDeepInnerJoin.cpp.

References CHECK.

144  {
145  CHECK(false);
146  return nullptr;
147 }
#define CHECK(condition)
Definition: Logger.h:291
const RexScalar * RelLeftDeepInnerJoin::getInnerCondition ( ) const

Definition at line 91 of file RelLeftDeepInnerJoin.cpp.

References condition_.

Referenced by acceptChildren(), RelAlgExecutor::translateLeftDeepJoinFilter(), RelRexDagVisitor::visit(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitLeftDeepInnerJoin().

91  {
92  return condition_.get();
93 }
std::unique_ptr< const RexScalar > condition_
Definition: RelAlgDag.h:2006

+ Here is the caller graph for this function:

const JoinType RelLeftDeepInnerJoin::getJoinType ( const size_t  nesting_level) const

Definition at line 105 of file RelLeftDeepInnerJoin.cpp.

References CHECK_LE, and original_joins_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::left_deep_join_types().

105  {
106  CHECK_LE(nesting_level, original_joins_.size());
107  return original_joins_[original_joins_.size() - nesting_level]->getJoinType();
108 }
std::vector< std::shared_ptr< const RelJoin > > original_joins_
Definition: RelAlgDag.h:2009
#define CHECK_LE(x, y)
Definition: Logger.h:304

+ Here is the caller graph for this function:

const RelFilter * RelLeftDeepInnerJoin::getOriginalFilter ( ) const

Definition at line 161 of file RelLeftDeepInnerJoin.cpp.

References original_filter_.

161  {
162  return original_filter_.get();
163 }
std::shared_ptr< RelFilter > original_filter_
Definition: RelAlgDag.h:2008
std::vector< std::shared_ptr< const RelJoin > > RelLeftDeepInnerJoin::getOriginalJoins ( ) const

Definition at line 165 of file RelLeftDeepInnerJoin.cpp.

References original_joins_.

166  {
167  std::vector<std::shared_ptr<const RelJoin>> original_joins;
168  original_joins.assign(original_joins_.begin(), original_joins_.end());
169  return original_joins;
170 }
std::vector< std::shared_ptr< const RelJoin > > original_joins_
Definition: RelAlgDag.h:2009
const RexScalar * RelLeftDeepInnerJoin::getOuterCondition ( const size_t  nesting_level) const

Definition at line 95 of file RelLeftDeepInnerJoin.cpp.

References CHECK_GE, CHECK_LE, and outer_conditions_per_level_.

Referenced by acceptChildren(), QueryPlanDagExtractor::handleLeftDeepJoinTree(), anonymous_namespace{RelAlgExecutor.cpp}::left_deep_join_types(), RelAlgExecutor::translateLeftDeepJoinFilter(), RelRexDagVisitor::visit(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitLeftDeepInnerJoin().

96  {
97  CHECK_GE(nesting_level, size_t(1));
98  CHECK_LE(nesting_level, outer_conditions_per_level_.size());
99  // Outer join conditions are collected depth-first while the returned condition
100  // must be consistent with the order of the loops (which is reverse depth-first).
101  return outer_conditions_per_level_[outer_conditions_per_level_.size() - nesting_level]
102  .get();
103 }
std::vector< std::unique_ptr< const RexScalar > > outer_conditions_per_level_
Definition: RelAlgDag.h:2007
#define CHECK_GE(x, y)
Definition: Logger.h:306
#define CHECK_LE(x, y)
Definition: Logger.h:304

+ Here is the caller graph for this function:

size_t RelLeftDeepInnerJoin::getOuterConditionsSize ( ) const
virtual

Definition at line 140 of file RelLeftDeepInnerJoin.cpp.

References outer_conditions_per_level_.

Referenced by acceptChildren().

140  {
141  return outer_conditions_per_level_.size();
142 }
std::vector< std::unique_ptr< const RexScalar > > outer_conditions_per_level_
Definition: RelAlgDag.h:2007

+ Here is the caller graph for this function:

size_t RelLeftDeepInnerJoin::size ( ) const
overridevirtual

Implements RelAlgNode.

Definition at line 132 of file RelLeftDeepInnerJoin.cpp.

References RelAlgNode::inputs_.

132  {
133  size_t total_size = 0;
134  for (const auto& input : inputs_) {
135  total_size += input->size();
136  }
137  return total_size;
138 }
RelAlgInputs inputs_
Definition: RelAlgDag.h:945
virtual size_t RelLeftDeepInnerJoin::toHash ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 2001 of file RelAlgDag.h.

References hash_value.

2001 { return hash_value(*this); }
friend std::size_t hash_value(RelLeftDeepInnerJoin const &)
Definition: RelAlgDag.cpp:3763
std::string RelLeftDeepInnerJoin::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
overridevirtual

Implements RelAlgNode.

Definition at line 110 of file RelLeftDeepInnerJoin.cpp.

References RelRexToStringConfig::attributes_only, condition_, RelAlgNode::inputs_, RelRexToStringConfig::skip_input_nodes, to_string(), and typeName().

110  {
111  if (!config.attributes_only) {
112  std::string ret = ::typeName(this) + "(";
113  ret += condition_->toString(config);
114  if (!config.skip_input_nodes) {
115  for (const auto& input : inputs_) {
116  ret += " " + input->toString(config);
117  }
118  } else {
119  ret += ", input node id={";
120  for (auto& input : inputs_) {
121  ret += std::to_string(input->getId()) + " ";
122  }
123  ret += "}";
124  }
125  ret += ")";
126  return ret;
127  } else {
128  return ::typeName(this) + "()";
129  }
130 }
std::string to_string(char const *&&v)
std::string typeName(const T *v)
Definition: toString.h:106
std::unique_ptr< const RexScalar > condition_
Definition: RelAlgDag.h:2006
RelAlgInputs inputs_
Definition: RelAlgDag.h:945

+ Here is the call graph for this function:

Friends And Related Function Documentation

std::size_t hash_value ( RelLeftDeepInnerJoin const &  rel_join)
friend

Definition at line 3763 of file RelAlgDag.cpp.

Referenced by toHash().

3763  {
3764  if (rel_join.hash_) {
3765  return *rel_join.hash_;
3766  }
3767  rel_join.hash_ = typeid(RelLeftDeepInnerJoin).hash_code();
3768  boost::hash_combine(*rel_join.hash_, rel_join.condition_);
3769  boost::hash_combine(*rel_join.hash_, rel_join.outer_conditions_per_level_);
3770  boost::hash_combine(*rel_join.hash_, rel_join.original_filter_);
3771  boost::hash_combine(*rel_join.hash_, rel_join.inputs_);
3772  return *rel_join.hash_;
3773 }
RelLeftDeepInnerJoin()=default
friend struct RelAlgDagSerializer
friend

Definition at line 2011 of file RelAlgDag.h.

Member Data Documentation

std::unique_ptr<const RexScalar> RelLeftDeepInnerJoin::condition_
private

Definition at line 2006 of file RelAlgDag.h.

Referenced by getInnerCondition(), hash_value(), and toString().

std::shared_ptr<RelFilter> RelLeftDeepInnerJoin::original_filter_
private

Definition at line 2008 of file RelAlgDag.h.

Referenced by coversOriginalNode(), getOriginalFilter(), and hash_value().

std::vector<std::shared_ptr<const RelJoin> > RelLeftDeepInnerJoin::original_joins_
private

Definition at line 2009 of file RelAlgDag.h.

Referenced by coversOriginalNode(), getJoinType(), and getOriginalJoins().

std::vector<std::unique_ptr<const RexScalar> > RelLeftDeepInnerJoin::outer_conditions_per_level_
private

Definition at line 2007 of file RelAlgDag.h.

Referenced by getOuterCondition(), getOuterConditionsSize(), and hash_value().


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