OmniSciDB  04ee39c94c
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::Exprget_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 (bool(*f)(const Expr *), 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 ()
 
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::Expradd_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::Exprnormalize_simple_predicate (int &rte_idx) 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 921 of file Analyzer.h.

Constructor & Destructor Documentation

◆ LikelihoodExpr()

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

Definition at line 923 of file Analyzer.h.

924  : Expr(kBOOLEAN, a->get_type_info().get_notnull()), arg(a), likelihood(l) {}
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69

Member Function Documentation

◆ collect_column_var()

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 935 of file Analyzer.h.

938  {
939  arg->collect_column_var(colvar_set, include_agg);
940  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960

◆ collect_rte_idx()

void Analyzer::LikelihoodExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 932 of file Analyzer.h.

932  {
933  arg->collect_rte_idx(rte_idx_set);
934  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960

◆ deep_copy()

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

Implements Analyzer::Expr.

Definition at line 148 of file Analyzer.cpp.

148  {
149  return makeExpr<LikelihoodExpr>(arg->deep_copy(), likelihood);
150 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960

◆ find_expr()

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

Reimplemented from Analyzer::Expr.

Definition at line 2677 of file Analyzer.cpp.

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

2678  {
2679  if (f(this)) {
2680  add_unique(expr_list);
2681  return;
2682  }
2683  arg->find_expr(f, expr_list);
2684 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960
virtual void add_unique(std::list< const Expr *> &expr_list) const
Definition: Analyzer.cpp:2585
+ Here is the call graph for this function:

◆ get_arg()

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

Definition at line 925 of file Analyzer.h.

Referenced by operator==(), DeepCopyVisitor::visitLikelihood(), and ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visitLikelihood().

925 { return arg.get(); }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960
+ Here is the caller graph for this function:

◆ get_likelihood()

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

Definition at line 927 of file Analyzer.h.

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

927 { return likelihood; }
+ Here is the caller graph for this function:

◆ get_own_arg()

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

Definition at line 926 of file Analyzer.h.

926 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960

◆ group_predicates()

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 1541 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg.

1543  {
1544  std::set<int> rte_idx_set;
1545  arg->collect_rte_idx(rte_idx_set);
1546  if (rte_idx_set.size() > 1) {
1547  join_predicates.push_back(this);
1548  } else if (rte_idx_set.size() == 1) {
1549  scan_predicates.push_back(this);
1550  } else {
1551  const_predicates.push_back(this);
1552  }
1553 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960

◆ operator==()

bool Analyzer::LikelihoodExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2097 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg, get_arg(), and get_likelihood().

2097  {
2098  if (typeid(rhs) != typeid(LikelihoodExpr)) {
2099  return false;
2100  }
2101  const LikelihoodExpr& rhs_l = dynamic_cast<const LikelihoodExpr&>(rhs);
2102  if (!(*arg == *rhs_l.get_arg())) {
2103  return false;
2104  }
2105  if (likelihood != rhs_l.get_likelihood()) {
2106  return false;
2107  }
2108  return true;
2109 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960
LikelihoodExpr(std::shared_ptr< Analyzer::Expr > a, float l=0.5)
Definition: Analyzer.h:923
+ Here is the call graph for this function:

◆ rewrite_agg_to_var()

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 950 of file Analyzer.h.

References operator==().

951  {
952  return makeExpr<LikelihoodExpr>(arg->rewrite_agg_to_var(tlist), likelihood);
953  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960
+ Here is the call graph for this function:

◆ rewrite_with_child_targetlist()

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 945 of file Analyzer.h.

946  {
947  return makeExpr<LikelihoodExpr>(arg->rewrite_with_child_targetlist(tlist),
948  likelihood);
949  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960

◆ rewrite_with_targetlist()

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 941 of file Analyzer.h.

942  {
943  return makeExpr<LikelihoodExpr>(arg->rewrite_with_targetlist(tlist), likelihood);
944  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960

◆ toString()

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

Implements Analyzer::Expr.

Definition at line 2458 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg, and to_string().

2458  {
2459  std::string str{"(LIKELIHOOD "};
2460  str += arg->toString();
2461  return str + " " + std::to_string(likelihood) + ") ";
2462 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:960
std::string to_string(char const *&&v)
+ Here is the call graph for this function:

Member Data Documentation

◆ arg

std::shared_ptr<Analyzer::Expr> Analyzer::LikelihoodExpr::arg
private

Definition at line 960 of file Analyzer.h.

◆ likelihood

float Analyzer::LikelihoodExpr::likelihood
private

Definition at line 961 of file Analyzer.h.


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