OmniSciDB  baf940c279
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::Exprget_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 (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::Expradd_cast (const SQLTypeInfo &new_type_info)
 
virtual std::shared_ptr< Analyzer::Exprnormalize_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

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 1314 of file Analyzer.h.

Constructor & Destructor Documentation

◆ DatetruncExpr()

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

Definition at line 1316 of file Analyzer.h.

1320  : Expr(ti, has_agg), field_(f), from_expr_(e) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
DatetruncField field_
Definition: Analyzer.h:1347
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348

Member Function Documentation

◆ check_group_by()

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

Reimplemented from Analyzer::Expr.

Definition at line 3091 of file Analyzer.cpp.

3092  {
3093  from_expr_->check_group_by(groupby);
3094 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348

◆ collect_column_var()

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

3059  {
3060  from_expr_->collect_column_var(colvar_set, include_agg);
3061 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348

◆ collect_rte_idx()

void Analyzer::DatetruncExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3021 of file Analyzer.cpp.

3021  {
3022  from_expr_->collect_rte_idx(rte_idx_set);
3023 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348

◆ deep_copy()

std::shared_ptr< Analyzer::Expr > Analyzer::DatetruncExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 193 of file Analyzer.cpp.

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

193  {
194  return makeExpr<DatetruncExpr>(
195  type_info, contains_agg, field_, from_expr_->deep_copy());
196 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
DatetruncField field_
Definition: Analyzer.h:1347
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
bool contains_agg
Definition: Analyzer.h:177

◆ find_expr()

void Analyzer::DatetruncExpr::find_expr ( bool(*)(const Expr *)  f,
std::list< const Expr *> &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2988 of file Analyzer.cpp.

References Analyzer::Expr::add_unique().

2989  {
2990  if (f(this)) {
2991  add_unique(expr_list);
2992  return;
2993  }
2994  from_expr_->find_expr(f, expr_list);
2995 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
virtual void add_unique(std::list< const Expr *> &expr_list) const
Definition: Analyzer.cpp:2815
+ Here is the call graph for this function:

◆ get_field()

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

Definition at line 1321 of file Analyzer.h.

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

1321 { return field_; }
DatetruncField field_
Definition: Analyzer.h:1347
+ Here is the caller graph for this function:

◆ get_from_expr()

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

Definition at line 1322 of file Analyzer.h.

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

1322 { return from_expr_.get(); }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
+ Here is the caller graph for this function:

◆ get_own_from_expr()

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

Definition at line 1323 of file Analyzer.h.

References operator==(), and toString().

1323 { return from_expr_; }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
+ Here is the call graph for this function:

◆ group_predicates()

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

1746  {
1747  std::set<int> rte_idx_set;
1748  from_expr_->collect_rte_idx(rte_idx_set);
1749  if (rte_idx_set.size() > 1) {
1750  join_predicates.push_back(this);
1751  } else if (rte_idx_set.size() == 1) {
1752  scan_predicates.push_back(this);
1753  } else {
1754  const_predicates.push_back(this);
1755  }
1756 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348

◆ operator==()

bool Analyzer::DatetruncExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2328 of file Analyzer.cpp.

References get_field(), and get_from_expr().

2328  {
2329  if (typeid(rhs) != typeid(DatetruncExpr)) {
2330  return false;
2331  }
2332  const DatetruncExpr& rhs_ee = dynamic_cast<const DatetruncExpr&>(rhs);
2333  return field_ == rhs_ee.get_field() && *from_expr_ == *rhs_ee.get_from_expr();
2334 }
DatetruncField field_
Definition: Analyzer.h:1347
DatetruncExpr(const SQLTypeInfo &ti, bool has_agg, DatetruncField f, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:1316
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
+ Here is the call graph for this function:

◆ rewrite_agg_to_var()

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

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

2027  {
2028  return makeExpr<DatetruncExpr>(
2029  type_info, contains_agg, field_, from_expr_->rewrite_agg_to_var(tlist));
2030 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
DatetruncField field_
Definition: Analyzer.h:1347
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
bool contains_agg
Definition: Analyzer.h:177

◆ rewrite_with_child_targetlist()

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

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

1985  {
1986  return makeExpr<DatetruncExpr>(
1987  type_info, contains_agg, field_, from_expr_->rewrite_with_child_targetlist(tlist));
1988 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
DatetruncField field_
Definition: Analyzer.h:1347
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
bool contains_agg
Definition: Analyzer.h:177

◆ rewrite_with_targetlist()

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

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

1942  {
1943  return makeExpr<DatetruncExpr>(
1944  type_info, contains_agg, field_, from_expr_->rewrite_with_targetlist(tlist));
1945 }
SQLTypeInfo type_info
Definition: Analyzer.h:176
DatetruncField field_
Definition: Analyzer.h:1347
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
bool contains_agg
Definition: Analyzer.h:177

◆ toString()

std::string Analyzer::DatetruncExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2709 of file Analyzer.cpp.

References to_string().

2709  {
2710  return "DATE_TRUNC(" + std::to_string(field_) + " , " + from_expr_->toString() + ") ";
2711 }
std::string to_string(char const *&&v)
DatetruncField field_
Definition: Analyzer.h:1347
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1348
+ Here is the call graph for this function:

Member Data Documentation

◆ field_

DatetruncField Analyzer::DatetruncExpr::field_
private

Definition at line 1347 of file Analyzer.h.

◆ from_expr_

std::shared_ptr<Analyzer::Expr> Analyzer::DatetruncExpr::from_expr_
private

Definition at line 1348 of file Analyzer.h.


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