OmniSciDB  a987f07e93
 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)
 
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
 
size_t toHash () const override
 
- Public Member Functions inherited from Rex
virtual ~Rex ()
 

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
 

Additional Inherited Members

- Protected Attributes inherited from Rex
std::optional< size_t > hash_
 

Detailed Description

Definition at line 426 of file RelAlgDag.h.

Constructor & Destructor Documentation

RexCase::RexCase ( )
default

Referenced by toHash().

+ Here is the caller graph for this function:

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 431 of file RelAlgDag.h.

434  : expr_pair_list_(std::move(expr_pair_list)), else_expr_(std::move(else_expr)) {}
std::unique_ptr< const RexScalar > else_expr_
Definition: RelAlgDag.h:476
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:475

Member Function Documentation

size_t RexCase::branchCount ( ) const
inline

Definition at line 436 of file RelAlgDag.h.

References expr_pair_list_.

Referenced by anonymous_namespace{RelAlgDag.cpp}::disambiguate_case(), toHash(), 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().

436 { 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:475

+ 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 443 of file RelAlgDag.h.

References CHECK, and expr_pair_list_.

Referenced by anonymous_namespace{RelAlgDag.cpp}::disambiguate_case(), toHash(), 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().

443  {
444  CHECK(idx < expr_pair_list_.size());
445  return expr_pair_list_[idx].second.get();
446  }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:475
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the caller graph for this function:

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

Definition at line 438 of file RelAlgDag.h.

References CHECK, and expr_pair_list_.

Referenced by anonymous_namespace{RelAlgDag.cpp}::disambiguate_case(), toHash(), 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().

438  {
439  CHECK(idx < expr_pair_list_.size());
440  return expr_pair_list_[idx].first.get();
441  }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:475
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the caller graph for this function:

size_t RexCase::toHash ( ) const
inlineoverridevirtual

Implements Rex.

Definition at line 460 of file RelAlgDag.h.

References branchCount(), getElse(), getThen(), getWhen(), Rex::hash_, HASH_N, and RexCase().

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

460  {
461  if (!hash_) {
462  hash_ = typeid(RexCase).hash_code();
463  for (size_t i = 0; i < branchCount(); ++i) {
464  boost::hash_combine(*hash_, getWhen(i)->toHash());
465  boost::hash_combine(*hash_, getThen(i)->toHash());
466  }
467  boost::hash_combine(*hash_, getElse() ? getElse()->toHash() : HASH_N);
468  }
469  return *hash_;
470  }
const RexScalar * getThen(const size_t idx) const
Definition: RelAlgDag.h:443
const RexScalar * getElse() const
Definition: RelAlgDag.h:448
const RexScalar * getWhen(const size_t idx) const
Definition: RelAlgDag.h:438
static auto const HASH_N
Definition: RelAlgDag.h:44
size_t branchCount() const
Definition: RelAlgDag.h:436
std::optional< size_t > hash_
Definition: RelAlgDag.h:62
size_t toHash() const override
Definition: RelAlgDag.h:460
RexCase()=default

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements Rex.

Definition at line 450 of file RelAlgDag.h.

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

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

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend struct RelAlgDagSerializer
friend

Definition at line 478 of file RelAlgDag.h.

Member Data Documentation

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

Definition at line 476 of file RelAlgDag.h.

Referenced by getElse(), and toString().

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

Definition at line 475 of file RelAlgDag.h.

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


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