OmniSciDB  a5dc49c757
 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::optional
< GeoJoinOperandsTableKeyPair
getJoinTableKeyPair () 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 * visitMLPredict (const Analyzer::MLPredictExpr *ml_predict_expr) const
 
virtual void * visitPCAProject (const Analyzer::PCAProjectExpr *pca_project_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 31 of file GeospatialFunctionFinder.h.

Member Function Documentation

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

Definition at line 21 of file GeospatialFunctionFinder.cpp.

References geo_arg_cvs_.

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

22  {
23  return geo_arg_cvs_;
24 }
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 51 of file GeospatialFunctionFinder.cpp.

References geo_func_name_.

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

51  {
52  return geo_func_name_;
53 }

+ Here is the caller graph for this function:

const std::optional< GeoJoinOperandsTableKeyPair > GeospatialFunctionFinder::getJoinTableKeyPair ( ) const

Definition at line 27 of file GeospatialFunctionFinder.cpp.

References geo_arg_cvs_.

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

27  {
28  std::optional<GeoJoinOperandsTableKeyPair> ret;
29  // we assume we do not use self geo join and n-ary geo join
30  if (!geo_arg_cvs_.empty()) {
31  std::unordered_set<shared::TableKey> table_keys;
32  std::for_each(geo_arg_cvs_.cbegin(),
33  geo_arg_cvs_.cend(),
34  [&table_keys](const Analyzer::ColumnVar* cv) {
35  table_keys.emplace(cv->getTableKey());
36  });
37  if (table_keys.size() == 2) {
38  const auto inner_table_key = geo_arg_cvs_.front()->getTableKey();
39  std::for_each(table_keys.cbegin(),
40  table_keys.cend(),
41  [&inner_table_key, &ret](const shared::TableKey& table_key) {
42  if (table_key != inner_table_key) {
43  ret = {inner_table_key, table_key};
44  }
45  });
46  }
47  }
48  return ret;
49 }
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 55 of file GeospatialFunctionFinder.cpp.

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

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

+ 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 66 of file GeospatialFunctionFinder.cpp.

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

66  {
67  for (auto arg : geo_expr->getChildExprs()) {
68  if (auto cv = dynamic_cast<const Analyzer::ColumnVar*>(arg)) {
69  geo_arg_cvs_.push_back(cv);
70  }
71  }
72  return nullptr;
73 }
virtual std::vector< Analyzer::Expr * > getChildExprs() const
Definition: Analyzer.h:3222
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 43 of file GeospatialFunctionFinder.h.

Referenced by getGeoFunctionName(), and visitFunctionOper().


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