OmniSciDB  94e8789169
 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
 
bool hasDeliveredHint ()
 
HintsgetDeliveredHints ()
 
- 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 1136 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 1138 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

1142  : condition_(std::move(condition))
1143  , join_type_(join_type)
1144  , hint_applied_(false)
1145  , hints_(std::make_unique<Hints>()) {
1146  inputs_.push_back(lhs);
1147  inputs_.push_back(rhs);
1148  }
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 1182 of file RelAlgDagBuilder.h.

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

Referenced by RelJoin().

1182  {
1183  if (!hint_applied_) {
1184  hint_applied_ = true;
1185  }
1186  hints_->emplace(hint_explained.getHintName(), hint_explained);
1187  }
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 1178 of file RelAlgDagBuilder.h.

1178  {
1179  return std::make_shared<RelJoin>(*this);
1180  }
const RexScalar* RelJoin::getAndReleaseCondition ( ) const
inline

Definition at line 1156 of file RelAlgDagBuilder.h.

References condition_.

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

Definition at line 1154 of file RelAlgDagBuilder.h.

References condition_.

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

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

+ Here is the caller graph for this function:

Hints* RelJoin::getDeliveredHints ( )
inline

Definition at line 1205 of file RelAlgDagBuilder.h.

References hints_.

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

1205 { return hints_.get(); }
std::unique_ptr< Hints > hints_

+ Here is the caller graph for this function:

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

Definition at line 1196 of file RelAlgDagBuilder.h.

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

1196  {
1198  CHECK(!hints_->empty());
1199  CHECK(hasHintEnabled(hint_name));
1200  return hints_->at(hint_name);
1201  }
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 1152 of file RelAlgDagBuilder.h.

References join_type_.

1152 { return join_type_; }
const JoinType join_type_
bool RelJoin::hasDeliveredHint ( )
inline

Definition at line 1203 of file RelAlgDagBuilder.h.

References hints_.

1203 { return !hints_->empty(); }
std::unique_ptr< Hints > hints_
const bool RelJoin::hasHintEnabled ( const std::string &  candidate_hint_name) const
inline

Definition at line 1189 of file RelAlgDagBuilder.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1189  {
1190  if (hint_applied_ && !hints_->empty()) {
1191  return hints_->find(candidate_hint_name) != hints_->end();
1192  }
1193  return false;
1194  }
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 1158 of file RelAlgDagBuilder.h.

References CHECK, and condition_.

1158  {
1159  CHECK(condition);
1160  condition_ = std::move(condition);
1161  }
std::unique_ptr< const RexScalar > condition_
#define CHECK(condition)
Definition: Logger.h:197
size_t RelJoin::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1176 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

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

Implements RelAlgNode.

Definition at line 1166 of file RelAlgDagBuilder.h.

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

1166  {
1167  return cat(::typeName(this),
1168  "(",
1169  ::toString(inputs_),
1170  ", condition=",
1171  (condition_ ? condition_->toString() : "null"),
1172  ", join_type=",
1173  std::to_string(static_cast<int>(join_type_)));
1174  }
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 1210 of file RelAlgDagBuilder.h.

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

std::unique_ptr<Hints> RelJoin::hints_
private
const JoinType RelJoin::join_type_
private

Definition at line 1209 of file RelAlgDagBuilder.h.

Referenced by getJoinType(), and toString().


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