OmniSciDB  04ee39c94c
Analyzer::ExtractExpr Class Reference

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::ExtractExpr:
+ Collaboration diagram for Analyzer::ExtractExpr:

Public Member Functions

 ExtractExpr (const SQLTypeInfo &ti, bool has_agg, ExtractField f, std::shared_ptr< Analyzer::Expr > e)
 
ExtractField get_field () const
 
const Exprget_from_expr () const
 
const std::shared_ptr< Analyzer::Exprget_own_from_expr () const
 
std::shared_ptr< Analyzer::Exprdeep_copy () const override
 
void check_group_by (const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) 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 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

ExtractField field_
 
std::shared_ptr< Analyzer::Exprfrom_expr_
 

Additional Inherited Members

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

Detailed Description

Definition at line 1081 of file Analyzer.h.

Constructor & Destructor Documentation

◆ ExtractExpr()

Analyzer::ExtractExpr::ExtractExpr ( const SQLTypeInfo ti,
bool  has_agg,
ExtractField  f,
std::shared_ptr< Analyzer::Expr e 
)
inline

Definition at line 1083 of file Analyzer.h.

1087  : Expr(ti, has_agg), field_(f), from_expr_(e) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
ExtractField field_
Definition: Analyzer.h:1114

Member Function Documentation

◆ check_group_by()

void ExtractExpr::check_group_by ( const std::list< std::shared_ptr< Analyzer::Expr >> &  groupby) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2826 of file Analyzer.cpp.

2827  {
2828  from_expr_->check_group_by(groupby);
2829 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115

◆ collect_column_var()

void ExtractExpr::collect_column_var ( std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &  colvar_set,
bool  include_agg 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2789 of file Analyzer.cpp.

2791  {
2792  from_expr_->collect_column_var(colvar_set, include_agg);
2793 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115

◆ collect_rte_idx()

void ExtractExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2759 of file Analyzer.cpp.

2759  {
2760  from_expr_->collect_rte_idx(rte_idx_set);
2761 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115

◆ deep_copy()

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

Implements Analyzer::Expr.

Definition at line 171 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, and Analyzer::Expr::type_info.

171  {
172  return makeExpr<ExtractExpr>(type_info, contains_agg, field_, from_expr_->deep_copy());
173 }
SQLTypeInfo type_info
Definition: Analyzer.h:175
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
ExtractField field_
Definition: Analyzer.h:1114
bool contains_agg
Definition: Analyzer.h:176

◆ find_expr()

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

Reimplemented from Analyzer::Expr.

Definition at line 2711 of file Analyzer.cpp.

References Analyzer::Expr::add_unique().

2712  {
2713  if (f(this)) {
2714  add_unique(expr_list);
2715  return;
2716  }
2717  from_expr_->find_expr(f, expr_list);
2718 }
virtual void add_unique(std::list< const Expr *> &expr_list) const
Definition: Analyzer.cpp:2585
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
+ Here is the call graph for this function:

◆ get_field()

ExtractField Analyzer::ExtractExpr::get_field ( ) const
inline

Definition at line 1088 of file Analyzer.h.

Referenced by CodeGenerator::codegen(), getExpressionRange(), operator==(), and DeepCopyVisitor::visitExtractExpr().

1088 { return field_; }
ExtractField field_
Definition: Analyzer.h:1114
+ Here is the caller graph for this function:

◆ get_from_expr()

const Expr* Analyzer::ExtractExpr::get_from_expr ( ) const
inline

Definition at line 1089 of file Analyzer.h.

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

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

◆ get_own_from_expr()

const std::shared_ptr<Analyzer::Expr> Analyzer::ExtractExpr::get_own_from_expr ( ) const
inline

Definition at line 1090 of file Analyzer.h.

References operator==().

1090 { return from_expr_; }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
+ Here is the call graph for this function:

◆ group_predicates()

void ExtractExpr::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 1589 of file Analyzer.cpp.

1591  {
1592  std::set<int> rte_idx_set;
1593  from_expr_->collect_rte_idx(rte_idx_set);
1594  if (rte_idx_set.size() > 1) {
1595  join_predicates.push_back(this);
1596  } else if (rte_idx_set.size() == 1) {
1597  scan_predicates.push_back(this);
1598  } else {
1599  const_predicates.push_back(this);
1600  }
1601 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115

◆ operator==()

bool ExtractExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2172 of file Analyzer.cpp.

References get_field(), and get_from_expr().

2172  {
2173  if (typeid(rhs) != typeid(ExtractExpr)) {
2174  return false;
2175  }
2176  const ExtractExpr& rhs_ee = dynamic_cast<const ExtractExpr&>(rhs);
2177  return field_ == rhs_ee.get_field() && *from_expr_ == *rhs_ee.get_from_expr();
2178 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
ExtractField field_
Definition: Analyzer.h:1114
+ Here is the call graph for this function:

◆ rewrite_agg_to_var()

std::shared_ptr< Analyzer::Expr > ExtractExpr::rewrite_agg_to_var ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1893 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, and Analyzer::Expr::type_info.

1894  {
1895  return makeExpr<ExtractExpr>(
1896  type_info, contains_agg, field_, from_expr_->rewrite_agg_to_var(tlist));
1897 }
SQLTypeInfo type_info
Definition: Analyzer.h:175
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
ExtractField field_
Definition: Analyzer.h:1114
bool contains_agg
Definition: Analyzer.h:176

◆ rewrite_with_child_targetlist()

std::shared_ptr< Analyzer::Expr > ExtractExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1851 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, and Analyzer::Expr::type_info.

1852  {
1853  return makeExpr<ExtractExpr>(
1854  type_info, contains_agg, field_, from_expr_->rewrite_with_child_targetlist(tlist));
1855 }
SQLTypeInfo type_info
Definition: Analyzer.h:175
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
ExtractField field_
Definition: Analyzer.h:1114
bool contains_agg
Definition: Analyzer.h:176

◆ rewrite_with_targetlist()

std::shared_ptr< Analyzer::Expr > ExtractExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1808 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, and Analyzer::Expr::type_info.

1809  {
1810  return makeExpr<ExtractExpr>(
1811  type_info, contains_agg, field_, from_expr_->rewrite_with_targetlist(tlist));
1812 }
SQLTypeInfo type_info
Definition: Analyzer.h:175
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
ExtractField field_
Definition: Analyzer.h:1114
bool contains_agg
Definition: Analyzer.h:176

◆ toString()

std::string ExtractExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2518 of file Analyzer.cpp.

References to_string().

2518  {
2519  return "EXTRACT(" + std::to_string(field_) + " FROM " + from_expr_->toString() + ") ";
2520 }
std::string to_string(char const *&&v)
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1115
ExtractField field_
Definition: Analyzer.h:1114
+ Here is the call graph for this function:

Member Data Documentation

◆ field_

ExtractField Analyzer::ExtractExpr::field_
private

Definition at line 1114 of file Analyzer.h.

◆ from_expr_

std::shared_ptr<Analyzer::Expr> Analyzer::ExtractExpr::from_expr_
private

Definition at line 1115 of file Analyzer.h.


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