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

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::PCAProjectExpr:
+ Collaboration diagram for Analyzer::PCAProjectExpr:

Public Member Functions

 PCAProjectExpr (const std::shared_ptr< Analyzer::Expr > &model, const std::vector< std::shared_ptr< Analyzer::Expr >> &features, const std::shared_ptr< Analyzer::Expr > &pc_dimension)
 
const Exprget_model_value () const
 
const std::vector
< std::shared_ptr
< Analyzer::Expr > > & 
get_feature_values () const
 
const Exprget_pc_dimension_value () const
 
std::shared_ptr< Analyzer::Exprdeep_copy () const override
 
void group_predicates (std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
 
void collect_rte_idx (std::set< int > &rte_idx_set) const override
 
void collect_column_var (std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
 
std::shared_ptr< Analyzer::Exprrewrite_with_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
 
std::shared_ptr< Analyzer::Exprrewrite_with_child_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
 
std::shared_ptr< Analyzer::Exprrewrite_agg_to_var (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
 
bool operator== (const Expr &rhs) const override
 
std::string toString () const override
 
void find_expr (std::function< bool(const Expr *)> f, std::list< const Expr * > &expr_list) const override
 
- 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 size_t get_num_column_vars (const bool include_agg) const
 
virtual void print () const
 
virtual void add_unique (std::list< const Expr * > &expr_list) const
 
std::shared_ptr< Analyzer::Exprdecompress ()
 
virtual void get_domain (DomainSet &domain_set) const
 

Private Attributes

std::shared_ptr< Analyzer::Exprmodel_value_
 
std::vector< std::shared_ptr
< Analyzer::Expr > > 
feature_values_
 
std::shared_ptr< Analyzer::Exprpc_dimension_value_
 

Additional Inherited Members

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

Detailed Description

Definition at line 778 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::PCAProjectExpr::PCAProjectExpr ( const std::shared_ptr< Analyzer::Expr > &  model,
const std::vector< std::shared_ptr< Analyzer::Expr >> &  features,
const std::shared_ptr< Analyzer::Expr > &  pc_dimension 
)
inline

Definition at line 780 of file Analyzer.h.

783  : Expr(kDOUBLE, false)
784  , model_value_(model)
785  , feature_values_(features)
786  , pc_dimension_value_(pc_dimension) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
std::shared_ptr< Analyzer::Expr > pc_dimension_value_
Definition: Analyzer.h:856
std::shared_ptr< Analyzer::Expr > model_value_
Definition: Analyzer.h:854
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855

Member Function Documentation

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

Reimplemented from Analyzer::Expr.

Definition at line 805 of file Analyzer.h.

References feature_values_.

808  {
809  for (const auto& feature_value : feature_values_) {
810  feature_value->collect_column_var(colvar_set, include_agg);
811  }
812  }
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855
void Analyzer::PCAProjectExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 799 of file Analyzer.h.

References feature_values_.

799  {
800  for (const auto& feature_value : feature_values_) {
801  feature_value->collect_rte_idx(rte_idx_set);
802  }
803  }
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855
std::shared_ptr< Analyzer::Expr > Analyzer::PCAProjectExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 144 of file Analyzer.cpp.

References feature_values_, model_value_, and pc_dimension_value_.

Referenced by DeepCopyVisitor::visitPCAProject().

144  {
145  std::vector<std::shared_ptr<Analyzer::Expr>> features_copy;
146  for (auto feature_value : feature_values_) {
147  features_copy.emplace_back(feature_value->deep_copy());
148  }
149  return makeExpr<PCAProjectExpr>(
150  model_value_->deep_copy(), features_copy, pc_dimension_value_->deep_copy());
151 }
std::shared_ptr< Analyzer::Expr > pc_dimension_value_
Definition: Analyzer.h:856
std::shared_ptr< Analyzer::Expr > model_value_
Definition: Analyzer.h:854
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855

+ Here is the caller graph for this function:

void Analyzer::PCAProjectExpr::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3300 of file Analyzer.cpp.

References Analyzer::Expr::add_unique(), f(), and feature_values_.

3301  {
3302  if (f(this)) {
3303  add_unique(expr_list);
3304  return;
3305  }
3306  for (auto& feature_value : feature_values_) {
3307  feature_value->find_expr(f, expr_list);
3308  }
3309 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3248
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855

+ Here is the call graph for this function:

const std::vector<std::shared_ptr<Analyzer::Expr> >& Analyzer::PCAProjectExpr::get_feature_values ( ) const
inline

Definition at line 789 of file Analyzer.h.

References feature_values_.

Referenced by CodeGenerator::codegen(), operator==(), and ScalarExprVisitor< std::set< shared::TableKey > >::visitPCAProject().

789  {
790  return feature_values_;
791  }
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855

+ Here is the caller graph for this function:

const Expr* Analyzer::PCAProjectExpr::get_model_value ( ) const
inline

Definition at line 788 of file Analyzer.h.

References model_value_.

Referenced by CodeGenerator::codegen(), operator==(), and ScalarExprVisitor< std::set< shared::TableKey > >::visitPCAProject().

788 { return model_value_.get(); }
std::shared_ptr< Analyzer::Expr > model_value_
Definition: Analyzer.h:854

+ Here is the caller graph for this function:

const Expr* Analyzer::PCAProjectExpr::get_pc_dimension_value ( ) const
inline

Definition at line 792 of file Analyzer.h.

References pc_dimension_value_.

Referenced by CodeGenerator::codegen(), operator==(), and ScalarExprVisitor< std::set< shared::TableKey > >::visitPCAProject().

792 { return pc_dimension_value_.get(); }
std::shared_ptr< Analyzer::Expr > pc_dimension_value_
Definition: Analyzer.h:856

+ Here is the caller graph for this function:

void Analyzer::PCAProjectExpr::group_predicates ( std::list< const Expr * > &  scan_predicates,
std::list< const Expr * > &  join_predicates,
std::list< const Expr * > &  const_predicates 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1755 of file Analyzer.cpp.

References feature_values_.

1757  {
1758  std::set<int> rte_idx_set;
1759  for (const auto& feature_value : feature_values_) {
1760  feature_value->collect_rte_idx(rte_idx_set);
1761  }
1762  if (rte_idx_set.size() > 1) {
1763  join_predicates.push_back(this);
1764  } else if (rte_idx_set.size() == 1) {
1765  scan_predicates.push_back(this);
1766  } else {
1767  const_predicates.push_back(this);
1768  }
1769 }
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855
bool Analyzer::PCAProjectExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2434 of file Analyzer.cpp.

References feature_values_, get_feature_values(), get_model_value(), get_pc_dimension_value(), model_value_, and pc_dimension_value_.

2434  {
2435  if (typeid(rhs) != typeid(PCAProjectExpr)) {
2436  return false;
2437  }
2438  const PCAProjectExpr& rhs_cl = dynamic_cast<const PCAProjectExpr&>(rhs);
2439  if (!(*model_value_ == *rhs_cl.get_model_value())) {
2440  return false;
2441  }
2442  if (!(*pc_dimension_value_ == *rhs_cl.get_pc_dimension_value())) {
2443  return false;
2444  }
2445  auto rhs_feature_values = rhs_cl.get_feature_values();
2446  if (feature_values_.size() != rhs_feature_values.size()) {
2447  return false;
2448  }
2449  for (size_t feature_idx = 0; feature_idx < feature_values_.size(); ++feature_idx) {
2450  if (!(*feature_values_[feature_idx] == *rhs_feature_values[feature_idx])) {
2451  return false;
2452  }
2453  }
2454  return true;
2455 }
PCAProjectExpr(const std::shared_ptr< Analyzer::Expr > &model, const std::vector< std::shared_ptr< Analyzer::Expr >> &features, const std::shared_ptr< Analyzer::Expr > &pc_dimension)
Definition: Analyzer.h:780
std::shared_ptr< Analyzer::Expr > pc_dimension_value_
Definition: Analyzer.h:856
std::shared_ptr< Analyzer::Expr > model_value_
Definition: Analyzer.h:854
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855

+ Here is the call graph for this function:

std::shared_ptr<Analyzer::Expr> Analyzer::PCAProjectExpr::rewrite_agg_to_var ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 837 of file Analyzer.h.

References feature_values_, model_value_, and pc_dimension_value_.

838  {
839  std::vector<std::shared_ptr<Analyzer::Expr>> new_feature_values;
840  for (auto& r : feature_values_) {
841  new_feature_values.push_back(r->deep_copy());
842  }
843  return makeExpr<PCAProjectExpr>(model_value_->rewrite_agg_to_var(tlist),
844  new_feature_values,
845  pc_dimension_value_->rewrite_agg_to_var(tlist));
846  }
std::shared_ptr< Analyzer::Expr > pc_dimension_value_
Definition: Analyzer.h:856
std::shared_ptr< Analyzer::Expr > model_value_
Definition: Analyzer.h:854
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855
std::shared_ptr<Analyzer::Expr> Analyzer::PCAProjectExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 825 of file Analyzer.h.

References feature_values_, model_value_, and pc_dimension_value_.

826  {
827  std::vector<std::shared_ptr<Analyzer::Expr>> new_feature_values;
828  for (auto& r : feature_values_) {
829  new_feature_values.push_back(r->deep_copy());
830  }
831  return makeExpr<PCAProjectExpr>(
832  model_value_->rewrite_with_child_targetlist(tlist),
833  new_feature_values,
834  pc_dimension_value_->rewrite_with_child_targetlist(tlist));
835  }
std::shared_ptr< Analyzer::Expr > pc_dimension_value_
Definition: Analyzer.h:856
std::shared_ptr< Analyzer::Expr > model_value_
Definition: Analyzer.h:854
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855
std::shared_ptr<Analyzer::Expr> Analyzer::PCAProjectExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 814 of file Analyzer.h.

References feature_values_, model_value_, and pc_dimension_value_.

815  {
816  std::vector<std::shared_ptr<Analyzer::Expr>> new_feature_values;
817  for (auto& r : feature_values_) {
818  new_feature_values.push_back(r->deep_copy());
819  }
820  return makeExpr<PCAProjectExpr>(model_value_->rewrite_with_targetlist(tlist),
821  new_feature_values,
822  pc_dimension_value_->rewrite_with_targetlist(tlist));
823  }
std::shared_ptr< Analyzer::Expr > pc_dimension_value_
Definition: Analyzer.h:856
std::shared_ptr< Analyzer::Expr > model_value_
Definition: Analyzer.h:854
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855
std::string Analyzer::PCAProjectExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2869 of file Analyzer.cpp.

References feature_values_, model_value_, and pc_dimension_value_.

2869  {
2870  std::stringstream ss;
2871  ss << "PCA_PROJECT(Model: ";
2872  ss << model_value_->toString();
2873  ss << " Features: ";
2874  for (const auto& feature_value : feature_values_) {
2875  ss << feature_value->toString() << " ";
2876  }
2877  ss << " PC Dimension: ";
2878  ss << pc_dimension_value_->toString() << " ";
2879  ss << ") ";
2880  return ss.str();
2881 }
std::shared_ptr< Analyzer::Expr > pc_dimension_value_
Definition: Analyzer.h:856
std::shared_ptr< Analyzer::Expr > model_value_
Definition: Analyzer.h:854
std::vector< std::shared_ptr< Analyzer::Expr > > feature_values_
Definition: Analyzer.h:855

Member Data Documentation

std::vector<std::shared_ptr<Analyzer::Expr> > Analyzer::PCAProjectExpr::feature_values_
private
std::shared_ptr<Analyzer::Expr> Analyzer::PCAProjectExpr::model_value_
private
std::shared_ptr<Analyzer::Expr> Analyzer::PCAProjectExpr::pc_dimension_value_
private

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