OmniSciDB  5ade3759e0
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::Exprget_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 ()
 
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
 
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 860 of file Analyzer.h.

Constructor & Destructor Documentation

◆ RegexpExpr()

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

865  : Expr(kBOOLEAN, a->get_type_info().get_notnull())
866  , arg(a)
867  , pattern_expr(p)
868  , escape_expr(e) {}
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:914
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:912

Member Function Documentation

◆ collect_column_var()

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

883  {
884  arg->collect_column_var(colvar_set, include_agg);
885  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910

◆ collect_rte_idx()

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

Reimplemented from Analyzer::Expr.

Definition at line 877 of file Analyzer.h.

877  {
878  arg->collect_rte_idx(rte_idx_set);
879  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910

◆ deep_copy()

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

Implements Analyzer::Expr.

Definition at line 142 of file Analyzer.cpp.

142  {
143  return makeExpr<RegexpExpr>(arg->deep_copy(),
144  pattern_expr->deep_copy(),
145  escape_expr ? escape_expr->deep_copy() : nullptr);
146 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:914
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:912

◆ find_expr()

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

Reimplemented from Analyzer::Expr.

Definition at line 2664 of file Analyzer.cpp.

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

2665  {
2666  if (f(this)) {
2667  add_unique(expr_list);
2668  return;
2669  }
2670  arg->find_expr(f, expr_list);
2671  pattern_expr->find_expr(f, expr_list);
2672  if (escape_expr != nullptr) {
2673  escape_expr->find_expr(f, expr_list);
2674  }
2675 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:914
virtual void add_unique(std::list< const Expr *> &expr_list) const
Definition: Analyzer.cpp:2585
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:912
+ Here is the call graph for this function:

◆ get_arg()

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

Definition at line 869 of file Analyzer.h.

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

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

◆ get_escape_expr()

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

Definition at line 872 of file Analyzer.h.

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

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

◆ get_own_arg()

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

Definition at line 870 of file Analyzer.h.

Referenced by CodeGenerator::codegen().

870 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
+ Here is the caller graph for this function:

◆ get_pattern_expr()

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

Definition at line 871 of file Analyzer.h.

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

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

◆ group_predicates()

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

References Analyzer::InIntegerSet::arg.

1529  {
1530  std::set<int> rte_idx_set;
1531  arg->collect_rte_idx(rte_idx_set);
1532  if (rte_idx_set.size() > 1) {
1533  join_predicates.push_back(this);
1534  } else if (rte_idx_set.size() == 1) {
1535  scan_predicates.push_back(this);
1536  } else {
1537  const_predicates.push_back(this);
1538  }
1539 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910

◆ operator==()

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

Implements Analyzer::Expr.

Definition at line 2079 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg, get_arg(), get_escape_expr(), and get_pattern_expr().

2079  {
2080  if (typeid(rhs) != typeid(RegexpExpr)) {
2081  return false;
2082  }
2083  const RegexpExpr& rhs_re = dynamic_cast<const RegexpExpr&>(rhs);
2084  if (!(*arg == *rhs_re.get_arg()) || !(*pattern_expr == *rhs_re.get_pattern_expr())) {
2085  return false;
2086  }
2087  if (escape_expr.get() == rhs_re.get_escape_expr()) {
2088  return true;
2089  }
2090  if (escape_expr != nullptr && rhs_re.get_escape_expr() != nullptr &&
2091  *escape_expr == *rhs_re.get_escape_expr()) {
2092  return true;
2093  }
2094  return false;
2095 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:914
RegexpExpr(std::shared_ptr< Analyzer::Expr > a, std::shared_ptr< Analyzer::Expr > p, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:862
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:912
+ Here is the call graph for this function:

◆ rewrite_agg_to_var()

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

References operator==().

899  {
900  return makeExpr<RegexpExpr>(arg->rewrite_agg_to_var(tlist),
901  pattern_expr->deep_copy(),
902  escape_expr ? escape_expr->deep_copy() : nullptr);
903  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:914
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:912
+ Here is the call graph for this function:

◆ rewrite_with_child_targetlist()

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

893  {
894  return makeExpr<RegexpExpr>(arg->rewrite_with_child_targetlist(tlist),
895  pattern_expr->deep_copy(),
896  escape_expr ? escape_expr->deep_copy() : nullptr);
897  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:914
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:912

◆ rewrite_with_targetlist()

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

887  {
888  return makeExpr<RegexpExpr>(arg->rewrite_with_targetlist(tlist),
889  pattern_expr->deep_copy(),
890  escape_expr ? escape_expr->deep_copy() : nullptr);
891  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:914
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:912

◆ toString()

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

Implements Analyzer::Expr.

Definition at line 2447 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg.

2447  {
2448  std::string str{"(REGEXP "};
2449  str += arg->toString();
2450  str += pattern_expr->toString();
2451  if (escape_expr) {
2452  str += escape_expr->toString();
2453  }
2454  str += ") ";
2455  return str;
2456 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:910
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:914
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:912

Member Data Documentation

◆ arg

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

Definition at line 910 of file Analyzer.h.

◆ escape_expr

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

Definition at line 914 of file Analyzer.h.

◆ pattern_expr

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

Definition at line 912 of file Analyzer.h.


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