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

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::ExtractExpr:
+ Collaboration diagram for Analyzer::ExtractExpr:

Public Member Functions

 ExtractExpr (const SQLTypeInfo &ti, bool has_agg, ExtractField f, std::shared_ptr< Analyzer::Expr > e)
 
ExtractField 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

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

Constructor & Destructor Documentation

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

Definition at line 1426 of file Analyzer.h.

1430  : Expr(ti, has_agg), field_(f), from_expr_(e) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
ExtractField field_
Definition: Analyzer.h:1457

Member Function Documentation

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

Reimplemented from Analyzer::Expr.

Definition at line 3603 of file Analyzer.cpp.

References from_expr_.

3604  {
3605  from_expr_->check_group_by(groupby);
3606 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
void ExtractExpr::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 3540 of file Analyzer.cpp.

References from_expr_.

3542  {
3543  from_expr_->collect_column_var(colvar_set, include_agg);
3544 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
void ExtractExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3490 of file Analyzer.cpp.

References from_expr_.

3490  {
3491  from_expr_->collect_rte_idx(rte_idx_set);
3492 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
std::shared_ptr< Analyzer::Expr > ExtractExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 211 of file Analyzer.cpp.

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

211  {
212  return makeExpr<ExtractExpr>(type_info, contains_agg, field_, from_expr_->deep_copy());
213 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
ExtractField field_
Definition: Analyzer.h:1457
bool contains_agg
Definition: Analyzer.h:181
void ExtractExpr::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3431 of file Analyzer.cpp.

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

3432  {
3433  if (f(this)) {
3434  add_unique(expr_list);
3435  return;
3436  }
3437  from_expr_->find_expr(f, expr_list);
3438 }
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:1458
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)

+ Here is the call graph for this function:

ExtractField Analyzer::ExtractExpr::get_field ( ) const
inline

Definition at line 1431 of file Analyzer.h.

References field_.

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

1431 { return field_; }
ExtractField field_
Definition: Analyzer.h:1457

+ Here is the caller graph for this function:

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

Definition at line 1432 of file Analyzer.h.

References from_expr_.

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

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

+ Here is the caller graph for this function:

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

Definition at line 1433 of file Analyzer.h.

References from_expr_.

1433 { return from_expr_; }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
void ExtractExpr::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 1905 of file Analyzer.cpp.

References from_expr_.

1907  {
1908  std::set<int> rte_idx_set;
1909  from_expr_->collect_rte_idx(rte_idx_set);
1910  if (rte_idx_set.size() > 1) {
1911  join_predicates.push_back(this);
1912  } else if (rte_idx_set.size() == 1) {
1913  scan_predicates.push_back(this);
1914  } else {
1915  const_predicates.push_back(this);
1916  }
1917 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
bool ExtractExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2600 of file Analyzer.cpp.

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

2600  {
2601  if (typeid(rhs) != typeid(ExtractExpr)) {
2602  return false;
2603  }
2604  const ExtractExpr& rhs_ee = dynamic_cast<const ExtractExpr&>(rhs);
2605  return field_ == rhs_ee.get_field() && *from_expr_ == *rhs_ee.get_from_expr();
2606 }
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
ExtractField field_
Definition: Analyzer.h:1457

+ Here is the call graph for this function:

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

Reimplemented from Analyzer::Expr.

Definition at line 2234 of file Analyzer.cpp.

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

2235  {
2236  return makeExpr<ExtractExpr>(
2237  type_info, contains_agg, field_, from_expr_->rewrite_agg_to_var(tlist));
2238 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
ExtractField field_
Definition: Analyzer.h:1457
bool contains_agg
Definition: Analyzer.h:181
std::shared_ptr< Analyzer::Expr > ExtractExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2192 of file Analyzer.cpp.

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

2193  {
2194  return makeExpr<ExtractExpr>(
2195  type_info, contains_agg, field_, from_expr_->rewrite_with_child_targetlist(tlist));
2196 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
ExtractField field_
Definition: Analyzer.h:1457
bool contains_agg
Definition: Analyzer.h:181
std::shared_ptr< Analyzer::Expr > ExtractExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 2149 of file Analyzer.cpp.

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

2150  {
2151  return makeExpr<ExtractExpr>(
2152  type_info, contains_agg, field_, from_expr_->rewrite_with_targetlist(tlist));
2153 }
SQLTypeInfo type_info
Definition: Analyzer.h:180
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
ExtractField field_
Definition: Analyzer.h:1457
bool contains_agg
Definition: Analyzer.h:181
std::string ExtractExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 3087 of file Analyzer.cpp.

References field_, from_expr_, and to_string().

3087  {
3088  return "EXTRACT(" + std::to_string(field_) + " FROM " + from_expr_->toString() + ") ";
3089 }
std::string to_string(char const *&&v)
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1458
ExtractField field_
Definition: Analyzer.h:1457

+ Here is the call graph for this function:

Member Data Documentation

ExtractField Analyzer::ExtractExpr::field_
private

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