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

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::CharLengthExpr:
+ Collaboration diagram for Analyzer::CharLengthExpr:

Public Member Functions

 CharLengthExpr (std::shared_ptr< Analyzer::Expr > a, bool e)
 
const Exprget_arg () const
 
const std::shared_ptr
< Analyzer::Expr
get_own_arg () const
 
bool get_calc_encoded_length () const
 
std::shared_ptr< Analyzer::Exprdeep_copy () 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 void check_group_by (const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const
 
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

std::shared_ptr< Analyzer::Exprarg
 
bool calc_encoded_length
 

Additional Inherited Members

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

Detailed Description

Definition at line 864 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::CharLengthExpr::CharLengthExpr ( std::shared_ptr< Analyzer::Expr a,
bool  e 
)
inline

Definition at line 866 of file Analyzer.h.

867  : Expr(kINT, a->get_type_info().get_notnull()), arg(a), calc_encoded_length(e) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
constexpr double a
Definition: Utm.h:32
Definition: sqltypes.h:72

Member Function Documentation

void Analyzer::CharLengthExpr::collect_column_var ( std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &  colvar_set,
bool  include_agg 
) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 878 of file Analyzer.h.

References arg.

881  {
882  arg->collect_column_var(colvar_set, include_agg);
883  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
void Analyzer::CharLengthExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 875 of file Analyzer.h.

References arg.

875  {
876  arg->collect_rte_idx(rte_idx_set);
877  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
std::shared_ptr< Analyzer::Expr > Analyzer::CharLengthExpr::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 153 of file Analyzer.cpp.

References arg, and calc_encoded_length.

153  {
154  return makeExpr<CharLengthExpr>(arg->deep_copy(), calc_encoded_length);
155 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
void Analyzer::CharLengthExpr::find_expr ( std::function< bool(const Expr *)>  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3311 of file Analyzer.cpp.

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

3312  {
3313  if (f(this)) {
3314  add_unique(expr_list);
3315  return;
3316  }
3317  arg->find_expr(f, expr_list);
3318 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3248
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::CharLengthExpr::get_arg ( ) const
inline

Definition at line 868 of file Analyzer.h.

References arg.

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

868 { return arg.get(); }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904

+ Here is the caller graph for this function:

bool Analyzer::CharLengthExpr::get_calc_encoded_length ( ) const
inline

Definition at line 870 of file Analyzer.h.

References calc_encoded_length.

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

870 { return calc_encoded_length; }

+ Here is the caller graph for this function:

const std::shared_ptr<Analyzer::Expr> Analyzer::CharLengthExpr::get_own_arg ( ) const
inline

Definition at line 869 of file Analyzer.h.

References arg.

869 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
void Analyzer::CharLengthExpr::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 1711 of file Analyzer.cpp.

References arg.

1713  {
1714  std::set<int> rte_idx_set;
1715  arg->collect_rte_idx(rte_idx_set);
1716  if (rte_idx_set.size() > 1) {
1717  join_predicates.push_back(this);
1718  } else if (rte_idx_set.size() == 1) {
1719  scan_predicates.push_back(this);
1720  } else {
1721  const_predicates.push_back(this);
1722  }
1723 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
bool Analyzer::CharLengthExpr::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2379 of file Analyzer.cpp.

References arg, calc_encoded_length, get_arg(), and get_calc_encoded_length().

2379  {
2380  if (typeid(rhs) != typeid(CharLengthExpr)) {
2381  return false;
2382  }
2383  const CharLengthExpr& rhs_cl = dynamic_cast<const CharLengthExpr&>(rhs);
2384  if (!(*arg == *rhs_cl.get_arg()) ||
2385  calc_encoded_length != rhs_cl.get_calc_encoded_length()) {
2386  return false;
2387  }
2388  return true;
2389 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
CharLengthExpr(std::shared_ptr< Analyzer::Expr > a, bool e)
Definition: Analyzer.h:866

+ Here is the call graph for this function:

std::shared_ptr<Analyzer::Expr> Analyzer::CharLengthExpr::rewrite_agg_to_var ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 894 of file Analyzer.h.

References arg, and calc_encoded_length.

895  {
896  return makeExpr<CharLengthExpr>(arg->rewrite_agg_to_var(tlist), calc_encoded_length);
897  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
std::shared_ptr<Analyzer::Expr> Analyzer::CharLengthExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 889 of file Analyzer.h.

References arg, and calc_encoded_length.

890  {
891  return makeExpr<CharLengthExpr>(arg->rewrite_with_child_targetlist(tlist),
893  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
std::shared_ptr<Analyzer::Expr> Analyzer::CharLengthExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 884 of file Analyzer.h.

References arg, and calc_encoded_length.

885  {
886  return makeExpr<CharLengthExpr>(arg->rewrite_with_targetlist(tlist),
888  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904
std::string Analyzer::CharLengthExpr::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2945 of file Analyzer.cpp.

References arg, and calc_encoded_length.

2945  {
2946  std::string str;
2947  if (calc_encoded_length) {
2948  str += "CHAR_LENGTH(";
2949  } else {
2950  str += "LENGTH(";
2951  }
2952  str += arg->toString();
2953  str += ") ";
2954  return str;
2955 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:904

Member Data Documentation

bool Analyzer::CharLengthExpr::calc_encoded_length
private

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