OmniSciDB  c07336695a
Analyzer::CardinalityExpr Class Reference

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::CardinalityExpr:
+ Collaboration diagram for Analyzer::CardinalityExpr:

Public Member Functions

 CardinalityExpr (std::shared_ptr< Analyzer::Expr > a)
 
const Exprget_arg () const
 
const std::shared_ptr< Analyzer::Exprget_own_arg () 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 (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 ()
 
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 void check_group_by (const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const
 
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

std::shared_ptr< Analyzer::Exprarg
 

Additional Inherited Members

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

Detailed Description

Definition at line 739 of file Analyzer.h.

Constructor & Destructor Documentation

◆ CardinalityExpr()

Analyzer::CardinalityExpr::CardinalityExpr ( std::shared_ptr< Analyzer::Expr a)
inline

Definition at line 741 of file Analyzer.h.

742  : Expr(kINT, a->get_type_info().get_notnull()), arg(a) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776
Definition: sqltypes.h:47

Member Function Documentation

◆ collect_column_var()

void Analyzer::CardinalityExpr::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 752 of file Analyzer.h.

755  {
756  arg->collect_column_var(colvar_set, include_agg);
757  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776

◆ collect_rte_idx()

void Analyzer::CardinalityExpr::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 749 of file Analyzer.h.

749  {
750  arg->collect_rte_idx(rte_idx_set);
751  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776

◆ deep_copy()

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

Implements Analyzer::Expr.

Definition at line 130 of file Analyzer.cpp.

130  {
131  return makeExpr<CardinalityExpr>(arg->deep_copy());
132 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776

◆ find_expr()

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

Reimplemented from Analyzer::Expr.

Definition at line 2642 of file Analyzer.cpp.

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

2643  {
2644  if (f(this)) {
2645  add_unique(expr_list);
2646  return;
2647  }
2648  arg->find_expr(f, expr_list);
2649 }
virtual void add_unique(std::list< const Expr *> &expr_list) const
Definition: Analyzer.cpp:2585
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776
+ Here is the call graph for this function:

◆ get_arg()

const Expr* Analyzer::CardinalityExpr::get_arg ( ) const
inline

Definition at line 743 of file Analyzer.h.

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

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

◆ get_own_arg()

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

Definition at line 744 of file Analyzer.h.

744 { return arg; }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776

◆ group_predicates()

void Analyzer::CardinalityExpr::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 1499 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg.

1501  {
1502  std::set<int> rte_idx_set;
1503  arg->collect_rte_idx(rte_idx_set);
1504  if (rte_idx_set.size() > 1) {
1505  join_predicates.push_back(this);
1506  } else if (rte_idx_set.size() == 1) {
1507  scan_predicates.push_back(this);
1508  } else {
1509  const_predicates.push_back(this);
1510  }
1511 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776

◆ operator==()

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

Implements Analyzer::Expr.

Definition at line 2049 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg, and get_arg().

2049  {
2050  if (typeid(rhs) != typeid(CardinalityExpr)) {
2051  return false;
2052  }
2053  const CardinalityExpr& rhs_ca = dynamic_cast<const CardinalityExpr&>(rhs);
2054  if (!(*arg == *rhs_ca.get_arg())) {
2055  return false;
2056  }
2057  return true;
2058 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776
CardinalityExpr(std::shared_ptr< Analyzer::Expr > a)
Definition: Analyzer.h:741
+ Here is the call graph for this function:

◆ rewrite_agg_to_var()

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

Reimplemented from Analyzer::Expr.

Definition at line 766 of file Analyzer.h.

References operator==().

767  {
768  return makeExpr<CardinalityExpr>(arg->rewrite_agg_to_var(tlist));
769  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776
+ Here is the call graph for this function:

◆ rewrite_with_child_targetlist()

std::shared_ptr<Analyzer::Expr> Analyzer::CardinalityExpr::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 762 of file Analyzer.h.

763  {
764  return makeExpr<CardinalityExpr>(arg->rewrite_with_child_targetlist(tlist));
765  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776

◆ rewrite_with_targetlist()

std::shared_ptr<Analyzer::Expr> Analyzer::CardinalityExpr::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 758 of file Analyzer.h.

759  {
760  return makeExpr<CardinalityExpr>(arg->rewrite_with_targetlist(tlist));
761  }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776

◆ toString()

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

Implements Analyzer::Expr.

Definition at line 2429 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg.

2429  {
2430  std::string str{"CARDINALITY("};
2431  str += arg->toString();
2432  str += ") ";
2433  return str;
2434 }
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:776

Member Data Documentation

◆ arg

std::shared_ptr<Analyzer::Expr> Analyzer::CardinalityExpr::arg
private

Definition at line 776 of file Analyzer.h.


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