OmniSciDB  8a228a1076
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 ()
 

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

Constructor & Destructor Documentation

◆ RelJoin() [1/2]

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

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

◆ RelJoin() [2/2]

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)
std::unique_ptr< Hints > hints_
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
+ Here is the call graph for this function:

Member Function Documentation

◆ addHint()

void RelJoin::addHint ( const HintExplained hint_explained)
inline

Definition at line 1165 of file RelAlgDagBuilder.h.

References HintExplained::getHintName().

Referenced by RelJoin().

1165  {
1166  if (!hint_applied_) {
1167  hint_applied_ = true;
1168  }
1169  hints_->emplace(hint_explained.getHintName(), hint_explained);
1170  }
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:

◆ deepCopy()

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

Implements RelAlgNode.

Definition at line 1161 of file RelAlgDagBuilder.h.

1161  {
1162  return std::make_shared<RelJoin>(*this);
1163  }

◆ getAndReleaseCondition()

const RexScalar* RelJoin::getAndReleaseCondition ( ) const
inline

Definition at line 1141 of file RelAlgDagBuilder.h.

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

◆ getCondition()

const RexScalar* RelJoin::getCondition ( ) const
inline

Definition at line 1139 of file RelAlgDagBuilder.h.

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

1139 { return condition_.get(); }
std::unique_ptr< const RexScalar > condition_
+ Here is the caller graph for this function:

◆ getHintInfo()

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

Definition at line 1179 of file RelAlgDagBuilder.h.

References CHECK.

1179  {
1181  CHECK(!hints_->empty());
1182  CHECK(hasHintEnabled(hint_name));
1183  return hints_->at(hint_name);
1184  }
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

◆ getJoinType()

JoinType RelJoin::getJoinType ( ) const
inline

Definition at line 1137 of file RelAlgDagBuilder.h.

1137 { return join_type_; }
const JoinType join_type_

◆ hasHintEnabled()

const bool RelJoin::hasHintEnabled ( const std::string &  candidate_hint_name) const
inline

Definition at line 1172 of file RelAlgDagBuilder.h.

1172  {
1173  if (hint_applied_ && !hints_->empty()) {
1174  return hints_->find(candidate_hint_name) != hints_->end();
1175  }
1176  return false;
1177  }
bool hint_applied_
std::unique_ptr< Hints > hints_

◆ replaceInput()

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 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:

◆ setCondition()

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

Definition at line 1143 of file RelAlgDagBuilder.h.

References CHECK.

1143  {
1144  CHECK(condition);
1145  condition_ = std::move(condition);
1146  }
std::unique_ptr< const RexScalar > condition_
#define CHECK(condition)
Definition: Logger.h:197

◆ size()

size_t RelJoin::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1159 of file RelAlgDagBuilder.h.

1159 { return inputs_[0]->size() + inputs_[1]->size(); }
RelAlgInputs inputs_

◆ toString()

std::string RelJoin::toString ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1151 of file RelAlgDagBuilder.h.

References run_benchmark_import::result, and to_string().

1151  {
1152  std::string result =
1153  "(RelJoin<" + std::to_string(reinterpret_cast<uint64_t>(this)) + ">(";
1154  result += condition_ ? condition_->toString() : "null";
1155  result += " " + std::to_string(static_cast<int>(join_type_));
1156  return result + "))";
1157  }
std::unique_ptr< const RexScalar > condition_
const JoinType join_type_
std::string to_string(char const *&&v)
+ Here is the call graph for this function:

Member Data Documentation

◆ condition_

std::unique_ptr<const RexScalar> RelJoin::condition_
mutableprivate

Definition at line 1187 of file RelAlgDagBuilder.h.

Referenced by RelJoin().

◆ hint_applied_

bool RelJoin::hint_applied_
private

Definition at line 1189 of file RelAlgDagBuilder.h.

Referenced by RelJoin().

◆ hints_

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

Definition at line 1190 of file RelAlgDagBuilder.h.

Referenced by RelJoin().

◆ join_type_

const JoinType RelJoin::join_type_
private

Definition at line 1188 of file RelAlgDagBuilder.h.


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