OmniSciDB  b28c0d5765
 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
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 36 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 143 of file ExpressionRewrite.cpp.

145  {
146  if (!lhs || !rhs) {
147  return nullptr;
148  }
149 
150  if (lhs->get_arg()->get_type_info() == rhs->get_arg()->get_type_info() &&
151  (*lhs->get_arg() == *rhs->get_arg())) {
152  auto union_values = lhs->get_value_list();
153  const auto& rhs_values = rhs->get_value_list();
154  union_values.insert(union_values.end(), rhs_values.begin(), rhs_values.end());
155  return makeExpr<Analyzer::InValues>(lhs->get_own_arg(), union_values);
156  }
157  return nullptr;
158  }
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 138 of file ExpressionRewrite.cpp.

139  {
140  return nullptr;
141  }
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 38 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.

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

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

94  {
95  return nullptr;
96  }
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 108 of file ExpressionRewrite.cpp.

109  {
110  return nullptr;
111  }
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 78 of file ExpressionRewrite.cpp.

79  {
80  return nullptr;
81  }
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 123 of file ExpressionRewrite.cpp.

124  {
125  return nullptr;
126  }
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 118 of file ExpressionRewrite.cpp.

119  {
120  return nullptr;
121  }
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 113 of file ExpressionRewrite.cpp.

114  {
115  return nullptr;
116  }
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 128 of file ExpressionRewrite.cpp.

129  {
130  return nullptr;
131  }
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 73 of file ExpressionRewrite.cpp.

74  {
75  return nullptr;
76  }
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 68 of file ExpressionRewrite.cpp.

69  {
70  return nullptr;
71  }
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 83 of file ExpressionRewrite.cpp.

84  {
85  return nullptr;
86  }
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 98 of file ExpressionRewrite.cpp.

99  {
100  return nullptr;
101  }
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 133 of file ExpressionRewrite.cpp.

134  {
135  return nullptr;
136  }
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 103 of file ExpressionRewrite.cpp.

104  {
105  return nullptr;
106  }
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 88 of file ExpressionRewrite.cpp.

89  {
90  return nullptr;
91  }
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 63 of file ExpressionRewrite.cpp.

64  {
65  return nullptr;
66  }

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