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

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::RegexpExpr:
+ Collaboration diagram for Analyzer::RegexpExpr:

Public Member Functions

 RegexpExpr (std::shared_ptr< Analyzer::Expr > a, std::shared_ptr< Analyzer::Expr > p, std::shared_ptr< Analyzer::Expr > e)
 
const Exprget_arg () const
 
const std::shared_ptr
< Analyzer::Expr
get_own_arg () const
 
const Exprget_pattern_expr () const
 
const Exprget_escape_expr () 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
 
std::shared_ptr< Analyzer::Exprpattern_expr
 
std::shared_ptr< Analyzer::Exprescape_expr
 

Additional Inherited Members

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

Detailed Description

Definition at line 1124 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::RegexpExpr::RegexpExpr ( std::shared_ptr< Analyzer::Expr a,
std::shared_ptr< Analyzer::Expr p,
std::shared_ptr< Analyzer::Expr e 
)
inline

Definition at line 1126 of file Analyzer.h.

1129  : Expr(kBOOLEAN, a->get_type_info().get_notnull())
1130  , arg(a)
1131  , pattern_expr(p)
1132  , escape_expr(e) {}
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178
constexpr double a
Definition: Utm.h:32
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176

Member Function Documentation

void Analyzer::RegexpExpr::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 1144 of file Analyzer.h.

References arg.

1147  {
1148  arg->collect_column_var(colvar_set, include_agg);
1149  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
void Analyzer::RegexpExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1141 of file Analyzer.h.

References arg.

1141  {
1142  arg->collect_rte_idx(rte_idx_set);
1143  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
std::shared_ptr< Analyzer::Expr > Analyzer::RegexpExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 177 of file Analyzer.cpp.

References arg, escape_expr, and pattern_expr.

177  {
178  return makeExpr<RegexpExpr>(arg->deep_copy(),
179  pattern_expr->deep_copy(),
180  escape_expr ? escape_expr->deep_copy() : nullptr);
181 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176
void Analyzer::RegexpExpr::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3371 of file Analyzer.cpp.

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

3372  {
3373  if (f(this)) {
3374  add_unique(expr_list);
3375  return;
3376  }
3377  arg->find_expr(f, expr_list);
3378  pattern_expr->find_expr(f, expr_list);
3379  if (escape_expr != nullptr) {
3380  escape_expr->find_expr(f, expr_list);
3381  }
3382 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3248
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176

+ Here is the call graph for this function:

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

Definition at line 1133 of file Analyzer.h.

References arg.

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

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

+ Here is the caller graph for this function:

const Expr* Analyzer::RegexpExpr::get_escape_expr ( ) const
inline

Definition at line 1136 of file Analyzer.h.

References escape_expr.

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

1136 { return escape_expr.get(); }
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178

+ Here is the caller graph for this function:

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

Definition at line 1134 of file Analyzer.h.

References arg.

Referenced by CodeGenerator::codegen().

1134 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174

+ Here is the caller graph for this function:

const Expr* Analyzer::RegexpExpr::get_pattern_expr ( ) const
inline

Definition at line 1135 of file Analyzer.h.

References pattern_expr.

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

1135 { return pattern_expr.get(); }
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176

+ Here is the caller graph for this function:

void Analyzer::RegexpExpr::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 1829 of file Analyzer.cpp.

References arg.

1831  {
1832  std::set<int> rte_idx_set;
1833  arg->collect_rte_idx(rte_idx_set);
1834  if (rte_idx_set.size() > 1) {
1835  join_predicates.push_back(this);
1836  } else if (rte_idx_set.size() == 1) {
1837  scan_predicates.push_back(this);
1838  } else {
1839  const_predicates.push_back(this);
1840  }
1841 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
bool Analyzer::RegexpExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2487 of file Analyzer.cpp.

References arg, escape_expr, get_arg(), get_escape_expr(), get_pattern_expr(), and pattern_expr.

2487  {
2488  if (typeid(rhs) != typeid(RegexpExpr)) {
2489  return false;
2490  }
2491  const RegexpExpr& rhs_re = dynamic_cast<const RegexpExpr&>(rhs);
2492  if (!(*arg == *rhs_re.get_arg()) || !(*pattern_expr == *rhs_re.get_pattern_expr())) {
2493  return false;
2494  }
2495  if (escape_expr.get() == rhs_re.get_escape_expr()) {
2496  return true;
2497  }
2498  if (escape_expr != nullptr && rhs_re.get_escape_expr() != nullptr &&
2499  *escape_expr == *rhs_re.get_escape_expr()) {
2500  return true;
2501  }
2502  return false;
2503 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178
RegexpExpr(std::shared_ptr< Analyzer::Expr > a, std::shared_ptr< Analyzer::Expr > p, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:1126
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176

+ Here is the call graph for this function:

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

Reimplemented from Analyzer::Expr.

Definition at line 1162 of file Analyzer.h.

References arg, escape_expr, and pattern_expr.

1163  {
1164  return makeExpr<RegexpExpr>(arg->rewrite_agg_to_var(tlist),
1165  pattern_expr->deep_copy(),
1166  escape_expr ? escape_expr->deep_copy() : nullptr);
1167  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176
std::shared_ptr<Analyzer::Expr> Analyzer::RegexpExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1156 of file Analyzer.h.

References arg, escape_expr, and pattern_expr.

1157  {
1158  return makeExpr<RegexpExpr>(arg->rewrite_with_child_targetlist(tlist),
1159  pattern_expr->deep_copy(),
1160  escape_expr ? escape_expr->deep_copy() : nullptr);
1161  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176
std::shared_ptr<Analyzer::Expr> Analyzer::RegexpExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1150 of file Analyzer.h.

References arg, escape_expr, and pattern_expr.

1151  {
1152  return makeExpr<RegexpExpr>(arg->rewrite_with_targetlist(tlist),
1153  pattern_expr->deep_copy(),
1154  escape_expr ? escape_expr->deep_copy() : nullptr);
1155  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176
std::string Analyzer::RegexpExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2989 of file Analyzer.cpp.

References arg, escape_expr, and pattern_expr.

2989  {
2990  std::string str{"(REGEXP "};
2991  str += arg->toString();
2992  str += pattern_expr->toString();
2993  if (escape_expr) {
2994  str += escape_expr->toString();
2995  }
2996  str += ") ";
2997  return str;
2998 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1174
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1178
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1176

Member Data Documentation

std::shared_ptr<Analyzer::Expr> Analyzer::RegexpExpr::escape_expr
private
std::shared_ptr<Analyzer::Expr> Analyzer::RegexpExpr::pattern_expr
private

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