OmniSciDB  d2f719934e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RexWindowFunctionOperator Class Reference

#include <RelAlgDagBuilder.h>

+ Inheritance diagram for RexWindowFunctionOperator:
+ Collaboration diagram for RexWindowFunctionOperator:

Classes

struct  RexWindowBound
 

Public Member Functions

 RexWindowFunctionOperator (const SqlWindowFunctionKind kind, ConstRexScalarPtrVector &operands, ConstRexScalarPtrVector &partition_keys, ConstRexScalarPtrVector &order_keys, const std::vector< SortField > collation, const RexWindowBound &lower_bound, const RexWindowBound &upper_bound, const bool is_rows, const SQLTypeInfo &ti)
 
SqlWindowFunctionKind getKind () const
 
const ConstRexScalarPtrVectorgetPartitionKeys () const
 
ConstRexScalarPtrVector getPartitionKeysAndRelease () const
 
ConstRexScalarPtrVector getOrderKeysAndRelease () const
 
const ConstRexScalarPtrVectorgetOrderKeys () const
 
const std::vector< SortField > & getCollation () const
 
const RexWindowBoundgetLowerBound () const
 
const RexWindowBoundgetUpperBound () const
 
bool isRows () const
 
std::unique_ptr< const
RexOperator
disambiguatedOperands (ConstRexScalarPtrVector &operands, ConstRexScalarPtrVector &partition_keys, ConstRexScalarPtrVector &order_keys, const std::vector< SortField > &collation) const
 
std::string toString () const override
 
size_t toHash () const override
 
- Public Member Functions inherited from RexFunctionOperator
 RexFunctionOperator (const std::string &name, ConstRexScalarPtrVector &operands, const SQLTypeInfo &ti)
 
std::unique_ptr< const
RexOperator
getDisambiguated (std::vector< std::unique_ptr< const RexScalar >> &operands) const override
 
const std::string & getName () const
 
- Public Member Functions inherited from RexOperator
 RexOperator (const SQLOps op, std::vector< std::unique_ptr< const RexScalar >> &operands, const SQLTypeInfo &type)
 
size_t size () const
 
const RexScalargetOperand (const size_t idx) const
 
const RexScalargetOperandAndRelease (const size_t idx) const
 
SQLOps getOperator () const
 
const SQLTypeInfogetType () const
 
- Public Member Functions inherited from Rex
virtual ~Rex ()
 

Private Attributes

const SqlWindowFunctionKind kind_
 
ConstRexScalarPtrVector partition_keys_
 
ConstRexScalarPtrVector order_keys_
 
const std::vector< SortFieldcollation_
 
const RexWindowBound lower_bound_
 
const RexWindowBound upper_bound_
 
const bool is_rows_
 

Additional Inherited Members

- Public Types inherited from RexFunctionOperator
using ConstRexScalarPtr = std::unique_ptr< const RexScalar >
 
using ConstRexScalarPtrVector = std::vector< ConstRexScalarPtr >
 
- Protected Attributes inherited from RexOperator
const SQLOps op_
 
std::vector< std::unique_ptr
< const RexScalar > > 
operands_
 
const SQLTypeInfo type_
 
- Protected Attributes inherited from Rex
std::optional< size_t > hash_
 

Detailed Description

Definition at line 514 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

RexWindowFunctionOperator::RexWindowFunctionOperator ( const SqlWindowFunctionKind  kind,
ConstRexScalarPtrVector operands,
ConstRexScalarPtrVector partition_keys,
ConstRexScalarPtrVector order_keys,
const std::vector< SortField collation,
const RexWindowBound lower_bound,
const RexWindowBound upper_bound,
const bool  is_rows,
const SQLTypeInfo ti 
)
inline

Definition at line 525 of file RelAlgDagBuilder.h.

Referenced by disambiguatedOperands(), and toHash().

534  : RexFunctionOperator(::toString(kind), operands, ti)
535  , kind_(kind)
536  , partition_keys_(std::move(partition_keys))
537  , order_keys_(std::move(order_keys))
538  , collation_(collation)
541  , is_rows_(is_rows) {}
DEVICE auto upper_bound(ARGS &&...args)
Definition: gpu_enabled.h:123
const RexWindowBound upper_bound_
const SqlWindowFunctionKind kind_
std::string toString() const override
const std::vector< SortField > collation_
DEVICE auto lower_bound(ARGS &&...args)
Definition: gpu_enabled.h:78
ConstRexScalarPtrVector order_keys_
RexFunctionOperator(const std::string &name, ConstRexScalarPtrVector &operands, const SQLTypeInfo &ti)
ConstRexScalarPtrVector partition_keys_
const RexWindowBound lower_bound_

+ Here is the caller graph for this function:

Member Function Documentation

std::unique_ptr<const RexOperator> RexWindowFunctionOperator::disambiguatedOperands ( ConstRexScalarPtrVector operands,
ConstRexScalarPtrVector partition_keys,
ConstRexScalarPtrVector order_keys,
const std::vector< SortField > &  collation 
) const
inline

