OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeospatialFunctionFinder Class Reference

#include <GeospatialFunctionFinder.h>

+ Inheritance diagram for GeospatialFunctionFinder:
+ Collaboration diagram for GeospatialFunctionFinder:

Public Member Functions

const std::vector< const
Analyzer::ColumnVar * > & 
getGeoArgCvs () const
 
const std::pair< int, int > getTableIdsOfGeoExpr () const
 
const std::string & getGeoFunctionName () const
 
- Public Member Functions inherited from ScalarExprVisitor< void * >
void * visit (const Analyzer::Expr *expr) const
 

Protected Member Functions

void * visitGeoExpr (const Analyzer::GeoExpr *geo_expr) const override
 
void * visitFunctionOper (const Analyzer::FunctionOper *func_oper) const override
 
- Protected Member Functions inherited from ScalarExprVisitor< void * >
virtual void * visitVar (const Analyzer::Var *) const
 
virtual void * visitColumnVar (const Analyzer::ColumnVar *) const
 
virtual void * visitColumnVarTuple (const Analyzer::ExpressionTuple *) const
 
virtual void * visitConstant (const Analyzer::Constant *) const
 
virtual void * visitUOper (const Analyzer::UOper *uoper) const
 
virtual void * visitBinOper (const Analyzer::BinOper *bin_oper) const
 
virtual void * visitInValues (const Analyzer::InValues *in_values) const
 
virtual void * visitInIntegerSet (const Analyzer::InIntegerSet *in_integer_set) const
 
virtual void * visitCharLength (const Analyzer::CharLengthExpr *char_length) const
 
virtual void * visitKeyForString (const Analyzer::KeyForStringExpr *key_for_string) const
 
virtual void * visitSampleRatio (const Analyzer::SampleRatioExpr *sample_ratio) const
 
virtual void * visitStringOper (const Analyzer::StringOper *string_oper) const
 
virtual void * visitCardinality (const Analyzer::CardinalityExpr *cardinality) const
 
virtual void * visitLikeExpr (const Analyzer::LikeExpr *like) const
 
virtual void * visitRegexpExpr (const Analyzer::RegexpExpr *regexp) const
 
virtual void * visitWidthBucket (const Analyzer::WidthBucketExpr *width_bucket_expr) const
 
virtual void * visitCaseExpr (const Analyzer::CaseExpr *case_) const
 
virtual void * visitDatetruncExpr (const Analyzer::DatetruncExpr *datetrunc) const
 
virtual void * visitExtractExpr (const Analyzer::ExtractExpr *extract) const
 
virtual void * visitFunctionOperWithCustomTypeHandling (const Analyzer::FunctionOperWithCustomTypeHandling *func_oper) const
 
virtual void * visitArrayOper (Analyzer::ArrayExpr const *array_expr) const
 
virtual void * visitGeoUOper (const Analyzer::GeoUOper *geo_expr) const
 
virtual void * visitGeoBinOper (const Analyzer::GeoBinOper *geo_expr) const
 
virtual void * visitWindowFunction (const Analyzer::WindowFunction *window_func) const
 
virtual void * visitDatediffExpr (const Analyzer::DatediffExpr *datediff) const
 
virtual void * visitDateaddExpr (const Analyzer::DateaddExpr *dateadd) const
 
virtual void * visitLikelihood (const Analyzer::LikelihoodExpr *likelihood) const
 
virtual void * visitOffsetInFragment (const Analyzer::OffsetInFragment *) const
 
virtual void * visitAggExpr (const Analyzer::AggExpr *agg) const
 
virtual void * visitRangeJoinOper (const Analyzer::RangeOper *range_oper) const
 
virtual void * aggregateResult (const void *&aggregate, const void *&next_result) const
 
virtual void visitBegin () const
 
virtual void * defaultResult () const
 

Private Attributes

std::vector< const
Analyzer::ColumnVar * > 
geo_arg_cvs_
 
std::string geo_func_name_ {""}
 

Detailed Description

Definition at line 24 of file GeospatialFunctionFinder.h.

Member Function Documentation

const std::vector< const Analyzer::ColumnVar * > & GeospatialFunctionFinder::getGeoArgCvs ( ) const

Definition at line 20 of file GeospatialFunctionFinder.cpp.

References geo_arg_cvs_.

Referenced by anonymous_namespace{FromTableReordering.cpp}::get_join_qual_cost().

