OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Analyzer::GeoOperator Class Reference

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::GeoOperator:
+ Collaboration diagram for Analyzer::GeoOperator:

Public Member Functions

 GeoOperator (const SQLTypeInfo &ti, const std::string &name, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const std::optional< int > &output_srid_override=std::nullopt)
 
std::shared_ptr< Analyzer::Exprdeep_copy () const override
 
void collect_rte_idx (std::set< int > &rte_idx_set) const final
 
void collect_column_var (std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const final
 
std::string toString () const override
 
bool operator== (const Expr &) const override
 
size_t size () const
 
Analyzer::ExprgetOperand (const size_t index) const
 
const std::string & getName () const
 
std::vector< std::shared_ptr
< Analyzer::Expr > > 
getArgs () const
 
std::vector< Analyzer::Expr * > getChildExprs () const override
 
std::shared_ptr< Analyzer::Expradd_cast (const SQLTypeInfo &new_type_info) final
 
auto getOutputSridOverride () const
 
- Public Member Functions inherited from Analyzer::GeoExpr
 GeoExpr (const SQLTypeInfo &ti)
 
- Public Member Functions inherited from Analyzer::Expr
 Expr (SQLTypes t, bool notnull)
 
 Expr (SQLTypes t, int d, bool notnull)
 
 Expr (SQLTypes t, int d, int s, bool notnull)
 
 Expr (const SQLTypeInfo &ti, bool has_agg=false)
 
virtual ~Expr ()
 
std::shared_ptr< Analyzer::Exprget_shared_ptr ()
 
const SQLTypeInfoget_type_info () const
 
void set_type_info (const SQLTypeInfo &ti)
 
bool get_contains_agg () const
 
void set_contains_agg (bool a)
 
virtual void check_group_by (const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const
 
virtual std::shared_ptr
< Analyzer::Expr
normalize_simple_predicate (int &rte_idx) const
 
virtual void group_predicates (std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const
 
virtual size_t get_num_column_vars (const bool include_agg) const
 
virtual std::shared_ptr
< Analyzer::Expr
rewrite_with_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
 
virtual std::shared_ptr
< Analyzer::Expr
rewrite_with_child_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
 
virtual std::shared_ptr
< Analyzer::Expr
rewrite_agg_to_var (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
 
virtual void print () const
 
virtual void add_unique (std::list< const Expr * > &expr_list) const
 
virtual void find_expr (std::function< bool(const Expr *)> f, std::list< const Expr * > &expr_list) const
 
std::shared_ptr< Analyzer::Exprdecompress ()
 
virtual void get_domain (DomainSet &domain_set) const
 

Protected Attributes

const std::string name_
 
const std::vector
< std::shared_ptr
< Analyzer::Expr > > 
args_
 
std::optional< int > output_srid_override_
 
- Protected Attributes inherited from Analyzer::Expr
SQLTypeInfo type_info
 
bool contains_agg
 

Detailed Description

GeoOperator: A geo expression that transforms or accesses an input. Typically a geospatial function prefixed with ST_

Definition at line 2925 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::GeoOperator::GeoOperator ( const SQLTypeInfo ti,
const std::string &  name,
const std::vector< std::shared_ptr< Analyzer::Expr >> &  args,
const std::optional< int > &  output_srid_override = std::nullopt 
)

Definition at line 3921 of file Analyzer.cpp.

3925  : GeoExpr(ti)
3926  , name_(name)
3927  , args_(args)
3928  , output_srid_override_(output_srid_override) {}
std::optional< int > output_srid_override_
Definition: Analyzer.h:2971
string name
Definition: setup.in.py:72
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968
const std::string name_
Definition: Analyzer.h:2967
GeoExpr(const SQLTypeInfo &ti)
Definition: Analyzer.h:2862

Member Function Documentation

std::shared_ptr< Analyzer::Expr > Analyzer::GeoOperator::add_cast ( const SQLTypeInfo new_type_info)
finalvirtual

Reimplemented from Analyzer::Expr.

Definition at line 3991 of file Analyzer.cpp.

References run_benchmark_import::args, args_, CHECK, deep_copy(), Analyzer::Expr::get_type_info(), SQLTypeInfo::is_geometry(), kCAST, name_, and output_srid_override_.

3991  {
3992  if (get_type_info().is_geometry()) {
3993  std::vector<std::shared_ptr<Analyzer::Expr>> args;
3994  for (size_t i = 0; i < args_.size(); i++) {
3995  args.push_back(args_[i]->deep_copy());
3996  }
3997  CHECK(new_type_info.is_geometry());
3998  return makeExpr<GeoOperator>(new_type_info, name_, args, output_srid_override_);
3999  } else {
4000  auto new_expr = deep_copy();
4001  return makeExpr<UOper>(new_type_info, /*contains_agg=*/false, kCAST, new_expr);
4002  }
4003 }
std::optional< int > output_srid_override_
Definition: Analyzer.h:2971
Definition: sqldefs.h:48
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:3930
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:79
#define CHECK(condition)
Definition: Logger.h:291
bool is_geometry() const
Definition: sqltypes.h:592
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968
const std::string name_
Definition: Analyzer.h:2967

+ Here is the call graph for this function:

void Analyzer::GeoOperator::collect_column_var ( std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &  colvar_set,
bool  include_agg 
) const
finalvirtual

Reimplemented from Analyzer::Expr.

Definition at line 3945 of file Analyzer.cpp.

References getOperand(), and size().

3947  {
3948  for (size_t i = 0; i < size(); i++) {
3949  const auto expr = getOperand(i);
3950  expr->collect_column_var(colvar_set, include_agg);
3951  }
3952 }
size_t size() const
Definition: Analyzer.cpp:3982
Analyzer::Expr * getOperand(const size_t index) const
Definition: Analyzer.cpp:3986

+ Here is the call graph for this function:

void Analyzer::GeoOperator::collect_rte_idx ( std::set< int > &  rte_idx_set) const
finalvirtual

Reimplemented from Analyzer::Expr.

Definition at line 3938 of file Analyzer.cpp.

References getOperand(), and size().

3938  {
3939  for (size_t i = 0; i < size(); i++) {
3940  const auto expr = getOperand(i);
3941  expr->collect_rte_idx(rte_idx_set);
3942  }
3943 }
size_t size() const
Definition: Analyzer.cpp:3982
Analyzer::Expr * getOperand(const size_t index) const
Definition: Analyzer.cpp:3986

+ Here is the call graph for this function:

std::shared_ptr< Analyzer::Expr > Analyzer::GeoOperator::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Reimplemented in Analyzer::GeoTransformOperator.

Definition at line 3930 of file Analyzer.cpp.

References run_benchmark_import::args, args_, name_, output_srid_override_, and Analyzer::Expr::type_info.

Referenced by add_cast().

3930  {
3931  std::vector<std::shared_ptr<Analyzer::Expr>> args;
3932  for (size_t i = 0; i < args_.size(); i++) {
3933  args.push_back(args_[i]->deep_copy());
3934  }
3935  return makeExpr<GeoOperator>(type_info, name_, args, output_srid_override_);
3936 }
std::optional< int > output_srid_override_
Definition: Analyzer.h:2971
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:3930
SQLTypeInfo type_info
Definition: Analyzer.h:180
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968
const std::string name_
Definition: Analyzer.h:2967

+ Here is the caller graph for this function:

std::vector<std::shared_ptr<Analyzer::Expr> > Analyzer::GeoOperator::getArgs ( ) const
inline

Definition at line 2951 of file Analyzer.h.

References args_.

2951 { return args_; }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968
std::vector<Analyzer::Expr*> Analyzer::GeoOperator::getChildExprs ( ) const
inlineoverridevirtual

Reimplemented from Analyzer::GeoExpr.

Definition at line 2953 of file Analyzer.h.

References args_.

2953  {
2954  std::vector<Analyzer::Expr*> ret;
2955  ret.reserve(args_.size());
2956  for (const auto& arg : args_) {
2957  ret.push_back(arg.get());
2958  }
2959  return ret;
2960  }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968
const std::string& Analyzer::GeoOperator::getName ( ) const
inline

Definition at line 2949 of file Analyzer.h.

References name_.

Referenced by spatial_type::PointAccessors::codegen(), CodeGenerator::codegenGeoOperator(), spatial_type::PointConstructor::codegenLoads(), spatial_type::Codegen::getName(), spatial_type::Codegen::init(), operator==(), and Analyzer::GeoTransformOperator::operator==().

2949 { return name_; }
const std::string name_
Definition: Analyzer.h:2967

+ Here is the caller graph for this function:

Analyzer::Expr * Analyzer::GeoOperator::getOperand ( const size_t  index) const

Definition at line 3986 of file Analyzer.cpp.

References args_, and CHECK_LT.

Referenced by collect_column_var(), collect_rte_idx(), spatial_type::NPoints::getOperand(), spatial_type::NRings::getOperand(), spatial_type::NumGeometries::getOperand(), spatial_type::Codegen::getOperand(), spatial_type::NumGeometries::getOperandTypeInfo(), operator==(), and Analyzer::GeoTransformOperator::operator==().

3986  {
3987  CHECK_LT(index, args_.size());
3988  return args_[index].get();
3989 }
#define CHECK_LT(x, y)
Definition: Logger.h:303
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968

+ Here is the caller graph for this function:

auto Analyzer::GeoOperator::getOutputSridOverride ( ) const
inline

Definition at line 2964 of file Analyzer.h.

References output_srid_override_.

2964 { return output_srid_override_; }
std::optional< int > output_srid_override_
Definition: Analyzer.h:2971
bool Analyzer::GeoOperator::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Reimplemented in Analyzer::GeoTransformOperator.

Definition at line 3963 of file Analyzer.cpp.

References args_, getName(), getOperand(), and size().

3963  {
3964  if (typeid(rhs) != typeid(GeoOperator)) {
3965  return false;
3966  }
3967  const GeoOperator& rhs_go = dynamic_cast<const GeoOperator&>(rhs);
3968  if (getName() != rhs_go.getName()) {
3969  return false;
3970  }
3971  if (rhs_go.size() != size()) {
3972  return false;
3973  }
3974  for (size_t i = 0; i < size(); i++) {
3975  if (args_[i].get() != rhs_go.getOperand(i)) {
3976  return false;
3977  }
3978  }
3979  return true;
3980 }
const std::string & getName() const
Definition: Analyzer.h:2949
GeoOperator(const SQLTypeInfo &ti, const std::string &name, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const std::optional< int > &output_srid_override=std::nullopt)
Definition: Analyzer.cpp:3921
size_t size() const
Definition: Analyzer.cpp:3982
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968

+ Here is the call graph for this function:

size_t Analyzer::GeoOperator::size ( ) const

Definition at line 3982 of file Analyzer.cpp.

References args_.

Referenced by spatial_type::AreaPerimeter::AreaPerimeter(), spatial_type::Centroid::Centroid(), collect_column_var(), collect_rte_idx(), spatial_type::Distance::Distance(), spatial_type::Codegen::getOperand(), operator==(), Analyzer::GeoTransformOperator::operator==(), spatial_type::PointAccessors::PointAccessors(), spatial_type::PointConstructor::PointConstructor(), spatial_type::PointN::PointN(), spatial_type::StartEndPoint::StartEndPoint(), and spatial_type::Transform::Transform().

3982  {
3983  return args_.size();
3984 }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968

+ Here is the caller graph for this function:

std::string Analyzer::GeoOperator::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Reimplemented in Analyzer::GeoTransformOperator.

Definition at line 3954 of file Analyzer.cpp.

References args_, and name_.

Referenced by CodeGenerator::codegenGeoOperator(), and spatial_type::PointAccessors::codegenLoads().

3954  {
3955  std::string str{"(" + name_ + " "};
3956  for (const auto& arg : args_) {
3957  str += arg->toString();
3958  }
3959  str += ")";
3960  return str;
3961 }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:2968
const std::string name_
Definition: Analyzer.h:2967

+ Here is the caller graph for this function:

Member Data Documentation

const std::string Analyzer::GeoOperator::name_
protected
std::optional<int> Analyzer::GeoOperator::output_srid_override_
protected

Definition at line 2971 of file Analyzer.h.

Referenced by add_cast(), deep_copy(), and getOutputSridOverride().


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