Definition at line 565 of file RelAlgDagBuilder.h.

References getLowerBound(), RexOperator::getType(), getUpperBound(), isRows(), kind_, and RexWindowFunctionOperator().

Referenced by RexDeepCopyVisitor::visitWindowFunctionOperator().

569  {
570  return std::unique_ptr<const RexOperator>(
572  operands,
573  partition_keys,
574  order_keys,
575  collation,
576  getLowerBound(),
577  getUpperBound(),
578  isRows(),
579  getType()));
580  }
const SQLTypeInfo & getType() const
const SqlWindowFunctionKind kind_
RexWindowFunctionOperator(const SqlWindowFunctionKind kind, ConstRexScalarPtrVector &operands, ConstRexScalarPtrVector &partition_keys, ConstRexScalarPtrVector &order_keys, const std::vector< SortField > collation, const RexWindowBound &lower_bound, const RexWindowBound &upper_bound, const bool is_rows, const SQLTypeInfo &ti)
const RexWindowBound & getLowerBound() const
const RexWindowBound & getUpperBound() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const std::vector<SortField>& RexWindowFunctionOperator::getCollation ( ) const
inline

Definition at line 557 of file RelAlgDagBuilder.h.

References collation_.

Referenced by RelAlgTranslator::translateWindowFunction(), and RexDeepCopyVisitor::visitWindowFunctionOperator().

557 { return collation_; }
const std::vector< SortField > collation_

+ Here is the caller graph for this function:

SqlWindowFunctionKind RexWindowFunctionOperator::getKind ( ) const
inline

Definition at line 543 of file RelAlgDagBuilder.h.

References kind_.

Referenced by anonymous_namespace{RelAlgTranslator.cpp}::supported_upper_bound(), and RelAlgTranslator::translateWindowFunction().

543 { return kind_; }
const SqlWindowFunctionKind kind_

+ Here is the caller graph for this function:

const RexWindowBound& RexWindowFunctionOperator::getLowerBound ( ) const
inline

Definition at line 559 of file RelAlgDagBuilder.h.

References lower_bound_.

Referenced by disambiguatedOperands(), and RelAlgTranslator::translateWindowFunction().

559 { return lower_bound_; }
const RexWindowBound lower_bound_

+ Here is the caller graph for this function:

const ConstRexScalarPtrVector& RexWindowFunctionOperator::getOrderKeys ( ) const
inline

Definition at line 555 of file RelAlgDagBuilder.h.

References order_keys_.

Referenced by anonymous_namespace{RelAlgTranslator.cpp}::supported_upper_bound(), RelAlgTranslator::translateWindowFunction(), RelRexDagVisitor::visit(), RexVisitor< std::unordered_set< const RexInput * > >::visitWindowFunctionOperator(), and RexDeepCopyVisitor::visitWindowFunctionOperator().

555 { return order_keys_; }
ConstRexScalarPtrVector order_keys_

+ Here is the caller graph for this function:

ConstRexScalarPtrVector RexWindowFunctionOperator::getOrderKeysAndRelease ( ) const
inline

Definition at line 551 of file RelAlgDagBuilder.h.

References order_keys_.

551  {
552  return std::move(order_keys_);
553  }
ConstRexScalarPtrVector order_keys_
const ConstRexScalarPtrVector& RexWindowFunctionOperator::getPartitionKeys ( ) const
inline

Definition at line 545 of file RelAlgDagBuilder.h.

References partition_keys_.

Referenced by anonymous_namespace{RelAlgDagBuilder.cpp}::disambiguate_operator(), RelAlgTranslator::translateWindowFunction(), RelRexDagVisitor::visit(), RexVisitor< std::unordered_set< const RexInput * > >::visitWindowFunctionOperator(), and RexDeepCopyVisitor::visitWindowFunctionOperator().

545 { return partition_keys_; }
ConstRexScalarPtrVector partition_keys_

+ Here is the caller graph for this function:

ConstRexScalarPtrVector RexWindowFunctionOperator::getPartitionKeysAndRelease ( ) const
inline

Definition at line 547 of file RelAlgDagBuilder.h.

References partition_keys_.

547  {
548  return std::move(partition_keys_);
549  }
ConstRexScalarPtrVector partition_keys_
const RexWindowBound& RexWindowFunctionOperator::getUpperBound ( ) const
inline

Definition at line 561 of file RelAlgDagBuilder.h.

References upper_bound_.

Referenced by disambiguatedOperands(), and anonymous_namespace{RelAlgTranslator.cpp}::supported_upper_bound().

561 { return upper_bound_; }
const RexWindowBound upper_bound_

+ Here is the caller graph for this function:

bool RexWindowFunctionOperator::isRows ( ) const
inline

Definition at line 563 of file RelAlgDagBuilder.h.

References is_rows_.

Referenced by disambiguatedOperands(), and RelAlgTranslator::translateWindowFunction().

563 { return is_rows_; }

