OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RelJoin Class Reference

#include <RelAlgDagBuilder.h>

+ Inheritance diagram for RelJoin:
+ Collaboration diagram for RelJoin:

Public Member Functions

 RelJoin (std::shared_ptr< const RelAlgNode > lhs, std::shared_ptr< const RelAlgNode > rhs, std::unique_ptr< const RexScalar > &condition, const JoinType join_type)
 
 RelJoin (RelJoin const &)
 
JoinType getJoinType () const
 
const RexScalargetCondition () const
 
const RexScalargetAndReleaseCondition () const
 
void setCondition (std::unique_ptr< const RexScalar > &condition)
 
void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input) override
 
std::string toString () const override
 
size_t size () const override
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
void addHint (const HintExplained &hint_explained)
 
const bool hasHintEnabled (const std::string &candidate_hint_name) const
 
const HintExplainedgetHintInfo (const std::string &hint_name) const
 
- Public Member Functions inherited from RelAlgNode
 RelAlgNode (RelAlgInputs inputs={})
 
virtual ~RelAlgNode ()
 
void resetQueryExecutionState ()
 
void setContextData (const void *context_data) const
 
void setOutputMetainfo (const std::vector< TargetMetaInfo > &targets_metainfo) const
 
const std::vector
< TargetMetaInfo > & 
getOutputMetainfo () const
 
unsigned getId () const
 
bool hasContextData () const
 
const void * getContextData () 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
 
bool isNop () const
 
void markAsNop ()
 
void clearContextData () const
 

Private Attributes

std::unique_ptr< const RexScalarcondition_
 
const JoinType join_type_
 
bool hint_applied_
 
std::unique_ptr< Hintshints_
 

Additional Inherited Members

- Static Public Member Functions inherited from RelAlgNode
static void resetRelAlgFirstId () noexcept
 
- Protected Attributes inherited from RelAlgNode
RelAlgInputs inputs_
 
const unsigned id_
 

Detailed Description

Definition at line 1123 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

RelJoin::RelJoin ( std::shared_ptr< const RelAlgNode lhs,
std::shared_ptr< const RelAlgNode rhs,
std::unique_ptr< const RexScalar > &  condition,
const JoinType  join_type 
)
inline

Definition at line 1125 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

1129  : condition_(std::move(condition))
1130  , join_type_(join_type)
1131  , hint_applied_(false)
1132  , hints_(std::make_unique<Hints>()) {
1133  inputs_.push_back(lhs);
1134  inputs_.push_back(rhs);
1135  }
std::unique_ptr< const RexScalar > condition_
const JoinType join_type_
bool hint_applied_
std::unique_ptr< Hints > hints_
RelAlgInputs inputs_
RelJoin::RelJoin ( RelJoin const &  rhs)

Definition at line 381 of file RelAlgDagBuilder.cpp.

References addHint(), condition_, hint_applied_, hints_, and RexVisitorBase< T >::visit().

382  : RelAlgNode(rhs)
383  , join_type_(rhs.join_type_)
384  , hint_applied_(false)
385  , hints_(std::make_unique<Hints>()) {
386  RexDeepCopyVisitor copier;
387  condition_ = copier.visit(rhs.condition_.get());
388  if (rhs.hint_applied_) {
389  for (auto const& kv : *rhs.hints_) {
390  addHint(kv.second);
391  }
392  }
393 }
std::unique_ptr< const RexScalar > condition_
RelAlgNode(RelAlgInputs inputs={})
const JoinType join_type_
bool hint_applied_
void addHint(const HintExplained &hint_explained)
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
std::unique_ptr< Hints > hints_

+ Here is the call graph for this function:

Member Function Documentation

void RelJoin::addHint ( const HintExplained hint_explained)
inline

Definition at line 1169 of file RelAlgDagBuilder.h.

References HintExplained::getHintName(), hint_applied_, and hints_.

Referenced by RelJoin().

1169  {
1170  if (!hint_applied_) {
1171  hint_applied_ = true;
1172  }
1173  hints_->emplace(hint_explained.getHintName(), hint_explained);
1174  }
bool hint_applied_
std::unique_ptr< Hints > hints_
const std::string & getHintName() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::shared_ptr<RelAlgNode> RelJoin::deepCopy ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1165 of file RelAlgDagBuilder.h.

1165  {
1166  return std::make_shared<RelJoin>(*this);
1167  }
const RexScalar* RelJoin::getAndReleaseCondition ( ) const
inline

