OmniSciDB  a5dc49c757
 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

Definition at line 116 of file RexVisitor.h.

Referenced by RexVisitor< T >::visitCase(), RexVisitor< T >::visitOperator(), and RexVisitor< T >::visitWindowFunctionOperator().

116  {
117  return next_result;
118  }

+ Here is the caller graph for this function:

template<class T >
T RexVisitor< T >::defaultResult ( ) const
inlineoverrideprotectedvirtual

Implements RexVisitorBase< T >.

Definition at line 120 of file RexVisitor.h.

References heavydb.dtypes::T.

120 { return T{}; }
template<class T >
T RexVisitor< T >::visitCase ( const RexCase rex_case) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 101 of file RexVisitor.h.

References RexVisitor< T >::aggregateResult(), RexCase::branchCount(), RexVisitorBase< T >::defaultResult(), RexCase::getElse(), RexCase::getThen(), RexCase::getWhen(), run_benchmark_import::result, and heavydb.dtypes::T.

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:440
T defaultResult() const override
Definition: RexVisitor.h:120
const RexScalar * getElse() const
Definition: RelAlgDag.h:445
const RexScalar * getWhen(const size_t idx) const
Definition: RelAlgDag.h:435
virtual T aggregateResult(const T &aggregate, const T &next_result) const
Definition: RexVisitor.h:116
size_t branchCount() const
Definition: RelAlgDag.h:433

+ Here is the call graph for this function:

template<class T >
T RexVisitor< T >::visitInput ( const RexInput ) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 77 of file RexVisitor.h.

References RexVisitorBase< T >::defaultResult().

77 { return defaultResult(); }
T defaultResult() const override
Definition: RexVisitor.h:120

+ Here is the call graph for this function:

template<class T >
T RexVisitor< T >::visitLiteral ( const RexLiteral ) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 79 of file RexVisitor.h.

References RexVisitorBase< T >::defaultResult().

79 { return defaultResult(); }
T defaultResult() const override
Definition: RexVisitor.h:120

+ Here is the call graph for this function:

template<class T >
T RexVisitor< T >::visitOperator ( const RexOperator rex_operator) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 85 of file RexVisitor.h.

References RexVisitor< T >::aggregateResult(), RexVisitorBase< T >::defaultResult(), RexOperator::getOperand(), run_benchmark_import::result, RexOperator::size(), heavydb.dtypes::T, RexVisitorBase< T >::visit(), and RexVisitor< T >::visitWindowFunctionOperator().

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:364
const RexScalar * getOperand(const size_t idx) const
Definition: RelAlgDag.h:366
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

+ Here is the call graph for this function:

template<class T >
T RexVisitor< T >::visitRef ( const RexRef ) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 83 of file RexVisitor.h.

References RexVisitorBase< T >::defaultResult().

83 { return defaultResult(); }
T defaultResult() const override
Definition: RexVisitor.h:120

+ Here is the call graph for this function:

template<class T >
T RexVisitor< T >::visitSubQuery ( const RexSubQuery ) const
inlineoverridevirtual

Implements RexVisitorBase< T >.

Definition at line 81 of file RexVisitor.h.

References RexVisitorBase< T >::defaultResult().

81 { return defaultResult(); }
T defaultResult() const override
Definition: RexVisitor.h:120

+ Here is the call graph for this function:

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.

References RexVisitor< T >::aggregateResult(), RexWindowFunctionOperator::getOrderKeys(), RexWindowFunctionOperator::getPartitionKeys(), run_benchmark_import::result, heavydb.dtypes::T, and RexVisitorBase< T >::visit().

Referenced by RexVisitor< T >::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:643
const ConstRexScalarPtrVector & getOrderKeys() const
Definition: RelAlgDag.h:653

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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