OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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
visitSampleRatio (const Analyzer::SampleRatioExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitMLPredict (const Analyzer::MLPredictExpr *) const override
 
std::shared_ptr
< Analyzer::InValues
visitPCAProject (const Analyzer::PCAProjectExpr *) 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
visitGeoExpr (const Analyzer::GeoExpr *geo_expr) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitStringOper (const Analyzer::StringOper *string_oper) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitWidthBucket (const Analyzer::WidthBucketExpr *width_bucket_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
visitGeoUOper (const Analyzer::GeoUOper *geo_expr) const
 
virtual std::shared_ptr
< Analyzer::InValues
visitGeoBinOper (const Analyzer::GeoBinOper *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
visitRangeJoinOper (const Analyzer::RangeOper *range_oper) const
 
virtual void visitBegin () 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 34 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 151 of file ExpressionRewrite.cpp.

153  {
154  if (!lhs || !rhs) {
155  return nullptr;
156  }
157 
158  if (lhs->get_arg()->get_type_info() == rhs->get_arg()->get_type_info() &&
159  (*lhs->get_arg() == *rhs->get_arg())) {
160  auto union_values = lhs->get_value_list();
161  const auto& rhs_values = rhs->get_value_list();
162  union_values.insert(union_values.end(), rhs_values.begin(), rhs_values.end());
163  return makeExpr<Analyzer::InValues>(lhs->get_own_arg(), union_values);
164  }
165  return nullptr;
166  }
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 146 of file ExpressionRewrite.cpp.

147  {
148  return nullptr;
149  }
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 36 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.

37  {
38  switch (bin_oper->get_optype()) {
39  case kEQ: {
40  const auto rhs_owned = bin_oper->get_own_right_operand();
41  auto rhs_no_cast = extract_cast_arg(rhs_owned.get());
42  if (!dynamic_cast<const Analyzer::Constant*>(rhs_no_cast)) {
43  return nullptr;
44  }
45  const auto arg = bin_oper->get_own_left_operand();
46  const auto& arg_ti = arg->get_type_info();
47  auto rhs = rhs_no_cast->deep_copy()->add_cast(arg_ti);
48  return makeExpr<Analyzer::InValues>(
49  arg, std::list<std::shared_ptr<Analyzer::Expr>>{rhs});
50  }
51  case kOR: {
52  return aggregateResult(visit(bin_oper->get_left_operand()),
53  visit(bin_oper->get_right_operand()));
54  }
55  default:
56  break;
57  }
58  return nullptr;
59  }
const Expr * get_right_operand() const
Definition: Analyzer.h:456
Definition: sqldefs.h:40
Definition: sqldefs.h:32
const Analyzer::Expr * extract_cast_arg(const Analyzer::Expr *expr)
Definition: Execute.h:222
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:452
const Expr * get_left_operand() const
Definition: Analyzer.h:455
const std::shared_ptr< Analyzer::Expr > get_own_right_operand() const
Definition: Analyzer.h:460
const std::shared_ptr< Analyzer::Expr > get_own_left_operand() const
Definition: Analyzer.h:457

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

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

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

77  {
78  return nullptr;
79  }
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 131 of file ExpressionRewrite.cpp.

132  {
133  return nullptr;
134  }
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 126 of file ExpressionRewrite.cpp.

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

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

137  {
138  return nullptr;
139  }
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 71 of file ExpressionRewrite.cpp.

72  {
73  return nullptr;
74  }
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 66 of file ExpressionRewrite.cpp.

67  {
68  return nullptr;
69  }
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 81 of file ExpressionRewrite.cpp.

82  {
83  return nullptr;
84  }
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 106 of file ExpressionRewrite.cpp.

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

142  {
143  return nullptr;
144  }
std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitMLPredict ( const Analyzer::MLPredictExpr ) const
inlineoverrideprotectedvirtual

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

Definition at line 91 of file ExpressionRewrite.cpp.

92  {
93  return nullptr;
94  }
std::shared_ptr<Analyzer::InValues> anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitPCAProject ( const Analyzer::PCAProjectExpr ) const
inlineoverrideprotectedvirtual

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

Definition at line 96 of file ExpressionRewrite.cpp.

97  {
98  return nullptr;
99  }
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 111 of file ExpressionRewrite.cpp.

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

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

62  {
63  return nullptr;
64  }

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