OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Analyzer::DatediffExpr Class Reference

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::DatediffExpr:
+ Collaboration diagram for Analyzer::DatediffExpr:

Public Member Functions

 DatediffExpr (const SQLTypeInfo &ti, const DatetruncField f, const std::shared_ptr< Analyzer::Expr > start, const std::shared_ptr< Analyzer::Expr > end)
 
DatetruncField get_field () const
 
const Exprget_start_expr () const
 
const Exprget_end_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 (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 DatetruncField field_
 
const std::shared_ptr
< Analyzer::Expr
start_
 
const std::shared_ptr
< Analyzer::Expr
end_
 

Additional Inherited Members

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

Detailed Description

Definition at line 1517 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::DatediffExpr::DatediffExpr ( const SQLTypeInfo ti,
const DatetruncField  f,
const std::shared_ptr< Analyzer::Expr start,
const std::shared_ptr< Analyzer::Expr end 
)
inline

Definition at line 1519 of file Analyzer.h.

1523  : Expr(ti, false), field_(f), start_(start), end_(end) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
const DatetruncField field_
Definition: Analyzer.h:1550
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)

Member Function Documentation

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

Reimplemented from Analyzer::Expr.

Definition at line 3614 of file Analyzer.cpp.

References end_, and start_.

3615  {
3616  start_->check_group_by(groupby);
3617  end_->check_group_by(groupby);
3618 }
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
void Analyzer::DatediffExpr::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 3553 of file Analyzer.cpp.

References end_, and start_.

3555  {
3556  start_->collect_column_var(colvar_set, include_agg);
3557  end_->collect_column_var(colvar_set, include_agg);
3558 }
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
void Analyzer::DatediffExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3499 of file Analyzer.cpp.

References end_, and start_.

3499  {
3500  start_->collect_rte_idx(rte_idx_set);
3501  end_->collect_rte_idx(rte_idx_set);
3502 }
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
std::shared_ptr< Analyzer::Expr > Analyzer::DatediffExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 220 of file Analyzer.cpp.

References end_, field_, start_, and Analyzer::Expr::type_info.

220  {
221  return makeExpr<DatediffExpr>(
222  type_info, field_, start_->deep_copy(), end_->deep_copy());
223 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
const DatetruncField field_
Definition: Analyzer.h:1550
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
void Analyzer::DatediffExpr::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3450 of file Analyzer.cpp.

References Analyzer::Expr::add_unique(), end_, f(), and start_.

3451  {
3452  if (f(this)) {
3453  add_unique(expr_list);
3454  return;
3455  }
3456  start_->find_expr(f, expr_list);
3457  end_->find_expr(f, expr_list);
3458 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3248
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)

+ Here is the call graph for this function:

const Expr* Analyzer::DatediffExpr::get_end_expr ( ) const
inline

Definition at line 1526 of file Analyzer.h.

References end_.

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

1526 { return end_.get(); }
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552

+ Here is the caller graph for this function:

DatetruncField Analyzer::DatediffExpr::get_field ( ) const
inline

Definition at line 1524 of file Analyzer.h.

References field_.

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

1524 { return field_; }
const DatetruncField field_
Definition: Analyzer.h:1550

+ Here is the caller graph for this function:

const Expr* Analyzer::DatediffExpr::get_start_expr ( ) const
inline

Definition at line 1525 of file Analyzer.h.

References start_.

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

1525 { return start_.get(); }
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551

+ Here is the caller graph for this function:

void Analyzer::DatediffExpr::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 1934 of file Analyzer.cpp.

References end_, and start_.

1936  {
1937  std::set<int> rte_idx_set;
1938  start_->collect_rte_idx(rte_idx_set);
1939  end_->collect_rte_idx(rte_idx_set);
1940  if (rte_idx_set.size() > 1) {
1941  join_predicates.push_back(this);
1942  } else if (rte_idx_set.size() == 1) {
1943  scan_predicates.push_back(this);
1944  } else {
1945  const_predicates.push_back(this);
1946  }
1947 }
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
bool Analyzer::DatediffExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2617 of file Analyzer.cpp.

References end_, field_, get_end_expr(), get_field(), get_start_expr(), and start_.

2617  {
2618  if (typeid(rhs) != typeid(DatediffExpr)) {
2619  return false;
2620  }
2621  const DatediffExpr& rhs_ee = dynamic_cast<const DatediffExpr&>(rhs);
2622  return field_ == rhs_ee.get_field() && *start_ == *rhs_ee.get_start_expr() &&
2623  *end_ == *rhs_ee.get_end_expr();
2624 }
DatediffExpr(const SQLTypeInfo &ti, const DatetruncField f, const std::shared_ptr< Analyzer::Expr > start, const std::shared_ptr< Analyzer::Expr > end)
Definition: Analyzer.h:1519
const DatetruncField field_
Definition: Analyzer.h:1550
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551

+ Here is the call graph for this function:

std::shared_ptr< Analyzer::Expr > Analyzer::DatediffExpr::rewrite_agg_to_var ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2248 of file Analyzer.cpp.

References end_, field_, start_, and Analyzer::Expr::type_info.

2249  {
2250  return makeExpr<DatediffExpr>(type_info,
2251  field_,
2252  start_->rewrite_agg_to_var(tlist),
2253  end_->rewrite_agg_to_var(tlist));
2254 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
const DatetruncField field_
Definition: Analyzer.h:1550
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
std::shared_ptr< Analyzer::Expr > Analyzer::DatediffExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2206 of file Analyzer.cpp.

References end_, field_, start_, and Analyzer::Expr::type_info.

2207  {
2208  return makeExpr<DatediffExpr>(type_info,
2209  field_,
2210  start_->rewrite_with_child_targetlist(tlist),
2211  end_->rewrite_with_child_targetlist(tlist));
2212 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
const DatetruncField field_
Definition: Analyzer.h:1550
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
std::shared_ptr< Analyzer::Expr > Analyzer::DatediffExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2163 of file Analyzer.cpp.

References end_, field_, start_, and Analyzer::Expr::type_info.

2164  {
2165  return makeExpr<DatediffExpr>(type_info,
2166  field_,
2167  start_->rewrite_with_targetlist(tlist),
2168  end_->rewrite_with_targetlist(tlist));
2169 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
const DatetruncField field_
Definition: Analyzer.h:1550
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551
std::string Analyzer::DatediffExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 3096 of file Analyzer.cpp.

References end_, field_, start_, and to_string().

3096  {
3097  return "DATEDIFF(" + std::to_string(field_) + " START " + start_->toString() + " END " +
3098  end_->toString() + ") ";
3099 }
std::string to_string(char const *&&v)
const DatetruncField field_
Definition: Analyzer.h:1550
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1552
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1551

+ Here is the call graph for this function:

Member Data Documentation

const DatetruncField Analyzer::DatediffExpr::field_
private

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