OmniSciDB  04ee39c94c
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 ()
 
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

const DateaddField field_
 
const std::shared_ptr< Analyzer::Exprnumber_
 
const std::shared_ptr< Analyzer::Exprdatetime_
 

Additional Inherited Members

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

Detailed Description

Definition at line 1122 of file Analyzer.h.

Constructor & Destructor Documentation

◆ DateaddExpr()

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

1128  : Expr(ti, false), field_(f), number_(number), datetime_(datetime) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
const DateaddField field_
Definition: Analyzer.h:1155
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

Member Function Documentation

◆ check_group_by()

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

Reimplemented from Analyzer::Expr.

Definition at line 2831 of file Analyzer.cpp.

2832  {
2833  number_->check_group_by(groupby);
2834  datetime_->check_group_by(groupby);
2835 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

◆ collect_column_var()

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

2797  {
2798  number_->collect_column_var(colvar_set, include_agg);
2799  datetime_->collect_column_var(colvar_set, include_agg);
2800 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

◆ collect_rte_idx()

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

Reimplemented from Analyzer::Expr.

Definition at line 2763 of file Analyzer.cpp.

2763  {
2764  number_->collect_rte_idx(rte_idx_set);
2765  datetime_->collect_rte_idx(rte_idx_set);
2766 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

◆ deep_copy()

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

Implements Analyzer::Expr.

Definition at line 175 of file Analyzer.cpp.

References Analyzer::Expr::type_info.

175  {
176  return makeExpr<DateaddExpr>(
177  type_info, field_, number_->deep_copy(), datetime_->deep_copy());
178 }
SQLTypeInfo type_info
Definition: Analyzer.h:175
const DateaddField field_
Definition: Analyzer.h:1155
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

◆ find_expr()

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

Reimplemented from Analyzer::Expr.

Definition at line 2720 of file Analyzer.cpp.

References Analyzer::Expr::add_unique().

2721  {
2722  if (f(this)) {
2723  add_unique(expr_list);
2724  return;
2725  }
2726  number_->find_expr(f, expr_list);
2727  datetime_->find_expr(f, expr_list);
2728 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
virtual void add_unique(std::list< const Expr *> &expr_list) const
Definition: Analyzer.cpp:2585
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157
+ Here is the call graph for this function:

◆ get_datetime_expr()

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

Definition at line 1131 of file Analyzer.h.

References operator==().

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

1131 { return datetime_.get(); }
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_field()

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

Definition at line 1129 of file Analyzer.h.

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

1129 { return field_; }
const DateaddField field_
Definition: Analyzer.h:1155
+ Here is the caller graph for this function:

◆ get_number_expr()

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

Definition at line 1130 of file Analyzer.h.

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

1130 { return number_.get(); }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
+ Here is the caller graph for this function:

◆ group_predicates()

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

1605  {
1606  std::set<int> rte_idx_set;
1607  number_->collect_rte_idx(rte_idx_set);
1608  datetime_->collect_rte_idx(rte_idx_set);
1609  if (rte_idx_set.size() > 1) {
1610  join_predicates.push_back(this);
1611  } else if (rte_idx_set.size() == 1) {
1612  scan_predicates.push_back(this);
1613  } else {
1614  const_predicates.push_back(this);
1615  }
1616 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

◆ operator==()

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

Implements Analyzer::Expr.

Definition at line 2180 of file Analyzer.cpp.

References get_datetime_expr(), get_field(), and get_number_expr().

2180  {
2181  if (typeid(rhs) != typeid(DateaddExpr)) {
2182  return false;
2183  }
2184  const DateaddExpr& rhs_ee = dynamic_cast<const DateaddExpr&>(rhs);
2185  return field_ == rhs_ee.get_field() && *number_ == *rhs_ee.get_number_expr() &&
2186  *datetime_ == *rhs_ee.get_datetime_expr();
2187 }
const DateaddField field_
Definition: Analyzer.h:1155
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157
DateaddExpr(const SQLTypeInfo &ti, const DateaddField f, const std::shared_ptr< Analyzer::Expr > number, const std::shared_ptr< Analyzer::Expr > datetime)
Definition: Analyzer.h:1124
+ Here is the call graph for this function:

◆ rewrite_agg_to_var()

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

References Analyzer::Expr::type_info.

1900  {
1901  return makeExpr<DateaddExpr>(type_info,
1902  field_,
1903  number_->rewrite_agg_to_var(tlist),
1904  datetime_->rewrite_agg_to_var(tlist));
1905 }
SQLTypeInfo type_info
Definition: Analyzer.h:175
const DateaddField field_
Definition: Analyzer.h:1155
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

◆ rewrite_with_child_targetlist()

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

References Analyzer::Expr::type_info.

1858  {
1859  return makeExpr<DateaddExpr>(type_info,
1860  field_,
1861  number_->rewrite_with_child_targetlist(tlist),
1862  datetime_->rewrite_with_child_targetlist(tlist));
1863 }
SQLTypeInfo type_info
Definition: Analyzer.h:175
const DateaddField field_
Definition: Analyzer.h:1155
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

◆ rewrite_with_targetlist()

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

References Analyzer::Expr::type_info.

1815  {
1816  return makeExpr<DateaddExpr>(type_info,
1817  field_,
1818  number_->rewrite_with_targetlist(tlist),
1819  datetime_->rewrite_with_targetlist(tlist));
1820 }
SQLTypeInfo type_info
Definition: Analyzer.h:175
const DateaddField field_
Definition: Analyzer.h:1155
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157

◆ toString()

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

Implements Analyzer::Expr.

Definition at line 2522 of file Analyzer.cpp.

References to_string().

2522  {
2523  return "DATEADD(" + std::to_string(field_) + " NUMBER " + number_->toString() +
2524  " DATETIME " + datetime_->toString() + ") ";
2525 }
std::string to_string(char const *&&v)
const DateaddField field_
Definition: Analyzer.h:1155
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1156
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1157
+ Here is the call graph for this function:

Member Data Documentation

◆ datetime_

const std::shared_ptr<Analyzer::Expr> Analyzer::DateaddExpr::datetime_
private

Definition at line 1157 of file Analyzer.h.

◆ field_

const DateaddField Analyzer::DateaddExpr::field_
private

Definition at line 1155 of file Analyzer.h.

◆ number_

const std::shared_ptr<Analyzer::Expr> Analyzer::DateaddExpr::number_
private

Definition at line 1156 of file Analyzer.h.


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