OmniSciDB  04ee39c94c
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::Exprget_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 ()
 
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
 
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 573 of file Analyzer.h.

Constructor & Destructor Documentation

◆ InValues()

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

Definition at line 1448 of file Analyzer.cpp.

1450  : 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:607
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609
bool is_in_values_nullable(const std::shared_ptr< Analyzer::Expr > &a, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
Definition: Analyzer.cpp:1433

Member Function Documentation

◆ collect_column_var()

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

References operator==().

592  {
593  arg->collect_column_var(colvar_set, include_agg);
594  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607
+ Here is the call graph for this function:

◆ collect_rte_idx()

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

Reimplemented from Analyzer::Expr.

Definition at line 586 of file Analyzer.h.

586  {
587  arg->collect_rte_idx(rte_idx_set);
588  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607

◆ deep_copy()

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

Implements Analyzer::Expr.

Definition at line 114 of file Analyzer.cpp.

References Analyzer::Constant::value_list.

114  {
115  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
116  for (auto p : value_list) {
117  new_value_list.push_back(p->deep_copy());
118  }
119  return makeExpr<InValues>(arg->deep_copy(), new_value_list);
120 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609

◆ find_expr()

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

Reimplemented from Analyzer::Expr.

Definition at line 2612 of file Analyzer.cpp.

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

2613  {
2614  if (f(this)) {
2615  add_unique(expr_list);
2616  return;
2617  }
2618  arg->find_expr(f, expr_list);
2619  for (auto e : value_list) {
2620  e->find_expr(f, expr_list);
2621  }
2622 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609
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::InValues::get_arg ( ) const
inline

Definition at line 577 of file Analyzer.h.

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

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

◆ get_own_arg()

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

Definition at line 578 of file Analyzer.h.

578 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607

◆ get_value_list()

const std::list<std::shared_ptr<Analyzer::Expr> >& Analyzer::InValues::get_value_list ( ) const
inline

Definition at line 579 of file Analyzer.h.

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

579  {
580  return value_list;
581  }
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609
+ Here is the caller graph for this function:

◆ group_predicates()

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

References arg.

1454  {
1455  std::set<int> rte_idx_set;
1456  arg->collect_rte_idx(rte_idx_set);
1457  if (rte_idx_set.size() > 1) {
1458  join_predicates.push_back(this);
1459  } else if (rte_idx_set.size() == 1) {
1460  scan_predicates.push_back(this);
1461  } else {
1462  const_predicates.push_back(this);
1463  }
1464 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607

◆ operator==()

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

Implements Analyzer::Expr.

Definition at line 2111 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg, get_arg(), get_value_list(), and Analyzer::InIntegerSet::value_list.

2111  {
2112  if (typeid(rhs) != typeid(InValues)) {
2113  return false;
2114  }
2115  const InValues& rhs_iv = dynamic_cast<const InValues&>(rhs);
2116  if (!(*arg == *rhs_iv.get_arg())) {
2117  return false;
2118  }
2119  if (value_list.size() != rhs_iv.get_value_list().size()) {
2120  return false;
2121  }
2122  auto q = rhs_iv.get_value_list().begin();
2123  for (auto p : value_list) {
2124  if (!(*p == **q)) {
2125  return false;
2126  }
2127  q++;
2128  }
2129  return true;
2130 }
InValues(std::shared_ptr< Analyzer::Expr > a, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
Definition: Analyzer.cpp:1448
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609
+ Here is the call graph for this function:

◆ rewrite_agg_to_var()

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

References Analyzer::InIntegerSet::arg, v(), and Analyzer::InIntegerSet::value_list.

1745  {
1746  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
1747  for (auto v : value_list) {
1748  new_value_list.push_back(v->rewrite_agg_to_var(tlist));
1749  }
1750  return makeExpr<InValues>(arg->rewrite_agg_to_var(tlist), new_value_list);
1751 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609
T v(const TargetValue &r)
+ Here is the call graph for this function:

◆ rewrite_with_child_targetlist()

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

References Analyzer::InIntegerSet::arg, v(), and Analyzer::InIntegerSet::value_list.

1736  {
1737  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
1738  for (auto v : value_list) {
1739  new_value_list.push_back(v->deep_copy());
1740  }
1741  return makeExpr<InValues>(arg->rewrite_with_child_targetlist(tlist), new_value_list);
1742 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609
T v(const TargetValue &r)
+ Here is the call graph for this function:

◆ rewrite_with_targetlist()

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

References Analyzer::InIntegerSet::arg, v(), and Analyzer::InIntegerSet::value_list.

1727  {
1728  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
1729  for (auto v : value_list) {
1730  new_value_list.push_back(v->deep_copy());
1731  }
1732  return makeExpr<InValues>(arg->rewrite_with_targetlist(tlist), new_value_list);
1733 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609
T v(const TargetValue &r)
+ Here is the call graph for this function:

◆ toString()

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

Implements Analyzer::Expr.

Definition at line 2376 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg, and Analyzer::InIntegerSet::value_list.

2376  {
2377  std::string str{"(IN "};
2378  str += arg->toString();
2379  str += "(";
2380  for (auto e : value_list) {
2381  str += e->toString();
2382  }
2383  str += ") ";
2384  return str;
2385 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:607
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:609

Member Data Documentation

◆ arg

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

Definition at line 607 of file Analyzer.h.

Referenced by group_predicates().

◆ value_list

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

Definition at line 609 of file Analyzer.h.


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