OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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
 
void set_fixed_encoding_null_val () const
 
bool use_fixed_encoding_null_val () 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 (std::function< bool(const Expr *)> f, 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 size_t get_num_column_vars (const bool include_agg) 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_
 
bool use_fixed_encoding_null_val_
 

Additional Inherited Members

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

Detailed Description

Definition at line 1339 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 1341 of file Analyzer.h.

1345  : Expr(ti, false)
1346  , field_(f)
1347  , number_(number)
1348  , datetime_(datetime)
1349  , use_fixed_encoding_null_val_(false) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:74
constexpr double f
Definition: Utm.h:31
const DateaddField field_
Definition: Analyzer.h:1378
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
bool use_fixed_encoding_null_val_
Definition: Analyzer.h:1384

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

References datetime_, and number_.

3440  {
3441  number_->check_group_by(groupby);
3442  datetime_->check_group_by(groupby);
3443 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
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 3377 of file Analyzer.cpp.

References datetime_, and number_.

3379  {
3380  number_->collect_column_var(colvar_set, include_agg);
3381  datetime_->collect_column_var(colvar_set, include_agg);
3382 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
void Analyzer::DateaddExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3325 of file Analyzer.cpp.

References datetime_, and number_.

3325  {
3326  number_->collect_rte_idx(rte_idx_set);
3327  datetime_->collect_rte_idx(rte_idx_set);
3328 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
std::shared_ptr< Analyzer::Expr > Analyzer::DateaddExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 198 of file Analyzer.cpp.

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

198  {
199  return makeExpr<DateaddExpr>(
200  type_info, field_, number_->deep_copy(), datetime_->deep_copy());
201 }
SQLTypeInfo type_info
Definition: Analyzer.h:184
const DateaddField field_
Definition: Analyzer.h:1378
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
void Analyzer::DateaddExpr::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3271 of file Analyzer.cpp.

References Analyzer::Expr::add_unique(), datetime_, anonymous_namespace{Utm.h}::f, and number_.

3272  {
3273  if (f(this)) {
3274  add_unique(expr_list);
3275  return;
3276  }
3277  number_->find_expr(f, expr_list);
3278  datetime_->find_expr(f, expr_list);
3279 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3101
constexpr double f
Definition: Utm.h:31
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380

+ Here is the call graph for this function:

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

Definition at line 1352 of file Analyzer.h.

References datetime_.

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

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

+ Here is the caller graph for this function:

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

Definition at line 1350 of file Analyzer.h.

References field_.

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

1350 { return field_; }
const DateaddField field_
Definition: Analyzer.h:1378

+ Here is the caller graph for this function:

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

Definition at line 1351 of file Analyzer.h.

References number_.

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

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

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

References datetime_, and number_.

1846  {
1847  std::set<int> rte_idx_set;
1848  number_->collect_rte_idx(rte_idx_set);
1849  datetime_->collect_rte_idx(rte_idx_set);
1850  if (rte_idx_set.size() > 1) {
1851  join_predicates.push_back(this);
1852  } else if (rte_idx_set.size() == 1) {
1853  scan_predicates.push_back(this);
1854  } else {
1855  const_predicates.push_back(this);
1856  }
1857 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
bool Analyzer::DateaddExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2492 of file Analyzer.cpp.

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

2492  {
2493  if (typeid(rhs) != typeid(DateaddExpr)) {
2494  return false;
2495  }
2496  const DateaddExpr& rhs_ee = dynamic_cast<const DateaddExpr&>(rhs);
2497  return field_ == rhs_ee.get_field() && *number_ == *rhs_ee.get_number_expr() &&
2498  *datetime_ == *rhs_ee.get_datetime_expr();
2499 }
const DateaddField field_
Definition: Analyzer.h:1378
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
DateaddExpr(const SQLTypeInfo &ti, const DateaddField f, const std::shared_ptr< Analyzer::Expr > number, const std::shared_ptr< Analyzer::Expr > datetime)
Definition: Analyzer.h:1341

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

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

2168  {
2169  return makeExpr<DateaddExpr>(type_info,
2170  field_,
2171  number_->rewrite_agg_to_var(tlist),
2172  datetime_->rewrite_agg_to_var(tlist));
2173 }
SQLTypeInfo type_info
Definition: Analyzer.h:184
const DateaddField field_
Definition: Analyzer.h:1378
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
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 2125 of file Analyzer.cpp.

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

2126  {
2127  return makeExpr<DateaddExpr>(type_info,
2128  field_,
2129  number_->rewrite_with_child_targetlist(tlist),
2130  datetime_->rewrite_with_child_targetlist(tlist));
2131 }
SQLTypeInfo type_info
Definition: Analyzer.h:184
const DateaddField field_
Definition: Analyzer.h:1378
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
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 2082 of file Analyzer.cpp.

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

2083  {
2084  return makeExpr<DateaddExpr>(type_info,
2085  field_,
2086  number_->rewrite_with_targetlist(tlist),
2087  datetime_->rewrite_with_targetlist(tlist));
2088 }
SQLTypeInfo type_info
Definition: Analyzer.h:184
const DateaddField field_
Definition: Analyzer.h:1378
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380
void Analyzer::DateaddExpr::set_fixed_encoding_null_val ( ) const
inline

Definition at line 1353 of file Analyzer.h.

References use_fixed_encoding_null_val_.

1353 { use_fixed_encoding_null_val_ = true; }
bool use_fixed_encoding_null_val_
Definition: Analyzer.h:1384
std::string Analyzer::DateaddExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2947 of file Analyzer.cpp.

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

2947  {
2948  return "DATEADD(" + std::to_string(field_) + " NUMBER " + number_->toString() +
2949  " DATETIME " + datetime_->toString() + ") ";
2950 }
std::string to_string(char const *&&v)
const DateaddField field_
Definition: Analyzer.h:1378
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1379
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1380

+ Here is the call graph for this function:

bool Analyzer::DateaddExpr::use_fixed_encoding_null_val ( ) const
inline

Definition at line 1354 of file Analyzer.h.

References use_fixed_encoding_null_val_.

Referenced by CodeGenerator::codegen().

1354 { return use_fixed_encoding_null_val_; }
bool use_fixed_encoding_null_val_
Definition: Analyzer.h:1384

+ Here is the caller graph for this function:

Member Data Documentation

const DateaddField Analyzer::DateaddExpr::field_
private
bool Analyzer::DateaddExpr::use_fixed_encoding_null_val_
mutableprivate

Definition at line 1384 of file Analyzer.h.

Referenced by set_fixed_encoding_null_val(), and use_fixed_encoding_null_val().


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