OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Analyzer::DateaddExpr Class Reference

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::DateaddExpr:
+ Collaboration diagram for Analyzer::DateaddExpr:

Public Member Functions

 DateaddExpr (const SQLTypeInfo &ti, const DateaddField f, const std::shared_ptr< Analyzer::Expr > number, const std::shared_ptr< Analyzer::Expr > datetime)
 
DateaddField get_field () const
 
const Exprget_number_expr () const
 
const Exprget_datetime_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 ()
 
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 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

const DateaddField field_
 
const std::shared_ptr
< Analyzer::Expr
number_
 
const std::shared_ptr
< Analyzer::Expr
datetime_
 

Additional Inherited Members

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

Detailed Description

Definition at line 1179 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::DateaddExpr::DateaddExpr ( const SQLTypeInfo ti,
const DateaddField  f,
const std::shared_ptr< Analyzer::Expr number,
const std::shared_ptr< Analyzer::Expr datetime 
)
inline

Definition at line 1181 of file Analyzer.h.

1185  : Expr(ti, false), field_(f), number_(number), datetime_(datetime) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
const DateaddField field_
Definition: Analyzer.h:1212
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214

Member Function Documentation

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

Reimplemented from Analyzer::Expr.

Definition at line 2894 of file Analyzer.cpp.

References datetime_, and number_.

2895  {
2896  number_->check_group_by(groupby);
2897  datetime_->check_group_by(groupby);
2898 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
void Analyzer::DateaddExpr::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 2858 of file Analyzer.cpp.

References datetime_, and number_.

2860  {
2861  number_->collect_column_var(colvar_set, include_agg);
2862  datetime_->collect_column_var(colvar_set, include_agg);
2863 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
void Analyzer::DateaddExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2826 of file Analyzer.cpp.

References datetime_, and number_.

2826  {
2827  number_->collect_rte_idx(rte_idx_set);
2828  datetime_->collect_rte_idx(rte_idx_set);
2829 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
std::shared_ptr< Analyzer::Expr > Analyzer::DateaddExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 179 of file Analyzer.cpp.

References datetime_, field_, number_, and Analyzer::Expr::type_info.

179  {
180  return makeExpr<DateaddExpr>(
181  type_info, field_, number_->deep_copy(), datetime_->deep_copy());
182 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
const DateaddField field_
Definition: Analyzer.h:1212
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
void Analyzer::DateaddExpr::find_expr ( bool(*)(const Expr *)  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2783 of file Analyzer.cpp.

References Analyzer::Expr::add_unique(), datetime_, and number_.

2784  {
2785  if (f(this)) {
2786  add_unique(expr_list);
2787  return;
2788  }
2789  number_->find_expr(f, expr_list);
2790  datetime_->find_expr(f, expr_list);
2791 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:2639
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214

+ Here is the call graph for this function:

const Expr* Analyzer::DateaddExpr::get_datetime_expr ( ) const
inline

Definition at line 1188 of file Analyzer.h.

References datetime_.

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

1188 { return datetime_.get(); }
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214

+ Here is the caller graph for this function:

DateaddField Analyzer::DateaddExpr::get_field ( ) const
inline

Definition at line 1186 of file Analyzer.h.

References field_.

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

1186 { return field_; }
const DateaddField field_
Definition: Analyzer.h:1212

+ Here is the caller graph for this function:

const Expr* Analyzer::DateaddExpr::get_number_expr ( ) const
inline

Definition at line 1187 of file Analyzer.h.

References number_.

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

1187 { return number_.get(); }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213

+ Here is the caller graph for this function:

void Analyzer::DateaddExpr::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 1625 of file Analyzer.cpp.

References datetime_, and number_.

1627  {
1628  std::set<int> rte_idx_set;
1629  number_->collect_rte_idx(rte_idx_set);
1630  datetime_->collect_rte_idx(rte_idx_set);
1631  if (rte_idx_set.size() > 1) {
1632  join_predicates.push_back(this);
1633  } else if (rte_idx_set.size() == 1) {
1634  scan_predicates.push_back(this);
1635  } else {
1636  const_predicates.push_back(this);
1637  }
1638 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
bool Analyzer::DateaddExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2210 of file Analyzer.cpp.

References datetime_, field_, get_datetime_expr(), get_field(), get_number_expr(), and number_.

2210  {
2211  if (typeid(rhs) != typeid(DateaddExpr)) {
2212  return false;
2213  }
2214  const DateaddExpr& rhs_ee = dynamic_cast<const DateaddExpr&>(rhs);
2215  return field_ == rhs_ee.get_field() && *number_ == *rhs_ee.get_number_expr() &&
2216  *datetime_ == *rhs_ee.get_datetime_expr();
2217 }
const DateaddField field_
Definition: Analyzer.h:1212
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
DateaddExpr(const SQLTypeInfo &ti, const DateaddField f, const std::shared_ptr< Analyzer::Expr > number, const std::shared_ptr< Analyzer::Expr > datetime)
Definition: Analyzer.h:1181

+ Here is the call graph for this function:

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

Reimplemented from Analyzer::Expr.

Definition at line 1921 of file Analyzer.cpp.

References datetime_, field_, number_, and Analyzer::Expr::type_info.

1922  {
1923  return makeExpr<DateaddExpr>(type_info,
1924  field_,
1925  number_->rewrite_agg_to_var(tlist),
1926  datetime_->rewrite_agg_to_var(tlist));
1927 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
const DateaddField field_
Definition: Analyzer.h:1212
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
std::shared_ptr< Analyzer::Expr > Analyzer::DateaddExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1879 of file Analyzer.cpp.

References datetime_, field_, number_, and Analyzer::Expr::type_info.

1880  {
1881  return makeExpr<DateaddExpr>(type_info,
1882  field_,
1883  number_->rewrite_with_child_targetlist(tlist),
1884  datetime_->rewrite_with_child_targetlist(tlist));
1885 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
const DateaddField field_
Definition: Analyzer.h:1212
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
std::shared_ptr< Analyzer::Expr > Analyzer::DateaddExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1836 of file Analyzer.cpp.

References datetime_, field_, number_, and Analyzer::Expr::type_info.

1837  {
1838  return makeExpr<DateaddExpr>(type_info,
1839  field_,
1840  number_->rewrite_with_targetlist(tlist),
1841  datetime_->rewrite_with_targetlist(tlist));
1842 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
const DateaddField field_
Definition: Analyzer.h:1212
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214
std::string Analyzer::DateaddExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2567 of file Analyzer.cpp.

References datetime_, field_, number_, and to_string().

2567  {
2568  return "DATEADD(" + std::to_string(field_) + " NUMBER " + number_->toString() +
2569  " DATETIME " + datetime_->toString() + ") ";
2570 }
std::string to_string(char const *&&v)
const DateaddField field_
Definition: Analyzer.h:1212
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1213
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1214

+ Here is the call graph for this function:

Member Data Documentation

const DateaddField Analyzer::DateaddExpr::field_
private

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