OmniSciDB  85c2d10cdc
 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 1230 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 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
char * f

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

References datetime_, and number_.

3096  {
3097  number_->check_group_by(groupby);
3098  datetime_->check_group_by(groupby);
3099 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265
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 3050 of file Analyzer.cpp.

References datetime_, and number_.

3052  {
3053  number_->collect_column_var(colvar_set, include_agg);
3054  datetime_->collect_column_var(colvar_set, include_agg);
3055 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265
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.

References datetime_, and number_.

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
std::shared_ptr< Analyzer::Expr > Analyzer::DateaddExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 181 of file Analyzer.cpp.

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

181  {
182  return makeExpr<DateaddExpr>(
183  type_info, field_, number_->deep_copy(), datetime_->deep_copy());
184 }
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
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(), datetime_, f, and number_.

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 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:2815
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1264
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1265
char * f

+ Here is the call graph for this function:

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

Definition at line 1239 of file Analyzer.h.

References datetime_.

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 caller graph for this function:

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

Definition at line 1237 of file Analyzer.h.

References field_.

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:

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

Definition at line 1238 of file Analyzer.h.

References number_.

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:

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

References datetime_, and number_.

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

Implements Analyzer::Expr.

Definition at line 2308 of file Analyzer.cpp.

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

2308  {
2309  if (typeid(rhs) != typeid(DateaddExpr)) {
2310  return false;
2311  }
2312  const DateaddExpr& rhs_ee = dynamic_cast<const DateaddExpr&>(rhs);
2313  return field_ == rhs_ee.get_field() && *number_ == *rhs_ee.get_number_expr() &&
2314  *datetime_ == *rhs_ee.get_datetime_expr();
2315 }
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:

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

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

2009  {
2010  return makeExpr<DateaddExpr>(type_info,
2011  field_,
2012  number_->rewrite_agg_to_var(tlist),
2013  datetime_->rewrite_agg_to_var(tlist));
2014 }
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
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 1966 of file Analyzer.cpp.

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

1967  {
1968  return makeExpr<DateaddExpr>(type_info,
1969  field_,
1970  number_->rewrite_with_child_targetlist(tlist),
1971  datetime_->rewrite_with_child_targetlist(tlist));
1972 }
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
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 1923 of file Analyzer.cpp.

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

1924  {
1925  return makeExpr<DateaddExpr>(type_info,
1926  field_,
1927  number_->rewrite_with_targetlist(tlist),
1928  datetime_->rewrite_with_targetlist(tlist));
1929 }
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
std::string Analyzer::DateaddExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2699 of file Analyzer.cpp.

References datetime_, field_, number_, and 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

const DateaddField Analyzer::DateaddExpr::field_
private

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