OmniSciDB  cde582ebc3
 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 (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_
 

Additional Inherited Members

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

Detailed Description

Definition at line 386 of file RelAlgDag.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 388 of file RelAlgDag.h.

Referenced by toHash().

391  : expr_pair_list_(std::move(expr_pair_list)), else_expr_(std::move(else_expr)) {}
std::unique_ptr< const RexScalar > else_expr_
Definition: RelAlgDag.h:433
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:432

+ Here is the caller graph for this function:

Member Function Documentation

size_t RexCase::branchCount ( ) const
inline

Definition at line 393 of file RelAlgDag.h.

References expr_pair_list_.

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

393 { 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:432

+ Here is the caller graph for this function:

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

Definition at line 400 of file RelAlgDag.h.

References CHECK, and expr_pair_list_.

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

400  {
401  CHECK(idx < expr_pair_list_.size());
402  return expr_pair_list_[idx].second.get();
403  }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:432
#define CHECK(condition)
Definition: Logger.h:222

+ Here is the caller graph for this function:

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

Definition at line 395 of file RelAlgDag.h.

References CHECK, and expr_pair_list_.

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

395  {
396  CHECK(idx < expr_pair_list_.size());
397  return expr_pair_list_[idx].first.get();
398  }
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:432
#define CHECK(condition)
Definition: Logger.h:222

+ Here is the caller graph for this function:

size_t RexCase::toHash ( ) const
inlineoverridevirtual

Implements Rex.

Definition at line 417 of file RelAlgDag.h.

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

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

417  {
418  if (!hash_) {
419  hash_ = typeid(RexCase).hash_code();
420  for (size_t i = 0; i < branchCount(); ++i) {
421  boost::hash_combine(*hash_, getWhen(i)->toHash());
422  boost::hash_combine(*hash_, getThen(i)->toHash());
423  }
424  boost::hash_combine(*hash_, getElse() ? getElse()->toHash() : HASH_N);
425  }
426  return *hash_;
427  }
const RexScalar * getThen(const size_t idx) const
Definition: RelAlgDag.h:400
const RexScalar * getElse() const
Definition: RelAlgDag.h:405
const RexScalar * getWhen(const size_t idx) const
Definition: RelAlgDag.h:395
static auto const HASH_N
Definition: RelAlgDag.h:44
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)
Definition: RelAlgDag.h:388
size_t branchCount() const
Definition: RelAlgDag.h:393
std::optional< size_t > hash_
Definition: RelAlgDag.h:62
size_t toHash() const override
Definition: RelAlgDag.h:417

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

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

408  {
409  auto ret = cat(::typeName(this), "(expr_pair_list=");
410  for (auto& expr : expr_pair_list_) {
411  ret += expr.first->toString(config) + " " + expr.second->toString(config) + " ";
412  }
413  return cat(
414  ret, ", else_expr=", (else_expr_ ? else_expr_->toString(config) : "null"), ")");
415  }
std::string cat(Ts &&...args)
std::unique_ptr< const RexScalar > else_expr_
Definition: RelAlgDag.h:433
std::vector< std::pair< std::unique_ptr< const RexScalar >, std::unique_ptr< const RexScalar > > > expr_pair_list_
Definition: RelAlgDag.h:432
std::string typeName(const T *v)
Definition: toString.h:102

+ Here is the call graph for this function:

Member Data Documentation

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

Definition at line 433 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 432 of file RelAlgDag.h.

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


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