21  {
22  return geo_arg_cvs_;
23 }
std::vector< const Analyzer::ColumnVar * > geo_arg_cvs_

+ Here is the caller graph for this function:

const std::string & GeospatialFunctionFinder::getGeoFunctionName ( ) const

Definition at line 50 of file GeospatialFunctionFinder.cpp.

References geo_func_name_.

Referenced by anonymous_namespace{FromTableReordering.cpp}::get_join_qual_cost().

50  {
51  return geo_func_name_;
52 }

+ Here is the caller graph for this function:

const std::pair< int, int > GeospatialFunctionFinder::getTableIdsOfGeoExpr ( ) const

Definition at line 25 of file GeospatialFunctionFinder.cpp.

References geo_arg_cvs_.

Referenced by anonymous_namespace{FromTableReordering.cpp}::get_join_qual_cost().

25  {
26  // we assume we do not use self geo join and n-ary geo join
27  if (!geo_arg_cvs_.empty()) {
28  std::unordered_set<int> tableIds;
29  std::for_each(geo_arg_cvs_.cbegin(),
30  geo_arg_cvs_.cend(),
31  [&tableIds](const Analyzer::ColumnVar* cv) {
32  tableIds.emplace(cv->get_table_id());
33  });
34  if (tableIds.size() == 2) {
35  const int inner_table_id = geo_arg_cvs_.front()->get_table_id();
36  int outer_table_id = -1;
37  std::for_each(tableIds.cbegin(),
38  tableIds.cend(),
39  [&inner_table_id, &outer_table_id](const int table_id) {
40  if (table_id != inner_table_id) {
41  outer_table_id = table_id;
42  }
43  });
44  return std::make_pair(inner_table_id, outer_table_id);
45  }
46  }
47  return std::make_pair(-1, -1);
48 }
std::vector< const Analyzer::ColumnVar * > geo_arg_cvs_

+ Here is the caller graph for this function:

void * GeospatialFunctionFinder::visitFunctionOper ( const Analyzer::FunctionOper func_oper) const
overrideprotectedvirtual

Reimplemented from ScalarExprVisitor< void * >.

Definition at line 54 of file GeospatialFunctionFinder.cpp.

References geo_arg_cvs_, geo_func_name_, Analyzer::FunctionOper::getArg(), Analyzer::FunctionOper::getArity(), and Analyzer::FunctionOper::getName().

55  {
56  geo_func_name_ = func_oper->getName();
57  for (size_t i = 0; i < func_oper->getArity(); i++) {
58  if (auto cv = dynamic_cast<const Analyzer::ColumnVar*>(func_oper->getArg(i))) {
59  geo_arg_cvs_.push_back(cv);
60  }
61  }
62  return nullptr;
63 }
size_t getArity() const
Definition: Analyzer.h:2404
std::vector< const Analyzer::ColumnVar * > geo_arg_cvs_
const Analyzer::Expr * getArg(const size_t i) const
Definition: Analyzer.h:2406
std::string getName() const
Definition: Analyzer.h:2402

+ Here is the call graph for this function:

void * GeospatialFunctionFinder::visitGeoExpr ( const Analyzer::GeoExpr geo_expr) const
overrideprotectedvirtual

Reimplemented from ScalarExprVisitor< void * >.

Definition at line 65 of file GeospatialFunctionFinder.cpp.

References geo_arg_cvs_, and Analyzer::GeoExpr::getChildExprs().

65  {
66  for (auto arg : geo_expr->getChildExprs()) {
67  if (auto cv = dynamic_cast<const Analyzer::ColumnVar*>(arg)) {
68  geo_arg_cvs_.push_back(cv);
69  }
70  }
71  return nullptr;
72 }
virtual std::vector< Analyzer::Expr * > getChildExprs() const
Definition: Analyzer.h:2860
std::vector< const Analyzer::ColumnVar * > geo_arg_cvs_

+ Here is the call graph for this function:

Member Data Documentation

std::vector<const Analyzer::ColumnVar*> GeospatialFunctionFinder::geo_arg_cvs_
mutableprivate
std::string GeospatialFunctionFinder::geo_func_name_ {""}
mutableprivate

Definition at line 36 of file GeospatialFunctionFinder.h.

Referenced by getGeoFunctionName(), and visitFunctionOper().


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