OmniSciDB  baf940c279
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::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 1230 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 1232 of file Analyzer.h.

1236  : Expr(ti, false), field_(f), number_(number), datetime_(datetime) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
const DateaddField field_
Definition: Analyzer.h:1263
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

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

3080  {
3081  number_->check_group_by(groupby);
3082  datetime_->check_group_by(groupby);
3083 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

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

3045  {
3046  number_->collect_column_var(colvar_set, include_agg);
3047  datetime_->collect_column_var(colvar_set, include_agg);
3048 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

◆ collect_rte_idx()

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

Reimplemented from Analyzer::Expr.

Definition at line 3011 of file Analyzer.cpp.

3011  {
3012  number_->collect_rte_idx(rte_idx_set);
3013  datetime_->collect_rte_idx(rte_idx_set);
3014 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

◆ deep_copy()

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

Implements Analyzer::Expr.

Definition at line 183 of file Analyzer.cpp.

References Analyzer::Expr::type_info.

183  {
184  return makeExpr<DateaddExpr>(
185  type_info, field_, number_->deep_copy(), datetime_->deep_copy());
186 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
const DateaddField field_
Definition: Analyzer.h:1263
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

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

References Analyzer::Expr::add_unique().

2969  {
2970  if (f(this)) {
2971  add_unique(expr_list);
2972  return;
2973  }
2974  number_->find_expr(f, expr_list);
2975  datetime_->find_expr(f, expr_list);
2976 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
virtual void add_unique(std::list< const Expr *> &expr_list) const
Definition: Analyzer.cpp:2815
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265
+ Here is the call graph for this function:

◆ get_datetime_expr()

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

Definition at line 1239 of file Analyzer.h.

References operator==(), and toString().

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

1239 { return datetime_.get(); }
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265
+ 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 1237 of file Analyzer.h.

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

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

◆ get_number_expr()

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

Definition at line 1238 of file Analyzer.h.

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

1238 { return number_.get(); }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
+ 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 1714 of file Analyzer.cpp.

1716  {
1717  std::set<int> rte_idx_set;
1718  number_->collect_rte_idx(rte_idx_set);
1719  datetime_->collect_rte_idx(rte_idx_set);
1720  if (rte_idx_set.size() > 1) {
1721  join_predicates.push_back(this);
1722  } else if (rte_idx_set.size() == 1) {
1723  scan_predicates.push_back(this);
1724  } else {
1725  const_predicates.push_back(this);
1726  }
1727 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

◆ operator==()

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

Implements Analyzer::Expr.

Definition at line 2310 of file Analyzer.cpp.

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

2310  {
2311  if (typeid(rhs) != typeid(DateaddExpr)) {
2312  return false;
2313  }
2314  const DateaddExpr& rhs_ee = dynamic_cast<const DateaddExpr&>(rhs);
2315  return field_ == rhs_ee.get_field() && *number_ == *rhs_ee.get_number_expr() &&
2316  *datetime_ == *rhs_ee.get_datetime_expr();
2317 }
const DateaddField field_
Definition: Analyzer.h:1263
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265
DateaddExpr(const SQLTypeInfo &ti, const DateaddField f, const std::shared_ptr< Analyzer::Expr > number, const std::shared_ptr< Analyzer::Expr > datetime)
Definition: Analyzer.h:1232
+ 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 2010 of file Analyzer.cpp.

References Analyzer::Expr::type_info.

2011  {
2012  return makeExpr<DateaddExpr>(type_info,
2013  field_,
2014  number_->rewrite_agg_to_var(tlist),
2015  datetime_->rewrite_agg_to_var(tlist));
2016 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
const DateaddField field_
Definition: Analyzer.h:1263
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

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

References Analyzer::Expr::type_info.

1969  {
1970  return makeExpr<DateaddExpr>(type_info,
1971  field_,
1972  number_->rewrite_with_child_targetlist(tlist),
1973  datetime_->rewrite_with_child_targetlist(tlist));
1974 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
const DateaddField field_
Definition: Analyzer.h:1263
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

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

References Analyzer::Expr::type_info.

1926  {
1927  return makeExpr<DateaddExpr>(type_info,
1928  field_,
1929  number_->rewrite_with_targetlist(tlist),
1930  datetime_->rewrite_with_targetlist(tlist));
1931 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
const DateaddField field_
Definition: Analyzer.h:1263
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265

◆ toString()

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

Implements Analyzer::Expr.

Definition at line 2699 of file Analyzer.cpp.

References to_string().

2699  {
2700  return "DATEADD(" + std::to_string(field_) + " NUMBER " + number_->toString() +
2701  " DATETIME " + datetime_->toString() + ") ";
2702 }
std::string to_string(char const *&&v)
const DateaddField field_
Definition: Analyzer.h:1263
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265
+ 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 1265 of file Analyzer.h.

◆ field_

const DateaddField Analyzer::DateaddExpr::field_
private

Definition at line 1263 of file Analyzer.h.

◆ number_

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

Definition at line 1264 of file Analyzer.h.


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