OmniSciDB  2c44a3935d
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)
 
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 1104 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

◆ RelJoin()

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

1110  : condition_(std::move(condition))
1111  , join_type_(join_type)
1112  , hint_applied_(false)
1113  , hints_(std::make_unique<Hints>()) {
1114  inputs_.push_back(lhs);
1115  inputs_.push_back(rhs);
1116  }
std::unique_ptr< const RexScalar > condition_
const JoinType join_type_
bool hint_applied_
std::unique_ptr< Hints > hints_
RelAlgInputs inputs_

Member Function Documentation

◆ addHint()

void RelJoin::addHint ( const HintExplained hint_explained)
inline

Definition at line 1144 of file RelAlgDagBuilder.h.

References HintExplained::getHintName().

1144  {
1145  if (!hint_applied_) {
1146  hint_applied_ = true;
1147  }
1148  hints_->emplace(hint_explained.getHintName(), hint_explained);
1149  }
bool hint_applied_
std::unique_ptr< Hints > hints_
const std::string & getHintName() const
+ Here is the call graph for this function:

◆ deepCopy()

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

Implements RelAlgNode.

Definition at line 385 of file RelAlgDagBuilder.cpp.

References RelAlgNode::inputs_, and RexVisitorBase< T >::visit().

385  {
386  RexDeepCopyVisitor copier;
387  auto condition_copy = copier.visit(condition_.get());
388  if (hint_applied_) {
389  auto copied =
390  std::make_shared<RelJoin>(inputs_[0], inputs_[1], condition_copy, join_type_);
391  for (auto& kv : *hints_) {
392  copied->addHint(kv.second);
393  }
394  return copied;
395  }
396  return std::make_shared<RelJoin>(inputs_[0], inputs_[1], condition_copy, join_type_);
397 }
std::unique_ptr< const RexScalar > condition_
const JoinType join_type_
bool hint_applied_
std::unique_ptr< Hints > hints_
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
RelAlgInputs inputs_
+ Here is the call graph for this function:

◆ getAndReleaseCondition()

const RexScalar* RelJoin::getAndReleaseCondition ( ) const
inline

Definition at line 1122 of file RelAlgDagBuilder.h.

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

◆ getCondition()

const RexScalar* RelJoin::getCondition ( ) const
inline

Definition at line 1120 of file RelAlgDagBuilder.h.

Referenced by anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitJoin().

1120 { 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 1158 of file RelAlgDagBuilder.h.

References CHECK.

1158  {
1160  CHECK(!hints_->empty());
1161  CHECK(hasHintEnabled(hint_name));
1162  return hints_->at(hint_name);
1163  }
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 1118 of file RelAlgDagBuilder.h.

1118 { return join_type_; }
const JoinType join_type_

◆ hasHintEnabled()

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

Definition at line 1151 of file RelAlgDagBuilder.h.

1151  {
1152  if (hint_applied_ && !hints_->empty()) {
1153  return hints_->find(candidate_hint_name) != hints_->end();
1154  }
1155  return false;
1156  }
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 306 of file RelAlgDagBuilder.cpp.

References RelAlgNode::replaceInput().

Referenced by create_left_deep_join().

307  {
308  RelAlgNode::replaceInput(old_input, input);
309  RexRebindInputsVisitor rebind_inputs(old_input.get(), input.get());
310  if (condition_) {
311  rebind_inputs.visit(condition_.get());
312  }
313 }
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 1124 of file RelAlgDagBuilder.h.

References CHECK.

1124  {
1125  CHECK(condition);
1126  condition_ = std::move(condition);
1127  }
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 1140 of file RelAlgDagBuilder.h.

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

◆ toString()

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

Implements RelAlgNode.

Definition at line 1132 of file RelAlgDagBuilder.h.

References run_benchmark_import::result, and to_string().

1132  {
1133  std::string result =
1134  "(RelJoin<" + std::to_string(reinterpret_cast<uint64_t>(this)) + ">(";
1135  result += condition_ ? condition_->toString() : "null";
1136  result += " " + std::to_string(static_cast<int>(join_type_));
1137  return result + "))";
1138  }
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 1166 of file RelAlgDagBuilder.h.

◆ hint_applied_

bool RelJoin::hint_applied_
private

Definition at line 1168 of file RelAlgDagBuilder.h.

◆ hints_

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

Definition at line 1169 of file RelAlgDagBuilder.h.

◆ join_type_

const JoinType RelJoin::join_type_
private

Definition at line 1167 of file RelAlgDagBuilder.h.


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