OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RexDeepCopyVisitor Class Reference

#include <RexVisitor.h>

+ Inheritance diagram for RexDeepCopyVisitor:
+ Collaboration diagram for RexDeepCopyVisitor:

Protected Types

using RetType = std::unique_ptr< const RexScalar >
 

Protected Member Functions

RetType visitInput (const RexInput *input) const override
 
RetType visitLiteral (const RexLiteral *literal) const override
 
RetType visitSubQuery (const RexSubQuery *subquery) const override
 
RetType visitRef (const RexRef *ref) const override
 
RetType visitOperator (const RexOperator *rex_operator) const override
 
RetType visitWindowFunctionOperator (const RexWindowFunctionOperator *rex_window_function_operator) const
 
RetType visitCase (const RexCase *rex_case) const override
 

Private Member Functions

RetType defaultResult () const override
 

Additional Inherited Members

- Public Member Functions inherited from RexVisitorBase< std::unique_ptr< const RexScalar > >
virtual std::unique_ptr< const
RexScalar
visit (const RexScalar *rex_scalar) const
 

Detailed Description

Definition at line 137 of file RexVisitor.h.

Member Typedef Documentation

using RexDeepCopyVisitor::RetType = std::unique_ptr<const RexScalar>
protected

Definition at line 139 of file RexVisitor.h.

Member Function Documentation

RetType RexDeepCopyVisitor::defaultResult ( ) const
inlineoverrideprivatevirtual

Implements RexVisitorBase< std::unique_ptr< const RexScalar > >.

Definition at line 204 of file RexVisitor.h.

204 { return nullptr; }
RetType RexDeepCopyVisitor::visitCase ( const RexCase rex_case) const
inlineoverrideprotectedvirtual

Implements RexVisitorBase< std::unique_ptr< const RexScalar > >.

Definition at line 193 of file RexVisitor.h.

References RexCase::branchCount(), RexCase::getElse(), RexCase::getThen(), RexCase::getWhen(), and RexVisitorBase< std::unique_ptr< const RexScalar > >::visit().

193  {
194  std::vector<std::pair<RetType, RetType>> new_pair_list;
195  for (size_t i = 0; i < rex_case->branchCount(); ++i) {
196  new_pair_list.emplace_back(visit(rex_case->getWhen(i)),
197  visit(rex_case->getThen(i)));
198  }
199  auto new_else = visit(rex_case->getElse());
200  return std::make_unique<RexCase>(new_pair_list, new_else);
201  }
const RexScalar * getThen(const size_t idx) const
const RexScalar * getElse() const
const RexScalar * getWhen(const size_t idx) const
virtual std::unique_ptr< const RexScalar > visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
size_t branchCount() const

+ Here is the call graph for this function:

RetType RexDeepCopyVisitor::visitInput ( const RexInput input) const
inlineoverrideprotectedvirtual

Implements RexVisitorBase< std::unique_ptr< const RexScalar > >.

Reimplemented in RexInputRenumber< bAllowMissing >.

Definition at line 141 of file RexVisitor.h.

References RexInput::deepCopy().

Referenced by anonymous_namespace{RelAlgOptimizer.cpp}::SubConditionReplacer::visitInput().

141 { return input->deepCopy(); }
std::unique_ptr< RexInput > deepCopy() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RetType RexDeepCopyVisitor::visitLiteral ( const RexLiteral literal) const
inlineoverrideprotectedvirtual

Implements RexVisitorBase< std::unique_ptr< const RexScalar > >.

Definition at line 143 of file RexVisitor.h.

143  {
144  return literal->deepCopy();
145  }
RetType RexDeepCopyVisitor::visitOperator ( const RexOperator rex_operator) const
inlineoverrideprotectedvirtual

Implements RexVisitorBase< std::unique_ptr< const RexScalar > >.

Definition at line 153 of file RexVisitor.h.

References RexOperator::getDisambiguated(), RexOperator::getOperand(), RexOperator::size(), RexVisitorBase< std::unique_ptr< const RexScalar > >::visit(), and visitWindowFunctionOperator().

