OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 (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
 
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 640 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 1688 of file Analyzer.cpp.

1690  : Expr(kBOOLEAN, !is_in_values_nullable(a, l)), arg(a), value_list(l) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
constexpr double a
Definition: Utm.h:32
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676
bool is_in_values_nullable(const std::shared_ptr< Analyzer::Expr > &a, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
Definition: Analyzer.cpp:1673

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

References arg.

659  {
660  arg->collect_column_var(colvar_set, include_agg);
661  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
void Analyzer::InValues::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 653 of file Analyzer.h.

References arg.

653  {
654  arg->collect_rte_idx(rte_idx_set);
655  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
std::shared_ptr< Analyzer::Expr > Analyzer::InValues::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 128 of file Analyzer.cpp.

References arg, and value_list.

128  {
129  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
130  for (auto p : value_list) {
131  new_value_list.push_back(p->deep_copy());
132  }
133  return makeExpr<InValues>(arg->deep_copy(), new_value_list);
134 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676
void Analyzer::InValues::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3277 of file Analyzer.cpp.

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

3278  {
3279  if (f(this)) {
3280  add_unique(expr_list);
3281  return;
3282  }
3283  arg->find_expr(f, expr_list);
3284  for (auto e : value_list) {
3285  e->find_expr(f, expr_list);
3286  }
3287 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3248
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676
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::InValues::get_arg ( ) const
inline

Definition at line 644 of file Analyzer.h.

References arg.

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

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

+ Here is the caller graph for this function:

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

Definition at line 645 of file Analyzer.h.

References arg.

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

Definition at line 646 of file Analyzer.h.

References value_list.

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

646  {
647  return value_list;
648  }
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676

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

References arg.

1694  {
1695  std::set<int> rte_idx_set;
1696  arg->collect_rte_idx(rte_idx_set);
1697  if (rte_idx_set.size() > 1) {
1698  join_predicates.push_back(this);
1699  } else if (rte_idx_set.size() == 1) {
1700  scan_predicates.push_back(this);
1701  } else {
1702  const_predicates.push_back(this);
1703  }
1704 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
bool Analyzer::InValues::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2539 of file Analyzer.cpp.

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

2539  {
2540  if (typeid(rhs) != typeid(InValues)) {
2541  return false;
2542  }
2543  const InValues& rhs_iv = dynamic_cast<const InValues&>(rhs);
2544  if (!(*arg == *rhs_iv.get_arg())) {
2545  return false;
2546  }
2547  if (value_list.size() != rhs_iv.get_value_list().size()) {
2548  return false;
2549  }
2550  auto q = rhs_iv.get_value_list().begin();
2551  for (auto p : value_list) {
2552  if (!(*p == **q)) {
2553  return false;
2554  }
2555  q++;
2556  }
2557  return true;
2558 }
InValues(std::shared_ptr< Analyzer::Expr > a, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
Definition: Analyzer.cpp:1688
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676

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

References arg, and value_list.

2086  {
2087  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
2088  for (auto v : value_list) {
2089  new_value_list.push_back(v->rewrite_agg_to_var(tlist));
2090  }
2091  return makeExpr<InValues>(arg->rewrite_agg_to_var(tlist), new_value_list);
2092 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676
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 2076 of file Analyzer.cpp.

References arg, and value_list.

2077  {
2078  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
2079  for (auto v : value_list) {
2080  new_value_list.push_back(v->deep_copy());
2081  }
2082  return makeExpr<InValues>(arg->rewrite_with_child_targetlist(tlist), new_value_list);
2083 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676
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 2067 of file Analyzer.cpp.

References arg, and value_list.

2068  {
2069  std::list<std::shared_ptr<Analyzer::Expr>> new_value_list;
2070  for (auto v : value_list) {
2071  new_value_list.push_back(v->deep_copy());
2072  }
2073  return makeExpr<InValues>(arg->rewrite_with_targetlist(tlist), new_value_list);
2074 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676
std::string Analyzer::InValues::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2887 of file Analyzer.cpp.

References arg, to_string(), and value_list.

2887  {
2888  std::string str{"(IN "};
2889  str += arg->toString();
2890  str += "(";
2891  int cnt = 0;
2892  bool shorted_value_list_str = false;
2893  for (auto e : value_list) {
2894  str += e->toString();
2895  cnt++;
2896  if (cnt > 4) {
2897  shorted_value_list_str = true;
2898  break;
2899  }
2900  }
2901  if (shorted_value_list_str) {
2902  str += "... | ";
2903  str += "Total # values: ";
2904  str += std::to_string(value_list.size());
2905  }
2906  str += ") ";
2907  return str;
2908 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:674
std::string to_string(char const *&&v)
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:676

+ Here is the call graph for this function:

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: