OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::InValues
visitBinOper (const Analyzer::BinOper *bin_oper) const override
 
std::shared_ptr
< Analyzer::InValues
visitUOper (const Analyzer::UOper *uoper) const override
 
std::shared_ptr
< Analyzer::InValues
visitInValues (const Analyzer::InValues *) const override
 
std::shared_ptr
< Analyzer::InValues
visitInIntegerSet (const Analyzer::InIntegerSet *) const override
 
std::shared_ptr
< Analyzer::InValues
visitCharLength (const Analyzer::CharLengthExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitKeyForString (const Analyzer::KeyForStringExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitCardinality (const Analyzer::CardinalityExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitLikeExpr (const Analyzer::LikeExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitRegexpExpr (const Analyzer::RegexpExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitCaseExpr (const Analyzer::CaseExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitDatetruncExpr (const Analyzer::DatetruncExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitDatediffExpr (const Analyzer::DatediffExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitDateaddExpr (const Analyzer::DateaddExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitExtractExpr (const Analyzer::ExtractExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitLikelihood (const Analyzer::LikelihoodExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitAggExpr (const Analyzer::AggExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
aggregateResult (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::InValues
visitVar (const Analyzer::Var *) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitColumnVar (const Analyzer::ColumnVar *) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitColumnVarTuple (const Analyzer::ExpressionTuple *) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitConstant (const Analyzer::Constant *) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitLower (const Analyzer::LowerExpr *lower_expr) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitFunctionOperWithCustomTypeHandling (const Analyzer::FunctionOperWithCustomTypeHandling *func_oper) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitArrayOper (Analyzer::ArrayExpr const *array_expr) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitGeoExpr (const Analyzer::GeoExpr *geo_expr) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitFunctionOper (const Analyzer::FunctionOper *func_oper) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitWindowFunction (const Analyzer::WindowFunction *window_func) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitOffsetInFragment (const Analyzer::OffsetInFragment *) const
 
virtual std::shared_ptr
< Analyzer::InValues
defaultResult () const
 

Additional Inherited Members

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

Detailed Description

Definition at line 33 of file ExpressionRewrite.cpp.

Member Function Documentation

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

137  {
138  if (!lhs || !rhs) {
139  return nullptr;
140  }
141  if (!(*lhs->get_arg() == *rhs->get_arg())) {
142  return nullptr;
143  }
144  auto union_values = lhs->get_value_list();
145  const auto& rhs_values = rhs->get_value_list();
146  union_values.insert(union_values.end(), rhs_values.begin(), rhs_values.end());
147  return makeExpr<Analyzer::InValues>(lhs->get_own_arg(), union_values);
148  }
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 130 of file ExpressionRewrite.cpp.

131  {
132  return nullptr;
133  }
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  }
const Expr * get_right_operand() const
Definition: Analyzer.h:437
Definition: sqldefs.h:38
Definition: sqldefs.h:30
const Analyzer::Expr * extract_cast_arg(const Analyzer::Expr *expr)
Definition: Execute.h:152
std::shared_ptr< Analyzer::InValues > visit(const Analyzer::Expr *expr) const
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:433
const Expr * get_left_operand() const
Definition: Analyzer.h:436
const std::shared_ptr< Analyzer::Expr > get_own_right_operand() const
Definition: Analyzer.h:441
const std::shared_ptr< Analyzer::Expr > get_own_left_operand() const
Definition: Analyzer.h:438

+ Here is the call graph for this function:

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

86  {
87  return nullptr;
88  }
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 100 of file ExpressionRewrite.cpp.

101  {
102  return nullptr;
103  }
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  }
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 115 of file ExpressionRewrite.cpp.

116  {
117  return nullptr;
118  }
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 110 of file ExpressionRewrite.cpp.

111  {
112  return nullptr;
113  }
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 105 of file ExpressionRewrite.cpp.

106  {
107  return nullptr;
108  }
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 120 of file ExpressionRewrite.cpp.

121  {
122  return nullptr;
123  }
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  }
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  }
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  }
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 90 of file ExpressionRewrite.cpp.

91  {
92  return nullptr;
93  }
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 125 of file ExpressionRewrite.cpp.

126  {
127  return nullptr;
128  }
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 95 of file ExpressionRewrite.cpp.

96  {
97  return nullptr;
98  }
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: