OmniSciDB  04ee39c94c
Analyzer::WindowFunction Class Reference

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::WindowFunction:
+ Collaboration diagram for Analyzer::WindowFunction:

Public Member Functions

 WindowFunction (const SQLTypeInfo &ti, const SqlWindowFunctionKind kind, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const std::vector< std::shared_ptr< Analyzer::Expr >> &partition_keys, const std::vector< std::shared_ptr< Analyzer::Expr >> &order_keys, const std::vector< OrderEntry > &collation)
 
std::shared_ptr< Analyzer::Exprdeep_copy () const override
 
bool operator== (const Expr &rhs) const override
 
std::string toString () const override
 
SqlWindowFunctionKind getKind () const
 
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs () const
 
const std::vector< std::shared_ptr< Analyzer::Expr > > & getPartitionKeys () const
 
const std::vector< std::shared_ptr< Analyzer::Expr > > & getOrderKeys () const
 
const std::vector< OrderEntry > & getCollation () const
 
- 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 group_predicates (std::list< const Expr *> &scan_predicates, std::list< const Expr *> &join_predicates, std::list< const Expr *> &const_predicates) const
 
virtual void collect_rte_idx (std::set< int > &rte_idx_set) const
 
virtual void collect_column_var (std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const
 
virtual std::shared_ptr< Analyzer::Exprrewrite_with_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
 
virtual std::shared_ptr< Analyzer::Exprrewrite_with_child_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
 
virtual std::shared_ptr< Analyzer::Exprrewrite_agg_to_var (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
 
virtual void print () const
 
virtual void add_unique (std::list< const Expr *> &expr_list) const
 
virtual void find_expr (bool(*f)(const Expr *), std::list< const Expr *> &expr_list) const
 
std::shared_ptr< Analyzer::Exprdecompress ()
 
virtual void get_domain (DomainSet &domain_set) const
 

Private Attributes

const SqlWindowFunctionKind kind_
 
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
 
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
 
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
 
const std::vector< OrderEntrycollation_
 

Additional Inherited Members

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

Detailed Description

Definition at line 1319 of file Analyzer.h.

Constructor & Destructor Documentation

◆ WindowFunction()

Analyzer::WindowFunction::WindowFunction ( const SQLTypeInfo ti,
const SqlWindowFunctionKind  kind,
const std::vector< std::shared_ptr< Analyzer::Expr >> &  args,
const std::vector< std::shared_ptr< Analyzer::Expr >> &  partition_keys,
const std::vector< std::shared_ptr< Analyzer::Expr >> &  order_keys,
const std::vector< OrderEntry > &  collation 
)
inline

Definition at line 1321 of file Analyzer.h.

References operator==().

1327  : Expr(ti)
1328  , kind_(kind)
1329  , args_(args)
1330  , partition_keys_(partition_keys)
1331  , order_keys_(order_keys)
1332  , collation_(collation){};
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1357
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1356
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1355
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1358
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1354
+ Here is the call graph for this function:

Member Function Documentation

◆ deep_copy()

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

Implements Analyzer::Expr.

Definition at line 194 of file Analyzer.cpp.

References Analyzer::Expr::type_info.

194  {
195  return makeExpr<WindowFunction>(
197 }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1357
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1356
SQLTypeInfo type_info
Definition: Analyzer.h:175
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1355
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1358
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1354

◆ getArgs()

const std::vector<std::shared_ptr<Analyzer::Expr> >& Analyzer::WindowFunction::getArgs ( ) const
inline

◆ getCollation()

const std::vector<OrderEntry>& Analyzer::WindowFunction::getCollation ( ) const
inline

Definition at line 1351 of file Analyzer.h.

Referenced by WindowFunctionContext::compute(), and DeepCopyVisitor::visitWindowFunction().

1351 { return collation_; }
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1358
+ Here is the caller graph for this function:

◆ getKind()

◆ getOrderKeys()

const std::vector<std::shared_ptr<Analyzer::Expr> >& Analyzer::WindowFunction::getOrderKeys ( ) const
inline

Definition at line 1347 of file Analyzer.h.

Referenced by WindowFunctionContext::compute(), RelAlgExecutor::createWindowFunctionContext(), DeepCopyVisitor::visitWindowFunction(), ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visitWindowFunction(), and window_function_requires_peer_handling().

1347  {
1348  return order_keys_;
1349  }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1357
+ Here is the caller graph for this function:

◆ getPartitionKeys()

const std::vector<std::shared_ptr<Analyzer::Expr> >& Analyzer::WindowFunction::getPartitionKeys ( ) const
inline

Definition at line 1343 of file Analyzer.h.

Referenced by RelAlgExecutor::computeWindow(), DeepCopyVisitor::visitWindowFunction(), and ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visitWindowFunction().

1343  {
1344  return partition_keys_;
1345  }
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1356
+ Here is the caller graph for this function:

◆ operator==()

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

Implements Analyzer::Expr.

Definition at line 2210 of file Analyzer.cpp.

References expr_list_match().

2210  {
2211  const auto rhs_window = dynamic_cast<const WindowFunction*>(&rhs);
2212  if (!rhs_window) {
2213  return false;
2214  }
2215  if (kind_ != rhs_window->kind_ || args_.size() != rhs_window->args_.size() ||
2216  partition_keys_.size() != rhs_window->partition_keys_.size() ||
2217  order_keys_.size() != rhs_window->order_keys_.size()) {
2218  return false;
2219  }
2220  return expr_list_match(args_, rhs_window->args_) &&
2221  expr_list_match(partition_keys_, rhs_window->partition_keys_) &&
2222  expr_list_match(order_keys_, rhs_window->order_keys_);
2223 }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1357
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1356
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1355
bool expr_list_match(const std::vector< std::shared_ptr< Analyzer::Expr >> &lhs, const std::vector< std::shared_ptr< Analyzer::Expr >> &rhs)
Definition: Analyzer.cpp:2980
WindowFunction(const SQLTypeInfo &ti, const SqlWindowFunctionKind kind, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const std::vector< std::shared_ptr< Analyzer::Expr >> &partition_keys, const std::vector< std::shared_ptr< Analyzer::Expr >> &order_keys, const std::vector< OrderEntry > &collation)
Definition: Analyzer.h:1321
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1354
+ Here is the call graph for this function:

◆ toString()

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

Implements Analyzer::Expr.

Definition at line 2540 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg, run-benchmark-import::result, and sql_window_function_to_str().

2540  {
2541  std::string result = "WindowFunction(" + sql_window_function_to_str(kind_);
2542  for (const auto& arg : args_) {
2543  result += " " + arg->toString();
2544  }
2545  return result + ") ";
2546 }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1355
std::string sql_window_function_to_str(const SqlWindowFunctionKind kind)
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1354
+ Here is the call graph for this function:

Member Data Documentation

◆ args_

const std::vector<std::shared_ptr<Analyzer::Expr> > Analyzer::WindowFunction::args_
private

Definition at line 1355 of file Analyzer.h.

◆ collation_

const std::vector<OrderEntry> Analyzer::WindowFunction::collation_
private

Definition at line 1358 of file Analyzer.h.

◆ kind_

const SqlWindowFunctionKind Analyzer::WindowFunction::kind_
private

Definition at line 1354 of file Analyzer.h.

◆ order_keys_

const std::vector<std::shared_ptr<Analyzer::Expr> > Analyzer::WindowFunction::order_keys_
private

Definition at line 1357 of file Analyzer.h.

◆ partition_keys_

const std::vector<std::shared_ptr<Analyzer::Expr> > Analyzer::WindowFunction::partition_keys_
private

Definition at line 1356 of file Analyzer.h.


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