OmniSciDB  8a228a1076
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 ()
 
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 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 1428 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 1430 of file Analyzer.h.

References operator==().

1436  : Expr(ti)
1437  , kind_(kind)
1438  , args_(args)
1439  , partition_keys_(partition_keys)
1440  , order_keys_(order_keys)
1441  , collation_(collation){};
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1466
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1465
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1464
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1467
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1463
+ 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 202 of file Analyzer.cpp.

References Analyzer::Expr::type_info.

202  {
203  return makeExpr<WindowFunction>(
205 }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1466
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1465
SQLTypeInfo type_info
Definition: Analyzer.h:177
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1464
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1467
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1463

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

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

1460 { return collation_; }
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1467
+ 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 1456 of file Analyzer.h.

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

1456  {
1457  return order_keys_;
1458  }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1466
+ 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 1452 of file Analyzer.h.

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

1452  {
1453  return partition_keys_;
1454  }
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1465
+ Here is the caller graph for this function:

◆ operator==()

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

Implements Analyzer::Expr.

Definition at line 2340 of file Analyzer.cpp.

References expr_list_match().

2340  {
2341  const auto rhs_window = dynamic_cast<const WindowFunction*>(&rhs);
2342  if (!rhs_window) {
2343  return false;
2344  }
2345  if (kind_ != rhs_window->kind_ || args_.size() != rhs_window->args_.size() ||
2346  partition_keys_.size() != rhs_window->partition_keys_.size() ||
2347  order_keys_.size() != rhs_window->order_keys_.size()) {
2348  return false;
2349  }
2350  return expr_list_match(args_, rhs_window->args_) &&
2351  expr_list_match(partition_keys_, rhs_window->partition_keys_) &&
2352  expr_list_match(order_keys_, rhs_window->order_keys_);
2353 }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1466
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1465
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1464
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:3228
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:1430
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1463
+ Here is the call graph for this function:

◆ toString()

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

Implements Analyzer::Expr.

Definition at line 2717 of file Analyzer.cpp.

References Analyzer::InIntegerSet::arg, run_benchmark_import::result, and sql_window_function_to_str().

2717  {
2718  std::string result = "WindowFunction(" + sql_window_function_to_str(kind_);
2719  for (const auto& arg : args_) {
2720  result += " " + arg->toString();
2721  }
2722  return result + ") ";
2723 }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1464
std::string sql_window_function_to_str(const SqlWindowFunctionKind kind)
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1463
+ 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 1464 of file Analyzer.h.

◆ collation_

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

Definition at line 1467 of file Analyzer.h.

◆ kind_

const SqlWindowFunctionKind Analyzer::WindowFunction::kind_
private

Definition at line 1463 of file Analyzer.h.

◆ order_keys_

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

Definition at line 1466 of file Analyzer.h.

◆ partition_keys_

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

Definition at line 1465 of file Analyzer.h.


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