OmniSciDB  04ee39c94c
anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor Class Reference
+ Inheritance diagram for anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor:
+ Collaboration diagram for anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor:

Protected Member Functions

std::shared_ptr< Analyzer::InValuesvisitBinOper (const Analyzer::BinOper *bin_oper) const override
 
std::shared_ptr< Analyzer::InValuesvisitUOper (const Analyzer::UOper *uoper) const override
 
std::shared_ptr< Analyzer::InValuesvisitInValues (const Analyzer::InValues *) const override
 
std::shared_ptr< Analyzer::InValuesvisitInIntegerSet (const Analyzer::InIntegerSet *) const override
 
std::shared_ptr< Analyzer::InValuesvisitCharLength (const Analyzer::CharLengthExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitKeyForString (const Analyzer::KeyForStringExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitCardinality (const Analyzer::CardinalityExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitLikeExpr (const Analyzer::LikeExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitRegexpExpr (const Analyzer::RegexpExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitCaseExpr (const Analyzer::CaseExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitDatetruncExpr (const Analyzer::DatetruncExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitDatediffExpr (const Analyzer::DatediffExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitDateaddExpr (const Analyzer::DateaddExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitExtractExpr (const Analyzer::ExtractExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitLikelihood (const Analyzer::LikelihoodExpr *) const override
 
std::shared_ptr< Analyzer::InValuesvisitAggExpr (const Analyzer::AggExpr *) const override
 
std::shared_ptr< Analyzer::InValuesaggregateResult (const std::shared_ptr< Analyzer::InValues > &lhs, const std::shared_ptr< Analyzer::InValues > &rhs) const override
 
- Protected Member Functions inherited from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >
virtual std::shared_ptr< Analyzer::InValuesvisitVar (const Analyzer::Var *) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitColumnVar (const Analyzer::ColumnVar *) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitColumnVarTuple (const Analyzer::ExpressionTuple *) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitConstant (const Analyzer::Constant *) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitFunctionOperWithCustomTypeHandling (const Analyzer::FunctionOperWithCustomTypeHandling *func_oper) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitArrayOper (Analyzer::ArrayExpr const *array_expr) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitFunctionOper (const Analyzer::FunctionOper *func_oper) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitWindowFunction (const Analyzer::WindowFunction *window_func) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitOffsetInFragment (const Analyzer::OffsetInFragment *) const
 
virtual std::shared_ptr< Analyzer::InValuesdefaultResult () const
 

Additional Inherited Members

- Public Member Functions inherited from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >
std::shared_ptr< Analyzer::InValuesvisit (const Analyzer::Expr *expr) const
 

Detailed Description

Definition at line 31 of file ExpressionRewrite.cpp.

Member Function Documentation

◆ aggregateResult()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::aggregateResult ( const std::shared_ptr< Analyzer::InValues > &  lhs,
const std::shared_ptr< Analyzer::InValues > &  rhs 
) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 133 of file ExpressionRewrite.cpp.

135  {
136  if (!lhs || !rhs) {
137  return nullptr;
138  }
139  if (!(*lhs->get_arg() == *rhs->get_arg())) {
140  return nullptr;
141  }
142  auto union_values = lhs->get_value_list();
143  const auto& rhs_values = rhs->get_value_list();
144  union_values.insert(union_values.end(), rhs_values.begin(), rhs_values.end());
145  return makeExpr<Analyzer::InValues>(lhs->get_own_arg(), union_values);
146  }

◆ visitAggExpr()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitAggExpr ( const Analyzer::AggExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 128 of file ExpressionRewrite.cpp.

129  {
130  return nullptr;
131  }

◆ visitBinOper()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitBinOper ( const Analyzer::BinOper bin_oper) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 33 of file ExpressionRewrite.cpp.

References extract_cast_arg(), Analyzer::BinOper::get_left_operand(), Analyzer::BinOper::get_optype(), Analyzer::BinOper::get_own_left_operand(), Analyzer::BinOper::get_own_right_operand(), Analyzer::BinOper::get_right_operand(), kEQ, and kOR.

34  {
35  switch (bin_oper->get_optype()) {
36  case kEQ: {
37  const auto rhs_owned = bin_oper->get_own_right_operand();
38  auto rhs_no_cast = extract_cast_arg(rhs_owned.get());
39  if (!dynamic_cast<const Analyzer::Constant*>(rhs_no_cast)) {
40  return nullptr;
41  }
42  const auto arg = bin_oper->get_own_left_operand();
43  const auto& arg_ti = arg->get_type_info();
44  auto rhs = rhs_no_cast->deep_copy()->add_cast(arg_ti);
45  return makeExpr<Analyzer::InValues>(
46  arg, std::list<std::shared_ptr<Analyzer::Expr>>{rhs});
47  }
48  case kOR: {
49  return aggregateResult(visit(bin_oper->get_left_operand()),
50  visit(bin_oper->get_right_operand()));
51  }
52  default:
53  break;
54  }
55  return nullptr;
56  }
Definition: sqldefs.h:38
Definition: sqldefs.h:30
const Analyzer::Expr * extract_cast_arg(const Analyzer::Expr *expr)
Definition: Execute.h:149
std::shared_ptr< Analyzer::InValues > aggregateResult(const std::shared_ptr< Analyzer::InValues > &lhs, const std::shared_ptr< Analyzer::InValues > &rhs) const override
SQLOps get_optype() const
Definition: Analyzer.h:432
const std::shared_ptr< Analyzer::Expr > get_own_left_operand() const
Definition: Analyzer.h:437
const std::shared_ptr< Analyzer::Expr > get_own_right_operand() const
Definition: Analyzer.h:440
std::shared_ptr< Analyzer::InValues > visit(const Analyzer::Expr *expr) const
const Expr * get_right_operand() const
Definition: Analyzer.h:436
const Expr * get_left_operand() const
Definition: Analyzer.h:435
+ Here is the call graph for this function:

◆ visitCardinality()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitCardinality ( const Analyzer::CardinalityExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 83 of file ExpressionRewrite.cpp.

84  {
85  return nullptr;
86  }

◆ visitCaseExpr()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitCaseExpr ( const Analyzer::CaseExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 98 of file ExpressionRewrite.cpp.

99  {
100  return nullptr;
101  }

◆ visitCharLength()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitCharLength ( const Analyzer::CharLengthExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 73 of file ExpressionRewrite.cpp.

74  {
75  return nullptr;
76  }

◆ visitDateaddExpr()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitDateaddExpr ( const Analyzer::DateaddExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 113 of file ExpressionRewrite.cpp.

114  {
115  return nullptr;
116  }

◆ visitDatediffExpr()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitDatediffExpr ( const Analyzer::DatediffExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 108 of file ExpressionRewrite.cpp.

109  {
110  return nullptr;
111  }

◆ visitDatetruncExpr()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitDatetruncExpr ( const Analyzer::DatetruncExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 103 of file ExpressionRewrite.cpp.

104  {
105  return nullptr;
106  }

◆ visitExtractExpr()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitExtractExpr ( const Analyzer::ExtractExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 118 of file ExpressionRewrite.cpp.

119  {
120  return nullptr;
121  }

◆ visitInIntegerSet()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitInIntegerSet ( const Analyzer::InIntegerSet ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 68 of file ExpressionRewrite.cpp.

69  {
70  return nullptr;
71  }

◆ visitInValues()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitInValues ( const Analyzer::InValues ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 63 of file ExpressionRewrite.cpp.

64  {
65  return nullptr;
66  }

◆ visitKeyForString()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitKeyForString ( const Analyzer::KeyForStringExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 78 of file ExpressionRewrite.cpp.

79  {
80  return nullptr;
81  }

◆ visitLikeExpr()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitLikeExpr ( const Analyzer::LikeExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 88 of file ExpressionRewrite.cpp.

89  {
90  return nullptr;
91  }

◆ visitLikelihood()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitLikelihood ( const Analyzer::LikelihoodExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 123 of file ExpressionRewrite.cpp.

124  {
125  return nullptr;
126  }

◆ visitRegexpExpr()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitRegexpExpr ( const Analyzer::RegexpExpr ) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 93 of file ExpressionRewrite.cpp.

94  {
95  return nullptr;
96  }

◆ visitUOper()

std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitUOper ( const Analyzer::UOper uoper) const
inlineoverrideprotectedvirtual

Reimplemented from ScalarExprVisitor< std::shared_ptr< Analyzer::InValues > >.

Definition at line 58 of file ExpressionRewrite.cpp.

59  {
60  return nullptr;
61  }

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