OmniSciDB  dfae7c3b14
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::InValuesvisitSampleRatio (const Analyzer::SampleRatioExpr *) 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::InValuesvisitLower (const Analyzer::LowerExpr *lower_expr) 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::InValuesvisitGeoUOper (const Analyzer::GeoUOper *geo_expr) const
 
virtual std::shared_ptr< Analyzer::InValuesvisitGeoBinOper (const Analyzer::GeoBinOper *geo_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 33 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 140 of file ExpressionRewrite.cpp.

142  {
143  if (!lhs || !rhs) {
144  return nullptr;
145  }
146 
147  if (lhs->get_arg()->get_type_info() == rhs->get_arg()->get_type_info() &&
148  (*lhs->get_arg() == *rhs->get_arg())) {
149  auto union_values = lhs->get_value_list();
150  const auto& rhs_values = rhs->get_value_list();
151  union_values.insert(union_values.end(), rhs_values.begin(), rhs_values.end());
152  return makeExpr<Analyzer::InValues>(lhs->get_own_arg(), union_values);
153  }
154  return nullptr;
155  }

◆ 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 135 of file ExpressionRewrite.cpp.

136  {
137  return nullptr;
138  }

◆ 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 35 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.

36  {
37  switch (bin_oper->get_optype()) {
38  case kEQ: {
39  const auto rhs_owned = bin_oper->get_own_right_operand();
40  auto rhs_no_cast = extract_cast_arg(rhs_owned.get());
41  if (!dynamic_cast<const Analyzer::Constant*>(rhs_no_cast)) {
42  return nullptr;
43  }
44  const auto arg = bin_oper->get_own_left_operand();
45  const auto& arg_ti = arg->get_type_info();
46  auto rhs = rhs_no_cast->deep_copy()->add_cast(arg_ti);
47  return makeExpr<Analyzer::InValues>(
48  arg, std::list<std::shared_ptr<Analyzer::Expr>>{rhs});
49  }
50  case kOR: {
51  return aggregateResult(visit(bin_oper->get_left_operand()),
52  visit(bin_oper->get_right_operand()));
53  }
54  default:
55  break;
56  }
57  return nullptr;
58  }
Definition: sqldefs.h:38
Definition: sqldefs.h:30
const Analyzer::Expr * extract_cast_arg(const Analyzer::Expr *expr)
Definition: Execute.h:164
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:439
const std::shared_ptr< Analyzer::Expr > get_own_left_operand() const
Definition: Analyzer.h:444
const std::shared_ptr< Analyzer::Expr > get_own_right_operand() const
Definition: Analyzer.h:447
std::shared_ptr< Analyzer::InValues > visit(const Analyzer::Expr *expr) const
const Expr * get_right_operand() const
Definition: Analyzer.h:443
const Expr * get_left_operand() const
Definition: Analyzer.h:442
+ 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 90 of file ExpressionRewrite.cpp.

91  {
92  return nullptr;
93  }

◆ 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 105 of file ExpressionRewrite.cpp.

106  {
107  return nullptr;
108  }

◆ 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 75 of file ExpressionRewrite.cpp.

76  {
77  return nullptr;
78  }

◆ 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 120 of file ExpressionRewrite.cpp.

121  {
122  return nullptr;
123  }

◆ 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 115 of file ExpressionRewrite.cpp.

116  {
117  return nullptr;
118  }

◆ 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 110 of file ExpressionRewrite.cpp.

111  {
112  return nullptr;
113  }

◆ 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 125 of file ExpressionRewrite.cpp.

126  {
127  return nullptr;
128  }

◆ 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 70 of file ExpressionRewrite.cpp.

71  {
72  return nullptr;
73  }

◆ 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 65 of file ExpressionRewrite.cpp.

66  {
67  return nullptr;
68  }

◆ 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 80 of file ExpressionRewrite.cpp.

81  {
82  return nullptr;
83  }

◆ 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 95 of file ExpressionRewrite.cpp.

96  {
97  return nullptr;
98  }

◆ 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 130 of file ExpressionRewrite.cpp.

131  {
132  return nullptr;
133  }

◆ 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 100 of file ExpressionRewrite.cpp.

101  {
102  return nullptr;
103  }

◆ visitSampleRatio()

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

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

Definition at line 85 of file ExpressionRewrite.cpp.

86  {
87  return nullptr;
88  }

◆ 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 60 of file ExpressionRewrite.cpp.

61  {
62  return nullptr;
63  }

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