OmniSciDB  72180abbfe
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::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 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::Expr
rewrite_with_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
 
virtual std::shared_ptr
< Analyzer::Expr
rewrite_with_child_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
 
virtual std::shared_ptr
< Analyzer::Expr
rewrite_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 1383 of file Analyzer.h.

Constructor & Destructor Documentation

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

1391  : Expr(ti)
1392  , kind_(kind)
1393  , args_(args)
1394  , partition_keys_(partition_keys)
1395  , order_keys_(order_keys)
1396  , collation_(collation){};
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:70
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1421
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1420
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1419
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1422
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1418

Member Function Documentation

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

Implements Analyzer::Expr.

Definition at line 198 of file Analyzer.cpp.

References args_, collation_, kind_, order_keys_, partition_keys_, and Analyzer::Expr::type_info.

198  {
199  return makeExpr<WindowFunction>(
201 }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1421
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1420
SQLTypeInfo type_info
Definition: Analyzer.h:177
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1419
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1422
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1418
const std::vector<std::shared_ptr<Analyzer::Expr> >& Analyzer::WindowFunction::getArgs ( ) const
inline
const std::vector<OrderEntry>& Analyzer::WindowFunction::getCollation ( ) const
inline

Definition at line 1415 of file Analyzer.h.

References collation_.

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

1415 { return collation_; }
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1422

+ Here is the caller graph for this function:

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

Definition at line 1411 of file Analyzer.h.

References order_keys_.

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

1411  {
1412  return order_keys_;
1413  }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1421

+ Here is the caller graph for this function:

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

Definition at line 1407 of file Analyzer.h.

References partition_keys_.

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

1407  {
1408  return partition_keys_;
1409  }
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1420

+ Here is the caller graph for this function:

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

Implements Analyzer::Expr.

Definition at line 2311 of file Analyzer.cpp.

References args_, expr_list_match(), kind_, order_keys_, and partition_keys_.

2311  {
2312  const auto rhs_window = dynamic_cast<const WindowFunction*>(&rhs);
2313  if (!rhs_window) {
2314  return false;
2315  }
2316  if (kind_ != rhs_window->kind_ || args_.size() != rhs_window->args_.size() ||
2317  partition_keys_.size() != rhs_window->partition_keys_.size() ||
2318  order_keys_.size() != rhs_window->order_keys_.size()) {
2319  return false;
2320  }
2321  return expr_list_match(args_, rhs_window->args_) &&
2322  expr_list_match(partition_keys_, rhs_window->partition_keys_) &&
2323  expr_list_match(order_keys_, rhs_window->order_keys_);
2324 }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1421
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1420
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1419
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:3183
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:1385
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1418

+ Here is the call graph for this function:

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

Implements Analyzer::Expr.

Definition at line 2681 of file Analyzer.cpp.

References args_, kind_, run_benchmark_import::result, and sql_window_function_to_str().

2681  {
2682  std::string result = "WindowFunction(" + sql_window_function_to_str(kind_);
2683  for (const auto& arg : args_) {
2684  result += " " + arg->toString();
2685  }
2686  return result + ") ";
2687 }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1419
std::string sql_window_function_to_str(const SqlWindowFunctionKind kind)
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1418

+ Here is the call graph for this function:

Member Data Documentation

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

Definition at line 1419 of file Analyzer.h.

Referenced by deep_copy(), getArgs(), operator==(), and toString().

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

Definition at line 1422 of file Analyzer.h.

Referenced by deep_copy(), and getCollation().

const SqlWindowFunctionKind Analyzer::WindowFunction::kind_
private

Definition at line 1418 of file Analyzer.h.

Referenced by deep_copy(), getKind(), operator==(), and toString().

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

Definition at line 1421 of file Analyzer.h.

Referenced by deep_copy(), getOrderKeys(), and operator==().

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

Definition at line 1420 of file Analyzer.h.

Referenced by deep_copy(), getPartitionKeys(), and operator==().


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