Referenced by SubConditionRemover::visitOperator().

153  {
154  const auto rex_window_function_operator =
155  dynamic_cast<const RexWindowFunctionOperator*>(rex_operator);
156  if (rex_window_function_operator) {
157  return visitWindowFunctionOperator(rex_window_function_operator);
158  }
159 
160  const size_t operand_count = rex_operator->size();
161  std::vector<RetType> new_opnds;
162  for (size_t i = 0; i < operand_count; ++i) {
163  new_opnds.push_back(visit(rex_operator->getOperand(i)));
164  }
165  return rex_operator->getDisambiguated(new_opnds);
166  }
size_t size() const
const RexScalar * getOperand(const size_t idx) const
RetType visitWindowFunctionOperator(const RexWindowFunctionOperator *rex_window_function_operator) const
Definition: RexVisitor.h:168
virtual std::unique_ptr< const RexOperator > getDisambiguated(std::vector< std::unique_ptr< const RexScalar >> &operands) const
virtual std::unique_ptr< const RexScalar > visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RetType RexDeepCopyVisitor::visitRef ( const RexRef ref) const
inlineoverrideprotectedvirtual

Implements RexVisitorBase< std::unique_ptr< const RexScalar > >.

Definition at line 151 of file RexVisitor.h.

References RexRef::deepCopy().

151 { return ref->deepCopy(); }
std::unique_ptr< RexRef > deepCopy() const

+ Here is the call graph for this function:

RetType RexDeepCopyVisitor::visitSubQuery ( const RexSubQuery subquery) const
inlineoverrideprotectedvirtual

Implements RexVisitorBase< std::unique_ptr< const RexScalar > >.

Definition at line 147 of file RexVisitor.h.

147  {
148  return subquery->deepCopy();
149  }
RetType RexDeepCopyVisitor::visitWindowFunctionOperator ( const RexWindowFunctionOperator rex_window_function_operator) const
inlineprotected

Definition at line 168 of file RexVisitor.h.

References RexWindowFunctionOperator::disambiguatedOperands(), RexWindowFunctionOperator::getCollation(), RexOperator::getOperand(), RexWindowFunctionOperator::getOrderKeys(), RexWindowFunctionOperator::getPartitionKeys(), RexOperator::size(), and RexVisitorBase< std::unique_ptr< const RexScalar > >::visit().

Referenced by visitOperator().

169  {
170  const size_t operand_count = rex_window_function_operator->size();
171  std::vector<RetType> new_opnds;
172  for (size_t i = 0; i < operand_count; ++i) {
173  new_opnds.push_back(visit(rex_window_function_operator->getOperand(i)));
174  }
175 
176  const auto& partition_keys = rex_window_function_operator->getPartitionKeys();
177  std::vector<std::unique_ptr<const RexScalar>> disambiguated_partition_keys;
178  for (const auto& partition_key : partition_keys) {
179  disambiguated_partition_keys.emplace_back(visit(partition_key.get()));
180  }
181  std::vector<std::unique_ptr<const RexScalar>> disambiguated_order_keys;
182  const auto& order_keys = rex_window_function_operator->getOrderKeys();
183  for (const auto& order_key : order_keys) {
184  disambiguated_order_keys.emplace_back(visit(order_key.get()));
185  }
186  return rex_window_function_operator->disambiguatedOperands(
187  new_opnds,
188  disambiguated_partition_keys,
189  disambiguated_order_keys,
190  rex_window_function_operator->getCollation());
191  }
size_t size() const
const RexScalar * getOperand(const size_t idx) const
const std::vector< SortField > & getCollation() const
virtual std::unique_ptr< const RexScalar > visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
std::unique_ptr< const RexOperator > disambiguatedOperands(ConstRexScalarPtrVector &operands, ConstRexScalarPtrVector &partition_keys, ConstRexScalarPtrVector &order_keys, const std::vector< SortField > &collation) const
const ConstRexScalarPtrVector & getPartitionKeys() const
const ConstRexScalarPtrVector & getOrderKeys() const

+ 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: