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

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::LikelihoodExpr:
+ Collaboration diagram for Analyzer::LikelihoodExpr:

Public Member Functions

 LikelihoodExpr (std::shared_ptr< Analyzer::Expr > a, float l=0.5)
 
const Exprget_arg () const
 
const std::shared_ptr
< Analyzer::Expr
get_own_arg () const
 
float get_likelihood () 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::Exprarg
 
float likelihood
 

Additional Inherited Members

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

Detailed Description

Definition at line 1263 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::LikelihoodExpr::LikelihoodExpr ( std::shared_ptr< Analyzer::Expr a,
float  l = 0.5 
)
inline

Definition at line 1265 of file Analyzer.h.

1266  : Expr(kBOOLEAN, a->get_type_info().get_notnull()), arg(a), likelihood(l) {}
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
constexpr double a
Definition: Utm.h:32

Member Function Documentation

void Analyzer::LikelihoodExpr::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 1277 of file Analyzer.h.

References arg.

1280  {
1281  arg->collect_column_var(colvar_set, include_agg);
1282  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
void Analyzer::LikelihoodExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1274 of file Analyzer.h.

References arg.

1274  {
1275  arg->collect_rte_idx(rte_idx_set);
1276  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
std::shared_ptr< Analyzer::Expr > Analyzer::LikelihoodExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 190 of file Analyzer.cpp.

References arg, and likelihood.

190  {
191  return makeExpr<LikelihoodExpr>(arg->deep_copy(), likelihood);
192 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
void Analyzer::LikelihoodExpr::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3396 of file Analyzer.cpp.

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

3397  {
3398  if (f(this)) {
3399  add_unique(expr_list);
3400  return;
3401  }
3402  arg->find_expr(f, expr_list);
3403 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
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)

+ Here is the call graph for this function:

const Expr* Analyzer::LikelihoodExpr::get_arg ( ) const
inline

Definition at line 1267 of file Analyzer.h.

References arg.

Referenced by operator==(), DeepCopyVisitor::visitLikelihood(), and ScalarExprVisitor< std::set< shared::TableKey > >::visitLikelihood().

1267 { return arg.get(); }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302

+ Here is the caller graph for this function:

float Analyzer::LikelihoodExpr::get_likelihood ( ) const
inline

Definition at line 1269 of file Analyzer.h.

References likelihood.

Referenced by operator==(), and DeepCopyVisitor::visitLikelihood().

1269 { return likelihood; }

+ Here is the caller graph for this function:

const std::shared_ptr<Analyzer::Expr> Analyzer::LikelihoodExpr::get_own_arg ( ) const
inline

Definition at line 1268 of file Analyzer.h.

References arg.

1268 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
void Analyzer::LikelihoodExpr::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 1857 of file Analyzer.cpp.

References arg.

1859  {
1860  std::set<int> rte_idx_set;
1861  arg->collect_rte_idx(rte_idx_set);
1862  if (rte_idx_set.size() > 1) {
1863  join_predicates.push_back(this);
1864  } else if (rte_idx_set.size() == 1) {
1865  scan_predicates.push_back(this);
1866  } else {
1867  const_predicates.push_back(this);
1868  }
1869 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
bool Analyzer::LikelihoodExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2525 of file Analyzer.cpp.

References arg, get_arg(), get_likelihood(), and likelihood.

2525  {
2526  if (typeid(rhs) != typeid(LikelihoodExpr)) {
2527  return false;
2528  }
2529  const LikelihoodExpr& rhs_l = dynamic_cast<const LikelihoodExpr&>(rhs);
2530  if (!(*arg == *rhs_l.get_arg())) {
2531  return false;
2532  }
2533  if (likelihood != rhs_l.get_likelihood()) {
2534  return false;
2535  }
2536  return true;
2537 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
LikelihoodExpr(std::shared_ptr< Analyzer::Expr > a, float l=0.5)
Definition: Analyzer.h:1265

+ Here is the call graph for this function:

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

Reimplemented from Analyzer::Expr.

Definition at line 1292 of file Analyzer.h.

References arg, and likelihood.

1293  {
1294  return makeExpr<LikelihoodExpr>(arg->rewrite_agg_to_var(tlist), likelihood);
1295  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
std::shared_ptr<Analyzer::Expr> Analyzer::LikelihoodExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1287 of file Analyzer.h.

References arg, and likelihood.

1288  {
1289  return makeExpr<LikelihoodExpr>(arg->rewrite_with_child_targetlist(tlist),
1290  likelihood);
1291  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
std::shared_ptr<Analyzer::Expr> Analyzer::LikelihoodExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1283 of file Analyzer.h.

References arg, and likelihood.

1284  {
1285  return makeExpr<LikelihoodExpr>(arg->rewrite_with_targetlist(tlist), likelihood);
1286  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
std::string Analyzer::LikelihoodExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 3009 of file Analyzer.cpp.

References arg, likelihood, and to_string().

3009  {
3010  std::string str{"(LIKELIHOOD "};
3011  str += arg->toString();
3012  return str + " " + std::to_string(likelihood) + ") ";
3013 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1302
std::string to_string(char const *&&v)

+ Here is the call graph for this function:

Member Data Documentation

float Analyzer::LikelihoodExpr::likelihood
private

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