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

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::DatetruncExpr:
+ Collaboration diagram for Analyzer::DatetruncExpr:

Public Member Functions

 DatetruncExpr (const SQLTypeInfo &ti, bool has_agg, DatetruncField f, std::shared_ptr< Analyzer::Expr > e)
 
DatetruncField get_field () const
 
const Exprget_from_expr () const
 
const std::shared_ptr
< Analyzer::Expr
get_own_from_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

DatetruncField field_
 
std::shared_ptr< Analyzer::Exprfrom_expr_
 

Additional Inherited Members

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

Detailed Description

Definition at line 1559 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::DatetruncExpr::DatetruncExpr ( const SQLTypeInfo ti,
bool  has_agg,
DatetruncField  f,
std::shared_ptr< Analyzer::Expr e 
)
inline

Definition at line 1561 of file Analyzer.h.

1565  : Expr(ti, has_agg), field_(f), from_expr_(e) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
DatetruncField field_
Definition: Analyzer.h:1592
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)

Member Function Documentation

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

Reimplemented from Analyzer::Expr.

Definition at line 3620 of file Analyzer.cpp.

References from_expr_.

3621  {
3622  from_expr_->check_group_by(groupby);
3623 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
void Analyzer::DatetruncExpr::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 3560 of file Analyzer.cpp.

References from_expr_.

3562  {
3563  from_expr_->collect_column_var(colvar_set, include_agg);
3564 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
void Analyzer::DatetruncExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3504 of file Analyzer.cpp.

References from_expr_.

3504  {
3505  from_expr_->collect_rte_idx(rte_idx_set);
3506 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
std::shared_ptr< Analyzer::Expr > Analyzer::DatetruncExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 225 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, field_, from_expr_, and Analyzer::Expr::type_info.

225  {
226  return makeExpr<DatetruncExpr>(
227  type_info, contains_agg, field_, from_expr_->deep_copy());
228 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
DatetruncField field_
Definition: Analyzer.h:1592
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
bool contains_agg
Definition: Analyzer.h:181
void Analyzer::DatetruncExpr::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3460 of file Analyzer.cpp.

References Analyzer::Expr::add_unique(), f(), and from_expr_.

3461  {
3462  if (f(this)) {
3463  add_unique(expr_list);
3464  return;
3465  }
3466  from_expr_->find_expr(f, expr_list);
3467 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3248
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)

+ Here is the call graph for this function:

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

Definition at line 1566 of file Analyzer.h.

References field_.

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

1566 { return field_; }
DatetruncField field_
Definition: Analyzer.h:1592

+ Here is the caller graph for this function:

const Expr* Analyzer::DatetruncExpr::get_from_expr ( ) const
inline

Definition at line 1567 of file Analyzer.h.

References from_expr_.

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

1567 { return from_expr_.get(); }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593

+ Here is the caller graph for this function:

const std::shared_ptr<Analyzer::Expr> Analyzer::DatetruncExpr::get_own_from_expr ( ) const
inline

Definition at line 1568 of file Analyzer.h.

References from_expr_.

1568 { return from_expr_; }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
void Analyzer::DatetruncExpr::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 1949 of file Analyzer.cpp.

References from_expr_.

1951  {
1952  std::set<int> rte_idx_set;
1953  from_expr_->collect_rte_idx(rte_idx_set);
1954  if (rte_idx_set.size() > 1) {
1955  join_predicates.push_back(this);
1956  } else if (rte_idx_set.size() == 1) {
1957  scan_predicates.push_back(this);
1958  } else {
1959  const_predicates.push_back(this);
1960  }
1961 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
bool Analyzer::DatetruncExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2626 of file Analyzer.cpp.

References field_, from_expr_, get_field(), and get_from_expr().

2626  {
2627  if (typeid(rhs) != typeid(DatetruncExpr)) {
2628  return false;
2629  }
2630  const DatetruncExpr& rhs_ee = dynamic_cast<const DatetruncExpr&>(rhs);
2631  return field_ == rhs_ee.get_field() && *from_expr_ == *rhs_ee.get_from_expr();
2632 }
DatetruncField field_
Definition: Analyzer.h:1592
DatetruncExpr(const SQLTypeInfo &ti, bool has_agg, DatetruncField f, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:1561
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593

+ Here is the call graph for this function:

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

Reimplemented from Analyzer::Expr.

Definition at line 2256 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, field_, from_expr_, and Analyzer::Expr::type_info.

2257  {
2258  return makeExpr<DatetruncExpr>(
2259  type_info, contains_agg, field_, from_expr_->rewrite_agg_to_var(tlist));
2260 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
DatetruncField field_
Definition: Analyzer.h:1592
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
bool contains_agg
Definition: Analyzer.h:181
std::shared_ptr< Analyzer::Expr > Analyzer::DatetruncExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2214 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, field_, from_expr_, and Analyzer::Expr::type_info.

2215  {
2216  return makeExpr<DatetruncExpr>(
2217  type_info, contains_agg, field_, from_expr_->rewrite_with_child_targetlist(tlist));
2218 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
DatetruncField field_
Definition: Analyzer.h:1592
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
bool contains_agg
Definition: Analyzer.h:181
std::shared_ptr< Analyzer::Expr > Analyzer::DatetruncExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2171 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, field_, from_expr_, and Analyzer::Expr::type_info.

2172  {
2173  return makeExpr<DatetruncExpr>(
2174  type_info, contains_agg, field_, from_expr_->rewrite_with_targetlist(tlist));
2175 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
DatetruncField field_
Definition: Analyzer.h:1592
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593
bool contains_agg
Definition: Analyzer.h:181
std::string Analyzer::DatetruncExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 3101 of file Analyzer.cpp.

References field_, from_expr_, and to_string().

3101  {
3102  return "DATE_TRUNC(" + std::to_string(field_) + " , " + from_expr_->toString() + ") ";
3103 }
std::string to_string(char const *&&v)
DatetruncField field_
Definition: Analyzer.h:1592
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1593

+ Here is the call graph for this function:

Member Data Documentation

DatetruncField Analyzer::DatetruncExpr::field_
private

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