OmniSciDB  a5dc49c757
 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 1465 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 1467 of file Analyzer.h.

1471  : Expr(ti, false)
1472  , field_(f)
1473  , number_(number)
1474  , datetime_(datetime)
1475  , use_fixed_encoding_null_val_(false) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
const DateaddField field_
Definition: Analyzer.h:1504
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
bool use_fixed_encoding_null_val_
Definition: Analyzer.h:1510

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

References datetime_, and number_.

3609  {
3610  number_->check_group_by(groupby);
3611  datetime_->check_group_by(groupby);
3612 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
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 3546 of file Analyzer.cpp.

References datetime_, and number_.

3548  {
3549  number_->collect_column_var(colvar_set, include_agg);
3550  datetime_->collect_column_var(colvar_set, include_agg);
3551 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
void Analyzer::DateaddExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3494 of file Analyzer.cpp.

References datetime_, and number_.

3494  {
3495  number_->collect_rte_idx(rte_idx_set);
3496  datetime_->collect_rte_idx(rte_idx_set);
3497 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
std::shared_ptr< Analyzer::Expr > Analyzer::DateaddExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 215 of file Analyzer.cpp.

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

215  {
216  return makeExpr<DateaddExpr>(
217  type_info, field_, number_->deep_copy(), datetime_->deep_copy());
218 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
const DateaddField field_
Definition: Analyzer.h:1504
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
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 3440 of file Analyzer.cpp.

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

3441  {
3442  if (f(this)) {
3443  add_unique(expr_list);
3444  return;
3445  }
3446  number_->find_expr(f, expr_list);
3447  datetime_->find_expr(f, expr_list);
3448 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3248
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506

+ Here is the call graph for this function:

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

Definition at line 1478 of file Analyzer.h.

References datetime_.

Referenced by CodeGenerator::codegen(), operator==(), DeepCopyVisitor::visitDateaddExpr(), and ScalarExprVisitor< std::set< shared::TableKey > >::visitDateaddExpr().

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

+ Here is the caller graph for this function:

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

Definition at line 1476 of file Analyzer.h.

References field_.

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

1476 { return field_; }
const DateaddField field_
Definition: Analyzer.h:1504

+ Here is the caller graph for this function:

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

Definition at line 1477 of file Analyzer.h.

References number_.

Referenced by CodeGenerator::codegen(), operator==(), DeepCopyVisitor::visitDateaddExpr(), and ScalarExprVisitor< std::set< shared::TableKey > >::visitDateaddExpr().

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

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

References datetime_, and number_.

1921  {
1922  std::set<int> rte_idx_set;
1923  number_->collect_rte_idx(rte_idx_set);
1924  datetime_->collect_rte_idx(rte_idx_set);
1925  if (rte_idx_set.size() > 1) {
1926  join_predicates.push_back(this);
1927  } else if (rte_idx_set.size() == 1) {
1928  scan_predicates.push_back(this);
1929  } else {
1930  const_predicates.push_back(this);
1931  }
1932 }
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
bool Analyzer::DateaddExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2608 of file Analyzer.cpp.

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

2608  {
2609  if (typeid(rhs) != typeid(DateaddExpr)) {
2610  return false;
2611  }
2612  const DateaddExpr& rhs_ee = dynamic_cast<const DateaddExpr&>(rhs);
2613  return field_ == rhs_ee.get_field() && *number_ == *rhs_ee.get_number_expr() &&
2614  *datetime_ == *rhs_ee.get_datetime_expr();
2615 }
const DateaddField field_
Definition: Analyzer.h:1504
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
DateaddExpr(const SQLTypeInfo &ti, const DateaddField f, const std::shared_ptr< Analyzer::Expr > number, const std::shared_ptr< Analyzer::Expr > datetime)
Definition: Analyzer.h:1467

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

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

2241  {
2242  return makeExpr<DateaddExpr>(type_info,
2243  field_,
2244  number_->rewrite_agg_to_var(tlist),
2245  datetime_->rewrite_agg_to_var(tlist));
2246 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
const DateaddField field_
Definition: Analyzer.h:1504
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
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 2198 of file Analyzer.cpp.

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

2199  {
2200  return makeExpr<DateaddExpr>(type_info,
2201  field_,
2202  number_->rewrite_with_child_targetlist(tlist),
2203  datetime_->rewrite_with_child_targetlist(tlist));
2204 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
const DateaddField field_
Definition: Analyzer.h:1504
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
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 2155 of file Analyzer.cpp.

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

2156  {
2157  return makeExpr<DateaddExpr>(type_info,
2158  field_,
2159  number_->rewrite_with_targetlist(tlist),
2160  datetime_->rewrite_with_targetlist(tlist));
2161 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
const DateaddField field_
Definition: Analyzer.h:1504
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506
void Analyzer::DateaddExpr::set_fixed_encoding_null_val ( ) const
inline

Definition at line 1479 of file Analyzer.h.

References use_fixed_encoding_null_val_.

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

Implements Analyzer::Expr.

Definition at line 3091 of file Analyzer.cpp.

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

3091  {
3092  return "DATEADD(" + std::to_string(field_) + " NUMBER " + number_->toString() +
3093  " DATETIME " + datetime_->toString() + ") ";
3094 }
std::string to_string(char const *&&v)
const DateaddField field_
Definition: Analyzer.h:1504
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1505
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1506

+ Here is the call graph for this function:

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

Definition at line 1480 of file Analyzer.h.

References use_fixed_encoding_null_val_.

Referenced by CodeGenerator::codegen().

1480 { return use_fixed_encoding_null_val_; }
bool use_fixed_encoding_null_val_
Definition: Analyzer.h:1510

+ 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 1510 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: