OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RelFilter Class Reference

#include <RelAlgDag.h>

+ Inheritance diagram for RelFilter:
+ Collaboration diagram for RelFilter:

Public Member Functions

 RelFilter (std::unique_ptr< const RexScalar > &filter, std::shared_ptr< const RelAlgNode > input)
 
 RelFilter (std::unique_ptr< const RexScalar > &filter)
 
 RelFilter (RelFilter const &)
 
const RexScalargetCondition () const
 
const RexScalargetAndReleaseCondition ()
 
void setCondition (std::unique_ptr< const RexScalar > &condition)
 
size_t size () const override
 
void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input) override
 
std::string toString (RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
 
size_t toHash () const override
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
- 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
 
void setQueryPlanDag (const std::string &extracted_query_plan_dag) const
 
std::string getQueryPlanDag () const
 
size_t getQueryPlanDagHash () const
 
const std::vector
< TargetMetaInfo > & 
getOutputMetainfo () const
 
unsigned getId () const
 
void setIdInPlanTree (size_t id) const
 
std::optional< size_t > getIdInPlanTree () 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 RexScalarfilter_
 

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 > id_in_plan_tree_
 
std::optional< size_t > hash_
 

Detailed Description

Definition at line 1565 of file RelAlgDag.h.

Constructor & Destructor Documentation

RelFilter::RelFilter ( std::unique_ptr< const RexScalar > &  filter,
std::shared_ptr< const RelAlgNode input 
)
inline

Definition at line 1567 of file RelAlgDag.h.

References CHECK, filter_, and RelAlgNode::inputs_.

Referenced by toHash().

1569  : filter_(std::move(filter)) {
1570  CHECK(filter_);
1571  inputs_.push_back(input);
1572  }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630
#define CHECK(condition)
Definition: Logger.h:222
RelAlgInputs inputs_
Definition: RelAlgDag.h:886

+ Here is the caller graph for this function:

RelFilter::RelFilter ( std::unique_ptr< const RexScalar > &  filter)
inline

Definition at line 1575 of file RelAlgDag.h.

References CHECK, and filter_.

1575  : filter_(std::move(filter)) {
1576  CHECK(filter_);
1577  }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630
#define CHECK(condition)
Definition: Logger.h:222
RelFilter::RelFilter ( RelFilter const &  rhs)

Definition at line 577 of file RelAlgDag.cpp.

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

577  : RelAlgNode(rhs) {
578  RexDeepCopyVisitor copier;
579  filter_ = copier.visit(rhs.filter_.get());
580 }
RelAlgNode(RelAlgInputs inputs={})
Definition: RelAlgDag.h:774
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630

+ Here is the call graph for this function:

Member Function Documentation

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

Implements RelAlgNode.

Definition at line 1625 of file RelAlgDag.h.

1625  {
1626  return std::make_shared<RelFilter>(*this);
1627  }
const RexScalar* RelFilter::getAndReleaseCondition ( )
inline

Definition at line 1583 of file RelAlgDag.h.

References filter_.

1583 { return filter_.release(); }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630
const RexScalar* RelFilter::getCondition ( ) const
inline

Definition at line 1581 of file RelAlgDag.h.

References filter_.

Referenced by RelAlgExecutor::createFilterWorkUnit(), hoist_filter_cond_to_cross_join(), RelRexDagVisitor::visit(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitFilter().

1581 { return filter_.get(); }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630

+ Here is the caller graph for this function:

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

Reimplemented from RelAlgNode.

Definition at line 536 of file RelAlgDag.cpp.

References filter_, and RelAlgNode::replaceInput().

537  {
538  RelAlgNode::replaceInput(old_input, input);
539  RexRebindInputsVisitor rebind_inputs(old_input.get(), input.get());
540  rebind_inputs.visit(filter_.get());
541 }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630
virtual void replaceInput(std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input)
Definition: RelAlgDag.h:849

+ Here is the call graph for this function:

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

Definition at line 1585 of file RelAlgDag.h.

References CHECK, and filter_.

Referenced by hoist_filter_cond_to_cross_join().

1585  {
1586  CHECK(condition);
1587  filter_ = std::move(condition);
1588  }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630
#define CHECK(condition)
Definition: Logger.h:222

+ Here is the caller graph for this function:

size_t RelFilter::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1590 of file RelAlgDag.h.

References RelAlgNode::inputs_.

1590 { return inputs_[0]->size(); }
RelAlgInputs inputs_
Definition: RelAlgDag.h:886
size_t RelFilter::toHash ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1614 of file RelAlgDag.h.

References filter_, RelAlgNode::hash_, HASH_N, RelAlgNode::inputs_, and RelFilter().

1614  {
1615  if (!hash_) {
1616  hash_ = typeid(RelFilter).hash_code();
1617  boost::hash_combine(*hash_, filter_ ? filter_->toHash() : HASH_N);
1618  for (auto& node : inputs_) {
1619  boost::hash_combine(*hash_, node->toHash());
1620  }
1621  }
1622  return *hash_;
1623  }
static auto const HASH_N
Definition: RelAlgDag.h:44
RelFilter(std::unique_ptr< const RexScalar > &filter, std::shared_ptr< const RelAlgNode > input)
Definition: RelAlgDag.h:1567
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630
std::optional< size_t > hash_
Definition: RelAlgDag.h:889
RelAlgInputs inputs_
Definition: RelAlgDag.h:886

+ Here is the call graph for this function:

std::string RelFilter::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1595 of file RelAlgDag.h.

References cat(), filter_, RelAlgNode::inputs_, to_string(), and typeName().

1596  {
1597  auto ret =
1598  cat(::typeName(this), "(", (filter_ ? filter_->toString(config) : "null"), ", ");
1599  if (!config.skip_input_nodes) {
1600  ret += ::toString(inputs_);
1601  } else {
1602  ret += ", input node id={";
1603  for (auto& input : inputs_) {
1604  auto node_id_in_plan = input->getIdInPlanTree();
1605  auto node_id_str = node_id_in_plan ? std::to_string(*node_id_in_plan)
1606  : std::to_string(input->getId());
1607  ret += node_id_str + " ";
1608  }
1609  ret += "}";
1610  }
1611  return cat(ret, ")");
1612  }
std::string cat(Ts &&...args)
std::string to_string(char const *&&v)
unsigned getId() const
Definition: RelAlgDag.h:814
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1630
std::string typeName(const T *v)
Definition: toString.h:103
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:1595
RelAlgInputs inputs_
Definition: RelAlgDag.h:886

+ Here is the call graph for this function:

Member Data Documentation

std::unique_ptr<const RexScalar> RelFilter::filter_
private

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