OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RexVisitor< T > Class Template Reference

#include <RexVisitor.h>

+ Inheritance diagram for RexVisitor< T >:
+ Collaboration diagram for RexVisitor< T >:

Public Member Functions

visitInput (const RexInput *) const override
 
visitLiteral (const RexLiteral *) const override
 
visitSubQuery (const RexSubQuery *) const override
 
visitRef (const RexRef *) const override
 
visitOperator (const RexOperator *rex_operator) const override
 
visitCase (const RexCase *rex_case) const override
 
- Public Member Functions inherited from RexVisitorBase< T >
virtual T visit (const RexScalar *rex_scalar) const
 

Protected Member Functions

virtual T aggregateResult (const T &aggregate, const T &next_result) const
 
defaultResult () const override
 

Private Member Functions

visitWindowFunctionOperator (const RexWindowFunctionOperator *rex_window_func_operator, const T operands_visit_result) const
 

Detailed Description

template<class T>
class RexVisitor< T >

Definition at line 75 of file RexVisitor.h.

Member Function Documentation

template<class T>
virtual T RexVisitor< T >::aggregateResult ( const T &  aggregate,
const T &  next_result 
) const
inlineprotectedvirtual
template<class T>
T RexVisitor< T >::defaultResult ( ) const
inlineoverrideprotectedvirtual
template<class T>
T RexVisitor< T >::visitCase ( const RexCase rex_case) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 101 of file RexVisitor.h.

101  {
102  T result = defaultResult();
103  for (size_t i = 0; i < rex_case->branchCount(); ++i) {
104  const auto when = rex_case->getWhen(i);
105  result = aggregateResult(result, RexVisitorBase<T>::visit(when));
106  const auto then = rex_case->getThen(i);
107  result = aggregateResult(result, RexVisitorBase<T>::visit(then));
108  }
109  if (rex_case->getElse()) {
110  result = aggregateResult(result, RexVisitorBase<T>::visit(rex_case->getElse()));
111  }
112  return result;
113  }
const RexScalar * getThen(const size_t idx) const
Definition: RelAlgDag.h:400
T defaultResult() const override
Definition: RexVisitor.h:120
const RexScalar * getElse() const
Definition: RelAlgDag.h:405
const RexScalar * getWhen(const size_t idx) const
Definition: RelAlgDag.h:395
virtual T aggregateResult(const T &aggregate, const T &next_result) const
Definition: RexVisitor.h:116
size_t branchCount() const
Definition: RelAlgDag.h:393
template<class T>
T RexVisitor< T >::visitInput ( const RexInput ) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 77 of file RexVisitor.h.

77 { return defaultResult(); }
T defaultResult() const override
Definition: RexVisitor.h:120
template<class T>
T RexVisitor< T >::visitLiteral ( const RexLiteral ) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 79 of file RexVisitor.h.

79 { return defaultResult(); }
T defaultResult() const override
Definition: RexVisitor.h:120
template<class T>
T RexVisitor< T >::visitOperator ( const RexOperator rex_operator) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 85 of file RexVisitor.h.

85  {
86  const size_t operand_count = rex_operator->size();
88  for (size_t i = 0; i < operand_count; ++i) {
89  const auto operand = rex_operator->getOperand(i);
90  T operandResult = RexVisitorBase<T>::visit(operand);
91  result = aggregateResult(result, operandResult);
92  }
93  const auto rex_window_func_operator =
94  dynamic_cast<const RexWindowFunctionOperator*>(rex_operator);
95  if (rex_window_func_operator) {
96  return visitWindowFunctionOperator(rex_window_func_operator, result);
97  }
98  return result;
99  }
T defaultResult() const override
Definition: RexVisitor.h:120
size_t size() const
Definition: RelAlgDag.h:245
const RexScalar * getOperand(const size_t idx) const
Definition: RelAlgDag.h:247
virtual T aggregateResult(const T &aggregate, const T &next_result) const
Definition: RexVisitor.h:116
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
T visitWindowFunctionOperator(const RexWindowFunctionOperator *rex_window_func_operator, const T operands_visit_result) const
Definition: RexVisitor.h:123
template<class T>
T RexVisitor< T >::visitRef ( const RexRef ) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 83 of file RexVisitor.h.

83 { return defaultResult(); }
T defaultResult() const override
Definition: RexVisitor.h:120
template<class T>
T RexVisitor< T >::visitSubQuery ( const RexSubQuery ) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 81 of file RexVisitor.h.

81 { return defaultResult(); }
T defaultResult() const override
Definition: RexVisitor.h:120
template<class T>
T RexVisitor< T >::visitWindowFunctionOperator ( const RexWindowFunctionOperator rex_window_func_operator,
const T  operands_visit_result 
) const
inlineprivate

Definition at line 123 of file RexVisitor.h.

Referenced by RexVisitor< std::unordered_set< const RexInput * > >::visitOperator().

124  {
125  T result = operands_visit_result;
126  for (const auto& key : rex_window_func_operator->getPartitionKeys()) {
127  T partial_result = RexVisitorBase<T>::visit(key.get());
128  result = aggregateResult(result, partial_result);
129  }
130  for (const auto& key : rex_window_func_operator->getOrderKeys()) {
131  T partial_result = RexVisitorBase<T>::visit(key.get());
132  result = aggregateResult(result, partial_result);
133  }
134  return result;
135  }
virtual T aggregateResult(const T &aggregate, const T &next_result) const
Definition: RexVisitor.h:116
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
const ConstRexScalarPtrVector & getPartitionKeys() const
Definition: RelAlgDag.h:573
const ConstRexScalarPtrVector & getOrderKeys() const
Definition: RelAlgDag.h:583

+ Here is the caller graph for this function:


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