OmniSciDB  6686921089
 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
visitLower (const Analyzer::LowerExpr *lower_expr) 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
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 35 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 142 of file ExpressionRewrite.cpp.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

63  {
64  return nullptr;
65  }

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