OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Analyzer::GeoConstant Class Reference

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::GeoConstant:
+ Collaboration diagram for Analyzer::GeoConstant:

Public Member Functions

 GeoConstant (std::unique_ptr< Geospatial::GeoBase > &&geo, const SQLTypeInfo &ti)
 
std::shared_ptr< Analyzer::Exprdeep_copy () const final
 
std::string toString () const final
 
bool operator== (const Expr &) const final
 
size_t physicalCols () const
 
std::shared_ptr
< Analyzer::Constant
makePhysicalConstant (const size_t index) 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 std::shared_ptr
< Analyzer::Expr
add_cast (const SQLTypeInfo &new_type_info)
 
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 void collect_rte_idx (std::set< int > &rte_idx_set) const
 
virtual void collect_column_var (std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, 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 (bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const
 
std::shared_ptr< Analyzer::Exprdecompress ()
 
virtual void get_domain (DomainSet &domain_set) const
 

Private Attributes

std::unique_ptr
< Geospatial::GeoBase
geo_
 

Additional Inherited Members

- Protected Attributes inherited from Analyzer::Expr
SQLTypeInfo type_info
 
bool contains_agg
 

Detailed Description

Definition at line 1711 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::GeoConstant::GeoConstant ( std::unique_ptr< Geospatial::GeoBase > &&  geo,
const SQLTypeInfo ti 
)

Definition at line 3323 of file Analyzer.cpp.

References CHECK, geo_, Analyzer::anonymous_namespace{Analyzer.cpp}::get_ti_from_geo(), SQLTypeInfo::get_type(), and SQLTypeInfo::get_type_name().

3325  : GeoExpr(ti), geo_(std::move(geo)) {
3326  CHECK(geo_);
3327  if (get_ti_from_geo(geo_.get()) != ti.get_type()) {
3328  throw std::runtime_error("Conflicting types for geo data " + geo_->getWktString() +
3329  " (type provided: " + ti.get_type_name() + ")");
3330  }
3331 }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:314
std::unique_ptr< Geospatial::GeoBase > geo_
Definition: Analyzer.h:1726
std::string get_type_name() const
Definition: sqltypes.h:417
#define CHECK(condition)
Definition: Logger.h:206
SQLTypes get_ti_from_geo(const Geospatial::GeoBase *geo)
Definition: Analyzer.cpp:3299
GeoExpr(const SQLTypeInfo &ti)
Definition: Analyzer.h:1676

+ Here is the call graph for this function:

Member Function Documentation

std::shared_ptr< Analyzer::Expr > Analyzer::GeoConstant::deep_copy ( ) const
finalvirtual

Implements Analyzer::Expr.

Definition at line 3333 of file Analyzer.cpp.

References CHECK, geo_, and Analyzer::Expr::type_info.

3333  {
3334  CHECK(geo_);
3335  return makeExpr<GeoConstant>(geo_->clone(), type_info);
3336 }
std::unique_ptr< Geospatial::GeoBase > geo_
Definition: Analyzer.h:1726
SQLTypeInfo type_info
Definition: Analyzer.h:176
#define CHECK(condition)
Definition: Logger.h:206
std::shared_ptr< Analyzer::Constant > Analyzer::GeoConstant::makePhysicalConstant ( const size_t  index) const

Definition at line 3368 of file Analyzer.cpp.

References CHECK, CHECK_GE, CHECK_LE, Geospatial::convert_coords(), Geospatial::convert_rings(), geo_, SQLTypeInfo::get_comp_param(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_output_srid(), SQLTypeInfo::get_physical_coord_cols(), Geospatial::GeoTypesFactory::getGeoColumns(), kENCODING_GEOINT, Analyzer::Expr::type_info, and UNREACHABLE.

Referenced by CodeGenerator::codegenGeoConstant().

3369  {
3370  // TODO: handle bounds, etc
3371  const auto num_phys_coords = type_info.get_physical_coord_cols();
3372  CHECK_GE(num_phys_coords, 0);
3373  CHECK_LE(index, size_t(num_phys_coords));
3374  SQLTypeInfo ti = type_info;
3375 
3376  std::vector<double> coords;
3377  std::vector<double> bounds;
3378  std::vector<int> ring_sizes;
3379  std::vector<int> poly_rings;
3380 
3382  geo_->getWktString(), ti, coords, bounds, ring_sizes, poly_rings);
3383 
3384  if (ti.get_output_srid() == 4326) {
3385  // expect geo literals compressed by default
3386  CHECK(ti.get_compression() == kENCODING_GEOINT && ti.get_comp_param() == 32);
3387  }
3388 
3389  switch (index) {
3390  case 0: // coords
3391  return Geospatial::convert_coords(coords, ti);
3392  case 1: // ring sizes
3393  return Geospatial::convert_rings(ring_sizes);
3394  case 2: // poly rings
3395  return Geospatial::convert_rings(poly_rings);
3396  default:
3397  UNREACHABLE();
3398  }
3399 
3400  UNREACHABLE();
3401  return nullptr;
3402 }
#define UNREACHABLE()
Definition: Logger.h:250
#define CHECK_GE(x, y)
Definition: Logger.h:219
std::unique_ptr< Geospatial::GeoBase > geo_
Definition: Analyzer.h:1726
SQLTypeInfo type_info
Definition: Analyzer.h:176
std::shared_ptr< Analyzer::Constant > convert_rings(const std::vector< int > &rings)
Definition: Conversion.h:44
static bool getGeoColumns(const std::string &wkt_or_wkb_hex, SQLTypeInfo &ti, std::vector< double > &coords, std::vector< double > &bounds, std::vector< int > &ring_sizes, std::vector< int > &poly_rings, const bool promote_poly_to_mpoly=false)
Definition: Types.cpp:937
#define CHECK_LE(x, y)
Definition: Logger.h:217
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:322
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:323
std::shared_ptr< Analyzer::Constant > convert_coords(const std::vector< double > &coords, const SQLTypeInfo &ti)
Definition: Conversion.h:26
#define CHECK(condition)
Definition: Logger.h:206
int get_physical_coord_cols() const
Definition: sqltypes.h:350
HOST DEVICE int get_output_srid() const
Definition: sqltypes.h:320

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Analyzer::GeoConstant::operator== ( const Expr rhs) const
finalvirtual

Implements Analyzer::Expr.

Definition at line 3346 of file Analyzer.cpp.

References geo_, Analyzer::Expr::get_type_info(), and Analyzer::Expr::type_info.

3346  {
3347  if (typeid(rhs) != typeid(GeoConstant)) {
3348  return false;
3349  }
3350  const GeoConstant& rhs_c = dynamic_cast<const GeoConstant&>(rhs);
3351  if (type_info != rhs_c.get_type_info() /*|| is_null != rhs_c.get_is_null()*/) {
3352  return false;
3353  }
3354  /* TODO: constant nulls
3355  if (is_null && rhs_c.get_is_null()) {
3356  return true;
3357  }
3358 
3359  */
3360  return *geo_ == *rhs_c.geo_;
3361 }
GeoConstant(std::unique_ptr< Geospatial::GeoBase > &&geo, const SQLTypeInfo &ti)
Definition: Analyzer.cpp:3323
std::unique_ptr< Geospatial::GeoBase > geo_
Definition: Analyzer.h:1726
SQLTypeInfo type_info
Definition: Analyzer.h:176

+ Here is the call graph for this function:

size_t Analyzer::GeoConstant::physicalCols ( ) const

Definition at line 3363 of file Analyzer.cpp.

References CHECK, SQLTypeInfo::get_physical_coord_cols(), SQLTypeInfo::is_geometry(), and Analyzer::Expr::type_info.

Referenced by CodeGenerator::codegenGeoConstant().

3363  {
3366 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
#define CHECK(condition)
Definition: Logger.h:206
bool is_geometry() const
Definition: sqltypes.h:501
int get_physical_coord_cols() const
Definition: sqltypes.h:350

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string Analyzer::GeoConstant::toString ( ) const
finalvirtual

Implements Analyzer::Expr.

Definition at line 3338 of file Analyzer.cpp.

References CHECK, and geo_.

3338  {
3339  std::string str{"(GeoConst "};
3340  CHECK(geo_);
3341  str += geo_->getWktString();
3342  str += ") ";
3343  return str;
3344 }
std::unique_ptr< Geospatial::GeoBase > geo_
Definition: Analyzer.h:1726
#define CHECK(condition)
Definition: Logger.h:206

Member Data Documentation

std::unique_ptr<Geospatial::GeoBase> Analyzer::GeoConstant::geo_
private

Definition at line 1726 of file Analyzer.h.

Referenced by deep_copy(), GeoConstant(), makePhysicalConstant(), operator==(), and toString().


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