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

#include <RelAlgDag.h>

+ Inheritance diagram for RexCase:
+ Collaboration diagram for RexCase:

Public Member Functions

 RexCase ()=default
 
 RexCase (std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar >>> &expr_pair_list, std::unique_ptr< const RexScalar > &else_expr)
 
virtual void acceptChildren (Visitor &v) const override
 
virtual void accept (Visitor &v, std::string name) const override
 
size_t branchCount () const
 
const RexScalargetWhen (const size_t idx) const
 
const RexScalargetThen (const size_t idx) const
 
const RexScalargetElse () const
 
std::string toString (RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
 
virtual size_t toHash () const override
 
- Public Member Functions inherited from Rex
virtual ~Rex ()
 
virtual size_t getStepNumber () const
 
- Public Member Functions inherited from RelAlgDagNode
 RelAlgDagNode ()
 
virtual void setStepNumber (size_t step) const
 
std::optional< size_t > getIdInPlanTree () const
 
void setIdInPlanTree (size_t id) const
 

Private Attributes

std::vector< std::pair
< std::unique_ptr< const
RexScalar >, std::unique_ptr
< const RexScalar > > > 
expr_pair_list_
 
std::unique_ptr< const RexScalarelse_expr_
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from Rex
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 408 of file RelAlgDag.h.

Constructor & Destructor Documentation

RexCase::RexCase ( )
default
RexCase::RexCase ( std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar >>> &  expr_pair_list,
std::unique_ptr< const RexScalar > &  else_expr 
)
inline

Definition at line 413 of file RelAlgDag.h.

416  : expr_pair_list_(std::move(expr_pair_list)), else_expr_(std::move(else_expr)) {}
std::unique_ptr< const RexScalar > else_expr_
Definition: RelAlgDag.h:469
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:468

Member Function Documentation

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

Implements RelAlgDagNode.

Definition at line 427 of file RelAlgDag.h.

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

Referenced by TableFunctionsFactory_node.PrintNode::__str__().

427  {
428  if (v.visit(this, std::move(name))) {
429  acceptChildren(v);
430  }
431  }
string name
Definition: setup.in.py:72
virtual void acceptChildren(Visitor &v) const override
Definition: RelAlgDag.h:418

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements RelAlgDagNode.

Definition at line 418 of file RelAlgDag.h.

References RelAlgDagNode::accept(), branchCount(), getElse(), getThen(), and getWhen().

Referenced by accept().

418  {
419  for (size_t i = 0; i < branchCount(); ++i) {
420  getWhen(i)->accept(v, "when");
421  getThen(i)->accept(v, "then");
422  }
423  if (getElse()) {
424  getElse()->accept(v, "else");
425  }
426  }
const RexScalar * getThen(const size_t idx) const
Definition: RelAlgDag.h:440
const RexScalar * getElse() const
Definition: RelAlgDag.h:445
const RexScalar * getWhen(const size_t idx) const
Definition: RelAlgDag.h:435
size_t branchCount() const
Definition: RelAlgDag.h:433
virtual void accept(Visitor &v, std::string name) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t RexCase::branchCount ( ) const
inline

Definition at line 433 of file RelAlgDag.h.

References expr_pair_list_.

Referenced by acceptChildren(), anonymous_namespace{RelAlgDag.cpp}::disambiguate_case(), RelAlgTranslator::translateCase(), RelRexDagVisitor::visit(), RexVisitor< T >::visitCase(), RexDeepCopyVisitor::visitCase(), anonymous_namespace{RelAlgDag.cpp}::PushDownGenericExpressionInWindowFunction::visitCase(), anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector::visitCase(), and anonymous_namespace{RelAlgDag.cpp}::RexWindowFuncReplacementVisitor::visitCase().

433 { return expr_pair_list_.size(); }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:468

+ Here is the caller graph for this function:

const RexScalar* RexCase::getElse ( ) const
inline
const RexScalar* RexCase::getThen ( const size_t  idx) const
inline

Definition at line 440 of file RelAlgDag.h.

References CHECK, and expr_pair_list_.

Referenced by acceptChildren(), anonymous_namespace{RelAlgDag.cpp}::disambiguate_case(), RelAlgTranslator::translateCase(), RelRexDagVisitor::visit(), RexVisitor< T >::visitCase(), RexDeepCopyVisitor::visitCase(), anonymous_namespace{RelAlgDag.cpp}::PushDownGenericExpressionInWindowFunction::visitCase(), anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector::visitCase(), and anonymous_namespace{RelAlgDag.cpp}::RexWindowFuncReplacementVisitor::visitCase().

440  {
441  CHECK(idx < expr_pair_list_.size());
442  return expr_pair_list_[idx].second.get();
443  }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:468
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

const RexScalar* RexCase::getWhen ( const size_t  idx) const
inline

Definition at line 435 of file RelAlgDag.h.

References CHECK, and expr_pair_list_.

Referenced by acceptChildren(), anonymous_namespace{RelAlgDag.cpp}::disambiguate_case(), RelAlgTranslator::translateCase(), RelRexDagVisitor::visit(), RexVisitor< T >::visitCase(), RexDeepCopyVisitor::visitCase(), anonymous_namespace{RelAlgDag.cpp}::PushDownGenericExpressionInWindowFunction::visitCase(), anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector::visitCase(), and anonymous_namespace{RelAlgDag.cpp}::RexWindowFuncReplacementVisitor::visitCase().

435  {
436  CHECK(idx < expr_pair_list_.size());
437  return expr_pair_list_[idx].first.get();
438  }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:468
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

virtual size_t RexCase::toHash ( ) const
inlineoverridevirtual

Implements Rex.

Definition at line 461 of file RelAlgDag.h.

References hash_value.

Referenced by anonymous_namespace{RelAlgDag.cpp}::RexWindowFuncReplacementVisitor::visitCase().

461 { return hash_value(*this); }
friend std::size_t hash_value(RexCase const &)
Definition: RelAlgDag.cpp:3592

+ Here is the caller graph for this function:

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

Implements RelAlgDagNode.

Definition at line 447 of file RelAlgDag.h.

References cat(), else_expr_, expr_pair_list_, and typeName().

448  {
449  if (!config.attributes_only) {
450  auto ret = cat(::typeName(this), "(expr_pair_list=");
451  for (auto& expr : expr_pair_list_) {
452  ret += expr.first->toString(config) + " " + expr.second->toString(config) + " ";
453  }
454  return cat(
455  ret, ", else_expr=", (else_expr_ ? else_expr_->toString(config) : "null"), ")");
456  } else {
457  return ::typeName(this);
458  }
459  }
std::string cat(Ts &&...args)
std::unique_ptr< const RexScalar > else_expr_
Definition: RelAlgDag.h:469
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:468
std::string typeName(const T *v)
Definition: toString.h:106

+ Here is the call graph for this function:

Friends And Related Function Documentation

std::size_t hash_value ( RexCase const &  rex_case)
friend

Definition at line 3592 of file RelAlgDag.cpp.

Referenced by toHash().

3592  {
3593  if (rex_case.hash_) {
3594  return *rex_case.hash_;
3595  }
3596  rex_case.hash_ = typeid(RexCase).hash_code();
3597  boost::hash_combine(*rex_case.hash_, rex_case.expr_pair_list_);
3598  boost::hash_combine(*rex_case.hash_, rex_case.else_expr_);
3599  return *rex_case.hash_;
3600 }
RexCase()=default
friend struct RelAlgDagSerializer
friend

Definition at line 471 of file RelAlgDag.h.

Member Data Documentation

std::unique_ptr<const RexScalar> RexCase::else_expr_
private

Definition at line 469 of file RelAlgDag.h.

Referenced by getElse(), hash_value(), and toString().

std::vector< std::pair<std::unique_ptr<const RexScalar>, std::unique_ptr<const RexScalar> > > RexCase::expr_pair_list_
private

Definition at line 468 of file RelAlgDag.h.

Referenced by branchCount(), getThen(), getWhen(), hash_value(), and toString().


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