+ Here is the caller graph for this function:

size_t RexWindowFunctionOperator::toHash ( ) const
inlineoverridevirtual

Reimplemented from RexFunctionOperator.

Definition at line 595 of file RelAlgDagBuilder.h.

References collation_, RexFunctionOperator::getName(), RexOperator::getType(), Rex::hash_, is_rows_, lower_bound_, RexOperator::operands_, order_keys_, partition_keys_, RexWindowFunctionOperator(), and upper_bound_.

595  {
596  if (!hash_) {
597  hash_ = typeid(RexWindowFunctionOperator).hash_code();
598  boost::hash_combine(*hash_, getType().get_type_name());
599  boost::hash_combine(*hash_, getName());
600  boost::hash_combine(*hash_, is_rows_);
601  for (auto& collation : collation_) {
602  boost::hash_combine(*hash_, collation.toHash());
603  }
604  for (auto& operand : operands_) {
605  boost::hash_combine(*hash_, operand->toHash());
606  }
607  for (auto& key : partition_keys_) {
608  boost::hash_combine(*hash_, key->toHash());
609  }
610  for (auto& key : order_keys_) {
611  boost::hash_combine(*hash_, key->toHash());
612  }
613  auto get_window_bound_hash =
615  auto h = boost::hash_value(bound.offset ? bound.offset->toHash()
616  : boost::hash_value("n"));
617  boost::hash_combine(h, bound.unbounded);
618  boost::hash_combine(h, bound.preceding);
619  boost::hash_combine(h, bound.following);
620  boost::hash_combine(h, bound.is_current_row);
621  boost::hash_combine(h, bound.order_key);
622  return h;
623  };
624  boost::hash_combine(*hash_, get_window_bound_hash(lower_bound_));
625  boost::hash_combine(*hash_, get_window_bound_hash(upper_bound_));
626  }
627  return *hash_;
628  }
const SQLTypeInfo & getType() const
const RexWindowBound upper_bound_
std::vector< std::unique_ptr< const RexScalar > > operands_
std::optional< size_t > hash_
RexWindowFunctionOperator(const SqlWindowFunctionKind kind, ConstRexScalarPtrVector &operands, ConstRexScalarPtrVector &partition_keys, ConstRexScalarPtrVector &order_keys, const std::vector< SortField > collation, const RexWindowBound &lower_bound, const RexWindowBound &upper_bound, const bool is_rows, const SQLTypeInfo &ti)
const std::vector< SortField > collation_
ConstRexScalarPtrVector order_keys_
ConstRexScalarPtrVector partition_keys_
const std::string & getName() const
const RexWindowBound lower_bound_

+ Here is the call graph for this function:

std::string RexWindowFunctionOperator::toString ( ) const
inlineoverridevirtual

Reimplemented from RexFunctionOperator.

Definition at line 582 of file RelAlgDagBuilder.h.

References cat(), RexFunctionOperator::getName(), RexOperator::operands_, order_keys_, partition_keys_, and typeName().

582  {
583  return cat(::typeName(this),
584  "(",
585  getName(),
586  ", operands=",
587  ::toString(operands_),
588  ", partition_keys=",
590  ", order_keys=",
592  ")");
593  }
std::string cat(Ts &&...args)
std::string toString() const override
std::vector< std::unique_ptr< const RexScalar > > operands_
ConstRexScalarPtrVector order_keys_
std::string typeName(const T *v)
Definition: toString.h:93
ConstRexScalarPtrVector partition_keys_
const std::string & getName() const

+ Here is the call graph for this function:

Member Data Documentation

const std::vector<SortField> RexWindowFunctionOperator::collation_
private

Definition at line 634 of file RelAlgDagBuilder.h.

Referenced by getCollation(), and toHash().

const bool RexWindowFunctionOperator::is_rows_
private

Definition at line 637 of file RelAlgDagBuilder.h.

Referenced by isRows(), and toHash().

const SqlWindowFunctionKind RexWindowFunctionOperator::kind_
private

Definition at line 631 of file RelAlgDagBuilder.h.

Referenced by disambiguatedOperands(), and getKind().

const RexWindowBound RexWindowFunctionOperator::lower_bound_
private

Definition at line 635 of file RelAlgDagBuilder.h.

Referenced by getLowerBound(), and toHash().

ConstRexScalarPtrVector RexWindowFunctionOperator::order_keys_
mutableprivate

Definition at line 633 of file RelAlgDagBuilder.h.

Referenced by getOrderKeys(), getOrderKeysAndRelease(), toHash(), and toString().

ConstRexScalarPtrVector RexWindowFunctionOperator::partition_keys_
mutableprivate

Definition at line 632 of file RelAlgDagBuilder.h.

Referenced by getPartitionKeys(), getPartitionKeysAndRelease(), toHash(), and toString().

const RexWindowBound RexWindowFunctionOperator::upper_bound_
private

Definition at line 636 of file RelAlgDagBuilder.h.

Referenced by getUpperBound(), and toHash().


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