OmniSciDB  1dac507f6e
 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 1376 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 1378 of file Analyzer.h.

1384  : Expr(ti)
1385  , kind_(kind)
1386  , args_(args)
1387  , partition_keys_(partition_keys)
1388  , order_keys_(order_keys)
1389  , collation_(collation){};
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1414
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1413
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1412
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1415
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1411

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:1414
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1413
SQLTypeInfo type_info
Definition: Analyzer.h:176
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1412
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1415
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1411
const std::vector<std::shared_ptr<Analyzer::Expr> >& Analyzer::WindowFunction::getArgs ( ) const
inline

Definition at line 1398 of file Analyzer.h.

References args_.

Referenced by WindowFunctionContext::computePartition(), anonymous_namespace{WindowFunctionIR.cpp}::get_adjusted_window_type_info(), anonymous_namespace{WindowContext.cpp}::get_lag_or_lead_argument(), DeepCopyVisitor::visitWindowFunction(), ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visitWindowFunction(), and anonymous_namespace{WindowExpressionRewrite.cpp}::window_sum_and_count_match().

1398 { return args_; }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1412

+ Here is the caller graph for this function:

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

Definition at line 1408 of file Analyzer.h.

References collation_.

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

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

+ Here is the caller graph for this function:

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

Definition at line 1404 of file Analyzer.h.

References order_keys_.

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

1404  {
1405  return order_keys_;
1406  }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1414

+ Here is the caller graph for this function:

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

Definition at line 1400 of file Analyzer.h.

References partition_keys_.

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

1400  {
1401  return partition_keys_;
1402  }
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1413

+ Here is the caller graph for this function:

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

Implements Analyzer::Expr.

Definition at line 2240 of file Analyzer.cpp.

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

2240  {
2241  const auto rhs_window = dynamic_cast<const WindowFunction*>(&rhs);
2242  if (!rhs_window) {
2243  return false;
2244  }
2245  if (kind_ != rhs_window->kind_ || args_.size() != rhs_window->args_.size() ||
2246  partition_keys_.size() != rhs_window->partition_keys_.size() ||
2247  order_keys_.size() != rhs_window->order_keys_.size()) {
2248  return false;
2249  }
2250  return expr_list_match(args_, rhs_window->args_) &&
2251  expr_list_match(partition_keys_, rhs_window->partition_keys_) &&
2252  expr_list_match(order_keys_, rhs_window->order_keys_);
2253 }
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1414
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1413
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1412
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:3043
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:1378
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1411

+ Here is the call graph for this function:

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

Implements Analyzer::Expr.

Definition at line 2585 of file Analyzer.cpp.

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

2585  {
2586  std::string result = "WindowFunction(" + sql_window_function_to_str(kind_);
2587  for (const auto& arg : args_) {
2588  result += " " + arg->toString();
2589  }
2590  return result + ") ";
2591 }
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1412
std::string sql_window_function_to_str(const SqlWindowFunctionKind kind)
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1411

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

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

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

Definition at line 1415 of file Analyzer.h.

Referenced by deep_copy(), and getCollation().

const SqlWindowFunctionKind Analyzer::WindowFunction::kind_
private

Definition at line 1411 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 1414 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 1413 of file Analyzer.h.

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


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