OmniSciDB  a5dc49c757
 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 ()=default
 
 RelFilter (std::unique_ptr< const RexScalar > &filter, std::shared_ptr< const RelAlgNode > input)
 
 RelFilter (std::unique_ptr< const RexScalar > &filter)
 
 RelFilter (RelFilter const &)
 
virtual void acceptChildren (Visitor &v) const override
 
virtual void accept (Visitor &v, std::string name) const override
 
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
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
virtual size_t toHash () const override
 
- Public Member Functions inherited from RelAlgNode
 RelAlgNode (RelAlgInputs inputs={})
 
virtual ~RelAlgNode ()
 
void resetQueryExecutionState ()
 
void setContextData (const RaExecutionDesc *context_data) const
 
void setOutputMetainfo (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
 
bool hasContextData () const
 
const RaExecutionDescgetContextData () const
 
const size_t inputCount () const
 
const RelAlgNodegetInput (const size_t idx) const
 
const std::vector< RelAlgNode
const * > 
getInputs () 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
 
- Public Member Functions inherited from RelAlgDagNode
 RelAlgDagNode ()
 
virtual size_t getStepNumber () const
 
virtual void setStepNumber (size_t step) const
 
std::optional< size_t > getIdInPlanTree () const
 
void setIdInPlanTree (size_t id) const
 

Private Attributes

std::unique_ptr< const RexScalarfilter_
 

Friends

struct RelAlgDagSerializer
 
std::size_t hash_value (RelFilter const &)
 

Additional Inherited Members

- Static Public Member Functions inherited from RelAlgNode
static void resetRelAlgFirstId () noexcept
 
- Protected Attributes inherited from RelAlgNode
RelAlgInputs inputs_
 
unsigned id_
 
std::optional< size_t > hash_
 
- Protected Attributes inherited from RelAlgDagNode
size_t step_ {0}
 
std::optional< size_t > id_in_plan_tree_
 

Detailed Description

Definition at line 1863 of file RelAlgDag.h.

Constructor & Destructor Documentation

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

Definition at line 1868 of file RelAlgDag.h.

References CHECK, filter_, and RelAlgNode::inputs_.

1870  : filter_(std::move(filter)) {
1871  CHECK(filter_);
1872  inputs_.push_back(input);
1873  }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1945
#define CHECK(condition)
Definition: Logger.h:291
RelAlgInputs inputs_
Definition: RelAlgDag.h:945
RelFilter::RelFilter ( std::unique_ptr< const RexScalar > &  filter)
inline

Definition at line 1876 of file RelAlgDag.h.

References CHECK, and filter_.

1876  : filter_(std::move(filter)) {
1877  CHECK(filter_);
1878  }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1945
#define CHECK(condition)
Definition: Logger.h:291
RelFilter::RelFilter ( RelFilter const &  rhs)

Definition at line 579 of file RelAlgDag.cpp.

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

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

+ Here is the call graph for this function:

Member Function Documentation

virtual void RelFilter::accept ( Visitor v,
std::string  name 
) const
inlineoverridevirtual

Implements RelAlgDagNode.

Definition at line 1892 of file RelAlgDag.h.

References acceptChildren(), and RelAlgDagNode::Visitor::visit().

Referenced by TableFunctionsFactory_node.PrintNode::__str__().

1892  {
1893  if (v.visit(this, std::move(name))) {
1894  acceptChildren(v);
1895  }
1896  }
virtual void acceptChildren(Visitor &v) const override
Definition: RelAlgDag.h:1882
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void RelFilter::acceptChildren ( Visitor v) const
inlineoverridevirtual

Implements RelAlgDagNode.

Definition at line 1882 of file RelAlgDag.h.

References RelAlgDagNode::accept(), getCondition(), RelAlgNode::getInputs(), and anonymous_namespace{Utm.h}::n.

Referenced by accept().

1882  {
1883  if (getCondition()) {
1884  getCondition()->accept(v, "condition");
1885  }
1886  for (auto& n : getInputs()) {
1887  if (n) {
1888  n->accept(v, "input");
1889  }
1890  }
1891  }
const RexScalar * getCondition() const
Definition: RelAlgDag.h:1898
virtual void accept(Visitor &v, std::string name) const =0
const std::vector< RelAlgNode const * > getInputs() const
Definition: RelAlgDag.h:882
constexpr double n
Definition: Utm.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements RelAlgNode.

Definition at line 1936 of file RelAlgDag.h.

1936  {
1937  return std::make_shared<RelFilter>(*this);
1938  }
const RexScalar* RelFilter::getAndReleaseCondition ( )
inline

Definition at line 1900 of file RelAlgDag.h.

References filter_.

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

Definition at line 1898 of file RelAlgDag.h.

References filter_.

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

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

+ 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 537 of file RelAlgDag.cpp.

References filter_, and RelAlgNode::replaceInput().

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

+ Here is the call graph for this function:

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

Definition at line 1902 of file RelAlgDag.h.

References CHECK, and filter_.

Referenced by hoist_filter_cond_to_cross_join().

1902  {
1903  CHECK(condition);
1904  filter_ = std::move(condition);
1905  }
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1945
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

size_t RelFilter::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1907 of file RelAlgDag.h.

References RelAlgNode::inputs_.

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

Implements RelAlgNode.

Definition at line 1940 of file RelAlgDag.h.

References hash_value.

1940 { return hash_value(*this); }
friend std::size_t hash_value(RelFilter const &)
Definition: RelAlgDag.cpp:3753
std::string RelFilter::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1912 of file RelAlgDag.h.

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

1913  {
1914  if (!config.attributes_only) {
1915  auto ret = cat(
1916  ::typeName(this), "(", (filter_ ? filter_->toString(config) : "null"), ", ");
1917  if (!config.skip_input_nodes) {
1918  ret += ::toString(inputs_);
1919  } else {
1920  ret += ", input node id={";
1921  for (auto& input : inputs_) {
1922  auto node_id_in_plan = input->getIdInPlanTree();
1923  auto node_id_str = node_id_in_plan ? std::to_string(*node_id_in_plan)
1924  : std::to_string(input->getId());
1925  ret += node_id_str + " ";
1926  }
1927  ret += "}";
1928  }
1929  return cat(ret, ")");
1930  } else {
1931  return cat(
1932  ::typeName(this), "(", (filter_ ? filter_->toString(config) : "null"), ")");
1933  }
1934  }
std::string cat(Ts &&...args)
std::string to_string(char const *&&v)
unsigned getId() const
Definition: RelAlgDag.h:869
std::unique_ptr< const RexScalar > filter_
Definition: RelAlgDag.h:1945
std::string typeName(const T *v)
Definition: toString.h:106
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:1912
RelAlgInputs inputs_
Definition: RelAlgDag.h:945

+ Here is the call graph for this function:

Friends And Related Function Documentation

std::size_t hash_value ( RelFilter const &  rel_filter)
friend

Definition at line 3753 of file RelAlgDag.cpp.

Referenced by toHash().

3753  {
3754  if (rel_filter.hash_) {
3755  return *rel_filter.hash_;
3756  }
3757  rel_filter.hash_ = typeid(RelFilter).hash_code();
3758  boost::hash_combine(*rel_filter.hash_, rel_filter.filter_);
3759  boost::hash_combine(*rel_filter.hash_, rel_filter.inputs_);
3760  return *rel_filter.hash_;
3761 }
RelFilter()=default
friend struct RelAlgDagSerializer
friend

Definition at line 1947 of file RelAlgDag.h.

Member Data Documentation

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

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