Definition at line 1143 of file RelAlgDagBuilder.h.

References condition_.

1143 { return condition_.release(); }
std::unique_ptr< const RexScalar > condition_
const RexScalar* RelJoin::getCondition ( ) const
inline

Definition at line 1141 of file RelAlgDagBuilder.h.

References condition_.

Referenced by RelRexDagVisitor::visit(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitJoin().

1141 { return condition_.get(); }
std::unique_ptr< const RexScalar > condition_

+ Here is the caller graph for this function:

const HintExplained& RelJoin::getHintInfo ( const std::string &  hint_name) const
inline

Definition at line 1183 of file RelAlgDagBuilder.h.

References CHECK, hasHintEnabled(), hint_applied_, and hints_.

1183  {
1185  CHECK(!hints_->empty());
1186  CHECK(hasHintEnabled(hint_name));
1187  return hints_->at(hint_name);
1188  }
bool hint_applied_
std::unique_ptr< Hints > hints_
#define CHECK(condition)
Definition: Logger.h:197
const bool hasHintEnabled(const std::string &candidate_hint_name) const

+ Here is the call graph for this function:

JoinType RelJoin::getJoinType ( ) const
inline

Definition at line 1139 of file RelAlgDagBuilder.h.

References join_type_.

1139 { return join_type_; }
const JoinType join_type_
const bool RelJoin::hasHintEnabled ( const std::string &  candidate_hint_name) const
inline

Definition at line 1176 of file RelAlgDagBuilder.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1176  {
1177  if (hint_applied_ && !hints_->empty()) {
1178  return hints_->find(candidate_hint_name) != hints_->end();
1179  }
1180  return false;
1181  }
bool hint_applied_
std::unique_ptr< Hints > hints_

+ Here is the caller graph for this function:

void RelJoin::replaceInput ( std::shared_ptr< const RelAlgNode old_input,
std::shared_ptr< const RelAlgNode input 
)
overridevirtual

Reimplemented from RelAlgNode.

Definition at line 309 of file RelAlgDagBuilder.cpp.

References condition_, and RelAlgNode::replaceInput().

Referenced by create_left_deep_join().

310  {
311  RelAlgNode::replaceInput(old_input, input);
312  RexRebindInputsVisitor rebind_inputs(old_input.get(), input.get());
313  if (condition_) {
314  rebind_inputs.visit(condition_.get());
315  }
316 }
std::unique_ptr< const RexScalar > condition_
virtual void replaceInput(std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void RelJoin::setCondition ( std::unique_ptr< const RexScalar > &  condition)
inline

Definition at line 1145 of file RelAlgDagBuilder.h.

References CHECK, and condition_.

1145  {
1146  CHECK(condition);
1147  condition_ = std::move(condition);
1148  }
std::unique_ptr< const RexScalar > condition_
#define CHECK(condition)
Definition: Logger.h:197
size_t RelJoin::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1163 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

1163 { return inputs_[0]->size() + inputs_[1]->size(); }
RelAlgInputs inputs_
std::string RelJoin::toString ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1153 of file RelAlgDagBuilder.h.

References cat(), condition_, RelAlgNode::inputs_, join_type_, and to_string().

1153  {
1154  return cat(::typeName(this),
1155  "(",
1156  ::toString(inputs_),
1157  ", condition=",
1158  (condition_ ? condition_->toString() : "null"),
1159  ", join_type=",
1160  std::to_string(static_cast<int>(join_type_)));
1161  }
std::unique_ptr< const RexScalar > condition_
std::string cat(Ts &&...args)
const JoinType join_type_
std::string to_string(char const *&&v)
std::string toString() const override
RelAlgInputs inputs_

+ Here is the call graph for this function:

Member Data Documentation

std::unique_ptr<const RexScalar> RelJoin::condition_
mutableprivate
bool RelJoin::hint_applied_
private

Definition at line 1193 of file RelAlgDagBuilder.h.

Referenced by addHint(), getHintInfo(), hasHintEnabled(), and RelJoin().

std::unique_ptr<Hints> RelJoin::hints_
private

Definition at line 1194 of file RelAlgDagBuilder.h.

Referenced by addHint(), getHintInfo(), hasHintEnabled(), and RelJoin().

const JoinType RelJoin::join_type_
private

Definition at line 1192 of file RelAlgDagBuilder.h.

Referenced by getJoinType(), and toString().


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