OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector Class Reference
+ Inheritance diagram for anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector:
+ Collaboration diagram for anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector:

Public Member Functions

 WindowFunctionCollector (std::unordered_map< size_t, const RexScalar * > &collected_window_func)
 
- Public Member Functions inherited from RexVisitor< void * >
void * visitInput (const RexInput *) const override
 
void * visitLiteral (const RexLiteral *) const override
 
void * visitSubQuery (const RexSubQuery *) const override
 
void * visitRef (const RexRef *) const override
 
void * visitOperator (const RexOperator *rex_operator) const override
 
void * visitCase (const RexCase *rex_case) const override
 
- Public Member Functions inherited from RexVisitorBase< void * >
virtual void * visit (const RexScalar *rex_scalar) const
 

Protected Member Functions

void * visitOperator (const RexOperator *rex_operator) const final
 
void * visitCase (const RexCase *rex_case) const final
 
void * defaultResult () const final
 
- Protected Member Functions inherited from RexVisitor< void * >
virtual void * aggregateResult (const void *&aggregate, const void *&next_result) const
 
void * defaultResult () const override
 

Private Attributes

std::unordered_map< size_t,
const RexScalar * > & 
collected_window_func_
 

Detailed Description

Definition at line 2015 of file RelAlgDag.cpp.

Constructor & Destructor Documentation

anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector::WindowFunctionCollector ( std::unordered_map< size_t, const RexScalar * > &  collected_window_func)
inline

Definition at line 2017 of file RelAlgDag.cpp.

2019  : collected_window_func_(collected_window_func) {}
std::unordered_map< size_t, const RexScalar * > & collected_window_func_
Definition: RelAlgDag.cpp:2079

Member Function Documentation

void* anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector::defaultResult ( ) const
inlinefinalprotectedvirtual

Implements RexVisitorBase< void * >.

Definition at line 2076 of file RelAlgDag.cpp.

2076 { return nullptr; }
void* anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector::visitCase ( const RexCase rex_case) const
inlinefinalprotectedvirtual

Implements RexVisitorBase< void * >.

Definition at line 2045 of file RelAlgDag.cpp.

References RexCase::branchCount(), RexCase::getElse(), RexCase::getThen(), RexCase::getWhen(), anonymous_namespace{RelAlgDag.cpp}::anonymous_namespace{RelAlgDag.cpp}::is_window_function_operator(), and RexCase::toHash().

2045  {
2046  if (is_window_function_operator(rex_case)) {
2047  collected_window_func_.emplace(rex_case->toHash(), rex_case);
2048  return nullptr;
2049  }
2050 
2051  for (size_t i = 0; i < rex_case->branchCount(); ++i) {
2052  const auto when = rex_case->getWhen(i);
2053  if (is_window_function_operator(when)) {
2054  collected_window_func_.emplace(when->toHash(), when);
2055  } else {
2056  visit(when);
2057  }
2058  const auto then = rex_case->getThen(i);
2059  if (is_window_function_operator(then)) {
2060  collected_window_func_.emplace(then->toHash(), then);
2061  } else {
2062  visit(then);
2063  }
2064  }
2065  if (rex_case->getElse()) {
2066  auto else_expr = rex_case->getElse();
2067  if (is_window_function_operator(else_expr)) {
2068  collected_window_func_.emplace(else_expr->toHash(), else_expr);
2069  } else {
2070  visit(else_expr);
2071  }
2072  }
2073  return defaultResult();
2074  }
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
std::unordered_map< size_t, const RexScalar * > & collected_window_func_
Definition: RelAlgDag.cpp:2079
virtual void * visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
size_t branchCount() const
Definition: RelAlgDag.h:393
size_t toHash() const override
Definition: RelAlgDag.h:417

+ Here is the call graph for this function:

void* anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector::visitOperator ( const RexOperator rex_operator) const
inlinefinalprotectedvirtual

Implements RexVisitorBase< void * >.

Definition at line 2023 of file RelAlgDag.cpp.

References anonymous_namespace{RelAlgDag.cpp}::anonymous_namespace{RelAlgDag.cpp}::is_window_function_operator().

2023  {
2024  if (is_window_function_operator(rex_operator)) {
2025  collected_window_func_.emplace(rex_operator->toHash(), rex_operator);
2026  }
2027  const size_t operand_count = rex_operator->size();
2028  for (size_t i = 0; i < operand_count; ++i) {
2029  const auto operand = rex_operator->getOperand(i);
2030  if (is_window_function_operator(operand)) {
2031  // Handle both RexWindowFunctionOperators and window functions built up from
2032  // multiple RexScalar objects (e.g. AVG)
2033  collected_window_func_.emplace(operand->toHash(), operand);
2034  } else {
2035  visit(operand);
2036  }
2037  }
2038  return defaultResult();
2039  }
size_t size() const
Definition: RelAlgDag.h:245
const RexScalar * getOperand(const size_t idx) const
Definition: RelAlgDag.h:247
std::unordered_map< size_t, const RexScalar * > & collected_window_func_
Definition: RelAlgDag.cpp:2079
virtual void * visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
size_t toHash() const override
Definition: RelAlgDag.h:270

+ Here is the call graph for this function:

Member Data Documentation

std::unordered_map<size_t, const RexScalar*>& anonymous_namespace{RelAlgDag.cpp}::WindowFunctionCollector::collected_window_func_
private

Definition at line 2079 of file RelAlgDag.cpp.


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