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

#include <RelAlgDagBuilder.h>

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

Public Member Functions

 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 () 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_
 

Additional Inherited Members

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

Detailed Description

Definition at line 379 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

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

Referenced by toHash().

384  : expr_pair_list_(std::move(expr_pair_list)), else_expr_(std::move(else_expr)) {}
std::unique_ptr< const RexScalar > else_expr_
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_

+ Here is the caller graph for this function:

Member Function Documentation

size_t RexCase::branchCount ( ) const
inline

Definition at line 386 of file RelAlgDagBuilder.h.

References expr_pair_list_.

Referenced by anonymous_namespace{RelAlgDagBuilder.cpp}::disambiguate_case(), toHash(), RelAlgTranslator::translateCase(), RelRexDagVisitor::visit(), RexVisitor< std::unordered_set< const RexInput * > >::visitCase(), RexDeepCopyVisitor::visitCase(), anonymous_namespace{RelAlgDagBuilder.cpp}::WindowFunctionDetectionVisitor::visitCase(), and anonymous_namespace{RelAlgDagBuilder.cpp}::RexWindowFuncReplacementVisitor::visitCase().

386 { return expr_pair_list_.size(); }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_

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

References CHECK, and expr_pair_list_.

Referenced by anonymous_namespace{RelAlgDagBuilder.cpp}::disambiguate_case(), toHash(), RelAlgTranslator::translateCase(), RelRexDagVisitor::visit(), RexVisitor< std::unordered_set< const RexInput * > >::visitCase(), RexDeepCopyVisitor::visitCase(), anonymous_namespace{RelAlgDagBuilder.cpp}::WindowFunctionDetectionVisitor::visitCase(), and anonymous_namespace{RelAlgDagBuilder.cpp}::RexWindowFuncReplacementVisitor::visitCase().

393  {
394  CHECK(idx < expr_pair_list_.size());
395  return expr_pair_list_[idx].second.get();
396  }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
#define CHECK(condition)
Definition: Logger.h:211

+ Here is the caller graph for this function:

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

Definition at line 388 of file RelAlgDagBuilder.h.

References CHECK, and expr_pair_list_.

Referenced by anonymous_namespace{RelAlgDagBuilder.cpp}::disambiguate_case(), toHash(), RelAlgTranslator::translateCase(), RelRexDagVisitor::visit(), RexVisitor< std::unordered_set< const RexInput * > >::visitCase(), RexDeepCopyVisitor::visitCase(), anonymous_namespace{RelAlgDagBuilder.cpp}::WindowFunctionDetectionVisitor::visitCase(), and anonymous_namespace{RelAlgDagBuilder.cpp}::RexWindowFuncReplacementVisitor::visitCase().

388  {
389  CHECK(idx < expr_pair_list_.size());
390  return expr_pair_list_[idx].first.get();
391  }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
#define CHECK(condition)
Definition: Logger.h:211

+ Here is the caller graph for this function:

size_t RexCase::toHash ( ) const
inlineoverridevirtual

Implements Rex.

Definition at line 409 of file RelAlgDagBuilder.h.

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

409  {
410  if (!hash_) {
411  hash_ = typeid(RexCase).hash_code();
412  for (size_t i = 0; i < branchCount(); ++i) {
413  boost::hash_combine(*hash_, getWhen(i)->toHash());
414  boost::hash_combine(*hash_, getThen(i)->toHash());
415  }
416  boost::hash_combine(*hash_,
417  getElse() ? getElse()->toHash() : boost::hash_value("n"));
418  }
419  return *hash_;
420  }
const RexScalar * getThen(const size_t idx) const
const RexScalar * getElse() const
const RexScalar * getWhen(const size_t idx) const
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
std::optional< size_t > hash_
size_t toHash() const override

+ Here is the call graph for this function:

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

Implements Rex.

Definition at line 400 of file RelAlgDagBuilder.h.

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

400  {
401  return cat(::typeName(this),
402  "(expr_pair_list=",
404  ", else_expr=",
405  (else_expr_ ? else_expr_->toString() : "null"),
406  ")");
407  }
std::string cat(Ts &&...args)
std::unique_ptr< const RexScalar > else_expr_
std::string toString() const override
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
std::string typeName(const T *v)
Definition: toString.h:93

+ Here is the call graph for this function:

Member Data Documentation

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

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

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


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