OmniSciDB  d2f719934e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 toHash () const override
 
size_t size () const override
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
void addHint (const ExplainedQueryHint &hint_explained)
 
const bool hasHintEnabled (QueryHint candidate_hint) const
 
const ExplainedQueryHintgetHintInfo (QueryHint hint) const
 
bool hasDeliveredHint ()
 
HintsgetDeliveredHints ()
 
- Public Member Functions inherited from RelAlgNode
 RelAlgNode (RelAlgInputs inputs={})
 
virtual ~RelAlgNode ()
 
void resetQueryExecutionState ()
 
void setContextData (const RaExecutionDesc *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 RaExecutionDescgetContextData () 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
 
void setRelNodeDagId (const size_t id) const
 
size_t getRelNodeDagId () 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_
 
std::optional< size_t > hash_
 

Detailed Description

Definition at line 1213 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 1215 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

Referenced by toHash().

1219  : condition_(std::move(condition))
1220  , join_type_(join_type)
1221  , hint_applied_(false)
1222  , hints_(std::make_unique<Hints>()) {
1223  inputs_.push_back(lhs);
1224  inputs_.push_back(rhs);
1225  }
std::unique_ptr< const RexScalar > condition_
const JoinType join_type_
bool hint_applied_
std::unique_ptr< Hints > hints_
RelAlgInputs inputs_

+ Here is the caller graph for this function:

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 ExplainedQueryHint &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 ExplainedQueryHint hint_explained)
inline

Definition at line 1272 of file RelAlgDagBuilder.h.

References ExplainedQueryHint::getHint(), hint_applied_, and hints_.

Referenced by RelJoin().

1272  {
1273  if (!hint_applied_) {
1274  hint_applied_ = true;
1275  }
1276  hints_->emplace(hint_explained.getHint(), hint_explained);
1277  }
bool hint_applied_
std::unique_ptr< Hints > hints_
const QueryHint getHint() const
Definition: QueryHint.h:117

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

1268  {
1269  return std::make_shared<RelJoin>(*this);
1270  }
const RexScalar* RelJoin::getAndReleaseCondition ( ) const
inline

Definition at line 1233 of file RelAlgDagBuilder.h.

References condition_.

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

Definition at line 1231 of file RelAlgDagBuilder.h.

References condition_.

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

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

+ Here is the caller graph for this function:

Hints* RelJoin::getDeliveredHints ( )
inline

Definition at line 1295 of file RelAlgDagBuilder.h.

References hints_.

1295 { return hints_.get(); }
std::unique_ptr< Hints > hints_
const ExplainedQueryHint& RelJoin::getHintInfo ( QueryHint  hint) const
inline

Definition at line 1286 of file RelAlgDagBuilder.h.

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

1286  {
1288  CHECK(!hints_->empty());
1289  CHECK(hasHintEnabled(hint));
1290  return hints_->at(hint);
1291  }
const bool hasHintEnabled(QueryHint candidate_hint) const
bool hint_applied_
std::unique_ptr< Hints > hints_
#define CHECK(condition)
Definition: Logger.h:211

+ Here is the call graph for this function:

JoinType RelJoin::getJoinType ( ) const
inline

Definition at line 1229 of file RelAlgDagBuilder.h.

References join_type_.

Referenced by toHash().

1229 { return join_type_; }
const JoinType join_type_

+ Here is the caller graph for this function:

bool RelJoin::hasDeliveredHint ( )
inline

Definition at line 1293 of file RelAlgDagBuilder.h.

References hints_.

1293 { return !hints_->empty(); }
std::unique_ptr< Hints > hints_
const bool RelJoin::hasHintEnabled ( QueryHint  candidate_hint) const
inline

Definition at line 1279 of file RelAlgDagBuilder.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1279  {
1280  if (hint_applied_ && !hints_->empty()) {
1281  return hints_->find(candidate_hint) != hints_->end();
1282  }
1283  return false;
1284  }
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 1235 of file RelAlgDagBuilder.h.

References CHECK, and condition_.

1235  {
1236  CHECK(condition);
1237  condition_ = std::move(condition);
1238  }
std::unique_ptr< const RexScalar > condition_
#define CHECK(condition)
Definition: Logger.h:211
size_t RelJoin::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1266 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

1266 { return inputs_[0]->size() + inputs_[1]->size(); }
RelAlgInputs inputs_
size_t RelJoin::toHash ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1253 of file RelAlgDagBuilder.h.

References condition_, getJoinType(), RelAlgNode::hash_, RelAlgNode::inputs_, RelJoin(), and toString().

1253  {
1254  if (!hash_) {
1255  hash_ = typeid(RelJoin).hash_code();
1256  boost::hash_combine(*hash_,
1257  condition_ ? condition_->toHash() : boost::hash_value("n"));
1258  for (auto& node : inputs_) {
1259  boost::hash_combine(*hash_, node->toHash());
1260  }
1261  boost::hash_combine(*hash_, ::toString(getJoinType()));
1262  }
1263  return *hash_;
1264  }
std::unique_ptr< const RexScalar > condition_
std::optional< size_t > hash_
std::string toString() const override
JoinType getJoinType() const
RelJoin(std::shared_ptr< const RelAlgNode > lhs, std::shared_ptr< const RelAlgNode > rhs, std::unique_ptr< const RexScalar > &condition, const JoinType join_type)
RelAlgInputs inputs_

+ Here is the call graph for this function:

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

Implements RelAlgNode.

Definition at line 1243 of file RelAlgDagBuilder.h.

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

Referenced by toHash().

1243  {
1244  return cat(::typeName(this),
1245  "(",
1246  ::toString(inputs_),
1247  ", condition=",
1248  (condition_ ? condition_->toString() : "null"),
1249  ", join_type=",
1250  ::toString(join_type_));
1251  }
std::unique_ptr< const RexScalar > condition_
std::string cat(Ts &&...args)
const JoinType join_type_
std::string typeName(const T *v)
Definition: toString.h:93
std::string toString() const override
RelAlgInputs inputs_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 1300 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 1299 of file RelAlgDagBuilder.h.

Referenced by getJoinType(), and toString().


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