OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 (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
 
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 917 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 919 of file Analyzer.h.

922  : Expr(kBOOLEAN, a->get_type_info().get_notnull())
923  , arg(a)
924  , pattern_expr(p)
925  , escape_expr(e) {}
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:971
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:969

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

References arg.

940  {
941  arg->collect_column_var(colvar_set, include_agg);
942  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
void Analyzer::RegexpExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 934 of file Analyzer.h.

References arg.

934  {
935  arg->collect_rte_idx(rte_idx_set);
936  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
std::shared_ptr< Analyzer::Expr > Analyzer::RegexpExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 146 of file Analyzer.cpp.

References arg, escape_expr, and pattern_expr.

146  {
147  return makeExpr<RegexpExpr>(arg->deep_copy(),
148  pattern_expr->deep_copy(),
149  escape_expr ? escape_expr->deep_copy() : nullptr);
150 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:971
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:969
void Analyzer::RegexpExpr::find_expr ( bool(*)(const Expr *)  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2727 of file Analyzer.cpp.

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

2728  {
2729  if (f(this)) {
2730  add_unique(expr_list);
2731  return;
2732  }
2733  arg->find_expr(f, expr_list);
2734  pattern_expr->find_expr(f, expr_list);
2735  if (escape_expr != nullptr) {
2736  escape_expr->find_expr(f, expr_list);
2737  }
2738 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:2639
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:971
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:969

+ Here is the call graph for this function:

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

Definition at line 926 of file Analyzer.h.

References arg.

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

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

+ Here is the caller graph for this function:

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

Definition at line 929 of file Analyzer.h.

References escape_expr.

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

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

+ Here is the caller graph for this function:

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

Definition at line 927 of file Analyzer.h.

References arg.

Referenced by CodeGenerator::codegen().

927 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967

+ Here is the caller graph for this function:

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

Definition at line 928 of file Analyzer.h.

References pattern_expr.

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

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

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

References arg.

1551  {
1552  std::set<int> rte_idx_set;
1553  arg->collect_rte_idx(rte_idx_set);
1554  if (rte_idx_set.size() > 1) {
1555  join_predicates.push_back(this);
1556  } else if (rte_idx_set.size() == 1) {
1557  scan_predicates.push_back(this);
1558  } else {
1559  const_predicates.push_back(this);
1560  }
1561 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
bool Analyzer::RegexpExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2109 of file Analyzer.cpp.

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

2109  {
2110  if (typeid(rhs) != typeid(RegexpExpr)) {
2111  return false;
2112  }
2113  const RegexpExpr& rhs_re = dynamic_cast<const RegexpExpr&>(rhs);
2114  if (!(*arg == *rhs_re.get_arg()) || !(*pattern_expr == *rhs_re.get_pattern_expr())) {
2115  return false;
2116  }
2117  if (escape_expr.get() == rhs_re.get_escape_expr()) {
2118  return true;
2119  }
2120  if (escape_expr != nullptr && rhs_re.get_escape_expr() != nullptr &&
2121  *escape_expr == *rhs_re.get_escape_expr()) {
2122  return true;
2123  }
2124  return false;
2125 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:971
RegexpExpr(std::shared_ptr< Analyzer::Expr > a, std::shared_ptr< Analyzer::Expr > p, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:919
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:969

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

References arg, escape_expr, and pattern_expr.

956  {
957  return makeExpr<RegexpExpr>(arg->rewrite_agg_to_var(tlist),
958  pattern_expr->deep_copy(),
959  escape_expr ? escape_expr->deep_copy() : nullptr);
960  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:971
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:969
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 949 of file Analyzer.h.

References arg, escape_expr, and pattern_expr.

950  {
951  return makeExpr<RegexpExpr>(arg->rewrite_with_child_targetlist(tlist),
952  pattern_expr->deep_copy(),
953  escape_expr ? escape_expr->deep_copy() : nullptr);
954  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:971
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:969
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 943 of file Analyzer.h.

References arg, escape_expr, and pattern_expr.

944  {
945  return makeExpr<RegexpExpr>(arg->rewrite_with_targetlist(tlist),
946  pattern_expr->deep_copy(),
947  escape_expr ? escape_expr->deep_copy() : nullptr);
948  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:971
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:969
std::string Analyzer::RegexpExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2492 of file Analyzer.cpp.

References arg, escape_expr, and pattern_expr.

2492  {
2493  std::string str{"(REGEXP "};
2494  str += arg->toString();
2495  str += pattern_expr->toString();
2496  if (escape_expr) {
2497  str += escape_expr->toString();
2498  }
2499  str += ") ";
2500  return str;
2501 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:967
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:971
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:969

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: