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

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::InValues:
+ Collaboration diagram for Analyzer::InValues:

Public Member Functions

 InValues (std::shared_ptr< Analyzer::Expr > a, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
 
const Exprget_arg () const
 
const std::shared_ptr
< Analyzer::Expr
get_own_arg () const
 
const std::list
< std::shared_ptr
< Analyzer::Expr > > & 
get_value_list () 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 ()
 
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 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
 
const std::list
< std::shared_ptr
< Analyzer::Expr > > 
value_list
 

Additional Inherited Members

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

Detailed Description

Definition at line 580 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::InValues::InValues ( std::shared_ptr< Analyzer::Expr a,
const std::list< std::shared_ptr< Analyzer::Expr >> &  l 
)

Definition at line 1584 of file Analyzer.cpp.

1586  : Expr(kBOOLEAN, !is_in_values_nullable(a, l)), arg(a), value_list(l) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616
bool is_in_values_nullable(const std::shared_ptr< Analyzer::Expr > &a, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
Definition: Analyzer.cpp:1569

Member Function Documentation

void Analyzer::InValues::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 596 of file Analyzer.h.

References arg.

599  {
600  arg->collect_column_var(colvar_set, include_agg);
601  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
void Analyzer::InValues::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 593 of file Analyzer.h.

References arg.

593  {
594  arg->collect_rte_idx(rte_idx_set);
595  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
std::shared_ptr< Analyzer::Expr > Analyzer::InValues::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 115 of file Analyzer.cpp.

References arg, and value_list.

115  {
116  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
117  for (auto p : value_list) {
118  new_value_list.push_back(p->deep_copy());
119  }
120  return makeExpr<InValues>(arg->deep_copy(), new_value_list);
121 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616
void Analyzer::InValues::find_expr ( bool(*)(const Expr *)  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2897 of file Analyzer.cpp.

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

2898  {
2899  if (f(this)) {
2900  add_unique(expr_list);
2901  return;
2902  }
2903  arg->find_expr(f, expr_list);
2904  for (auto e : value_list) {
2905  e->find_expr(f, expr_list);
2906  }
2907 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:2870
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616
char * f

+ Here is the call graph for this function:

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

Definition at line 584 of file Analyzer.h.

References arg.

Referenced by CodeGenerator::codegen(), CodeGenerator::createInValuesBitmap(), QueryRewriter::generateCaseForDomainValues(), operator==(), QueryRewriter::rewriteConstrainedByInImpl(), ScalarExprToSql::visitInValues(), DeepCopyVisitor::visitInValues(), and ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visitInValues().

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

+ Here is the caller graph for this function:

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

Definition at line 585 of file Analyzer.h.

References arg.

585 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list<std::shared_ptr<Analyzer::Expr> >& Analyzer::InValues::get_value_list ( ) const
inline

Definition at line 586 of file Analyzer.h.

References value_list.

Referenced by CodeGenerator::codegen(), CodeGenerator::createInValuesBitmap(), QueryRewriter::generateCaseForDomainValues(), operator==(), ScalarExprToSql::visitInValues(), DeepCopyVisitor::visitInValues(), and ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visitInValues().

586  {
587  return value_list;
588  }
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616

+ Here is the caller graph for this function:

void Analyzer::InValues::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 1588 of file Analyzer.cpp.

References arg.

1590  {
1591  std::set<int> rte_idx_set;
1592  arg->collect_rte_idx(rte_idx_set);
1593  if (rte_idx_set.size() > 1) {
1594  join_predicates.push_back(this);
1595  } else if (rte_idx_set.size() == 1) {
1596  scan_predicates.push_back(this);
1597  } else {
1598  const_predicates.push_back(this);
1599  }
1600 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
bool Analyzer::InValues::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2294 of file Analyzer.cpp.

References arg, get_arg(), get_value_list(), and value_list.

2294  {
2295  if (typeid(rhs) != typeid(InValues)) {
2296  return false;
2297  }
2298  const InValues& rhs_iv = dynamic_cast<const InValues&>(rhs);
2299  if (!(*arg == *rhs_iv.get_arg())) {
2300  return false;
2301  }
2302  if (value_list.size() != rhs_iv.get_value_list().size()) {
2303  return false;
2304  }
2305  auto q = rhs_iv.get_value_list().begin();
2306  for (auto p : value_list) {
2307  if (!(*p == **q)) {
2308  return false;
2309  }
2310  q++;
2311  }
2312  return true;
2313 }
InValues(std::shared_ptr< Analyzer::Expr > a, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
Definition: Analyzer.cpp:1584
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616

+ Here is the call graph for this function:

std::shared_ptr< Analyzer::Expr > Analyzer::InValues::rewrite_agg_to_var ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1908 of file Analyzer.cpp.

References arg, and value_list.

1909  {
1910  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
1911  for (auto v : value_list) {
1912  new_value_list.push_back(v->rewrite_agg_to_var(tlist));
1913  }
1914  return makeExpr<InValues>(arg->rewrite_agg_to_var(tlist), new_value_list);
1915 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616
std::shared_ptr< Analyzer::Expr > Analyzer::InValues::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1899 of file Analyzer.cpp.

References arg, and value_list.

1900  {
1901  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
1902  for (auto v : value_list) {
1903  new_value_list.push_back(v->deep_copy());
1904  }
1905  return makeExpr<InValues>(arg->rewrite_with_child_targetlist(tlist), new_value_list);
1906 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616
std::shared_ptr< Analyzer::Expr > Analyzer::InValues::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1890 of file Analyzer.cpp.

References arg, and value_list.

1891  {
1892  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
1893  for (auto v : value_list) {
1894  new_value_list.push_back(v->deep_copy());
1895  }
1896  return makeExpr<InValues>(arg->rewrite_with_targetlist(tlist), new_value_list);
1897 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616
std::string Analyzer::InValues::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2591 of file Analyzer.cpp.

References arg, and value_list.

2591  {
2592  std::string str{"(IN "};
2593  str += arg->toString();
2594  str += "(";
2595  for (auto e : value_list) {
2596  str += e->toString();
2597  }
2598  str += ") ";
2599  return str;
2600 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616

Member Data Documentation

const std::list<std::shared_ptr<Analyzer::Expr> > Analyzer::InValues::value_list
private

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