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

#include <RelAlgDag.h>

+ Inheritance diagram for RexOperator:
+ Collaboration diagram for RexOperator:

Public Member Functions

 RexOperator ()
 
 RexOperator (const SQLOps op, std::vector< std::unique_ptr< const RexScalar >> &operands, const SQLTypeInfo &type)
 
virtual void acceptChildren (Visitor &v) const override
 
virtual void accept (Visitor &v, std::string name) const override
 
virtual std::unique_ptr< const
RexOperator
getDisambiguated (std::vector< std::unique_ptr< const RexScalar >> &operands) const
 
size_t size () const
 
const RexScalargetOperand (const size_t idx) const
 
const RexScalargetOperandAndRelease (const size_t idx) const
 
SQLOps getOperator () const
 
const SQLTypeInfogetType () const
 
std::string toString (RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
 
virtual size_t toHash () const override
 
- Public Member Functions inherited from Rex
virtual ~Rex ()
 
virtual size_t getStepNumber () const
 
- Public Member Functions inherited from RelAlgDagNode
 RelAlgDagNode ()
 
virtual void setStepNumber (size_t step) const
 
std::optional< size_t > getIdInPlanTree () const
 
void setIdInPlanTree (size_t id) const
 

Protected Attributes

SQLOps op_
 
std::vector< std::unique_ptr
< const RexScalar > > 
operands_
 
SQLTypeInfo type_
 
- Protected Attributes inherited from Rex
std::optional< size_t > hash_
 
- Protected Attributes inherited from RelAlgDagNode
size_t step_ {0}
 
std::optional< size_t > id_in_plan_tree_
 

Friends

struct RelAlgDagSerializer
 
std::size_t hash_value (RexOperator const &)
 

Detailed Description

Definition at line 336 of file RelAlgDag.h.

Constructor & Destructor Documentation

RexOperator::RexOperator ( )
inline

Definition at line 339 of file RelAlgDag.h.

References kINVALID_OP.

Referenced by getDisambiguated().

+ Here is the caller graph for this function:

RexOperator::RexOperator ( const SQLOps  op,
std::vector< std::unique_ptr< const RexScalar >> &  operands,
const SQLTypeInfo type 
)
inline

Definition at line 341 of file RelAlgDag.h.

344  : op_(op), operands_(std::move(operands)), type_(type) {}
SQLTypeInfo type_
Definition: RelAlgDag.h:401
std::vector< std::unique_ptr< const RexScalar > > operands_
Definition: RelAlgDag.h:400
SQLOps op_
Definition: RelAlgDag.h:399

Member Function Documentation

virtual void RexOperator::accept ( Visitor v,
std::string  name 
) const
inlineoverridevirtual

Implements RelAlgDagNode.

Reimplemented in RexWindowFunctionOperator, and RexFunctionOperator.

Definition at line 353 of file RelAlgDag.h.

References acceptChildren(), and RelAlgDagNode::Visitor::visit().

Referenced by TableFunctionsFactory_node.PrintNode::__str__().

353  {
354  if (v.visit(this, std::move(name))) {
355  acceptChildren(v);
356  }
357  }
virtual void acceptChildren(Visitor &v) const override
Definition: RelAlgDag.h:346
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void RexOperator::acceptChildren ( Visitor v) const
inlineoverridevirtual

Implements RelAlgDagNode.

Reimplemented in RexWindowFunctionOperator, and RexFunctionOperator.

Definition at line 346 of file RelAlgDag.h.

References RelAlgDagNode::accept(), getOperand(), and size().

Referenced by accept().

346  {
347  for (size_t i = 0; i < size(); ++i) {
348  if (getOperand(i)) {
349  getOperand(i)->accept(v, "operand");
350  }
351  }
352  }
size_t size() const
Definition: RelAlgDag.h:364
const RexScalar * getOperand(const size_t idx) const
Definition: RelAlgDag.h:366
virtual void accept(Visitor &v, std::string name) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual std::unique_ptr<const RexOperator> RexOperator::getDisambiguated ( std::vector< std::unique_ptr< const RexScalar >> &  operands) const
inlinevirtual

Reimplemented in RexFunctionOperator.

Definition at line 359 of file RelAlgDag.h.

References op_, RexOperator(), and type_.

Referenced by RexDeepCopyVisitor::visitOperator().

360  {
361  return std::unique_ptr<const RexOperator>(new RexOperator(op_, operands, type_));
362  }
SQLTypeInfo type_
Definition: RelAlgDag.h:401
SQLOps op_
Definition: RelAlgDag.h:399

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const RexScalar* RexOperator::getOperand ( const size_t  idx) const
inline

Definition at line 366 of file RelAlgDag.h.

References CHECK, and operands_.

Referenced by acceptChildren(), RexFunctionOperator::acceptChildren(), anonymous_namespace{RelAlgDag.cpp}::anonymous_namespace{RelAlgDag.cpp}::find_generic_expr_in_window_func(), anonymous_namespace{RelAlgDag.cpp}::anonymous_namespace{RelAlgDag.cpp}::is_window_function_avg(), anonymous_namespace{RelAlgDag.cpp}::PushDownGenericExpressionInWindowFunction::pushDownExpressionInWindowFunction(), RelAlgTranslator::translateAbs(), RelAlgTranslator::translateBinaryGeoConstructor(), RelAlgTranslator::translateBinaryGeoFunction(), RelAlgTranslator::translateBinaryGeoPredicate(), RelAlgTranslator::translateBoundingBoxIntersectOper(), RelAlgTranslator::translateCardinality(), RelAlgTranslator::translateDateadd(), RelAlgTranslator::translateDatediff(), RelAlgTranslator::translateDatepart(), RelAlgTranslator::translateDatePlusMinus(), RelAlgTranslator::translateDatetime(), RelAlgTranslator::translateExtract(), RelAlgTranslator::translateFunction(), RelAlgTranslator::translateFunctionArgs(), RelAlgTranslator::translateFunctionWithGeoArg(), RelAlgTranslator::translateGeoBoundingBoxIntersectOper(), RelAlgTranslator::translateGeoComparison(), RelAlgTranslator::translateGeoProjection(), RelAlgTranslator::translateHPTLiteral(), RelAlgTranslator::translateInOper(), RelAlgTranslator::translateItem(), RelAlgTranslator::translateLength(), RelAlgTranslator::translateLike(), RelAlgTranslator::translateLikely(), RelAlgTranslator::translateMLPredict(), RelAlgTranslator::translateOper(), RelAlgTranslator::translatePCAProject(), RelAlgTranslator::translateRegexp(), RelAlgTranslator::translateSampleRatio(), RelAlgTranslator::translateSign(), RelAlgTranslator::translateTernaryGeoFunction(), RelAlgTranslator::translateUnaryGeoConstructor(), RelAlgTranslator::translateUnaryGeoFunction(), RelAlgTranslator::translateUnaryGeoPredicate(), RelAlgTranslator::translateUnlikely(), RelAlgTranslator::translateUoper(), RelAlgTranslator::translateWidthBucket(), RelAlgTranslator::translateWindowFunction(), RelRexDagVisitor::visit(), QueryPlanDagChecker::visit(), anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitOperator(), RexVisitor< T >::visitOperator(), RexDeepCopyVisitor::visitOperator(), anonymous_namespace{RelAlgDag.cpp}::PushDownGenericExpressionInWindowFunction::visitOperator(), and RexDeepCopyVisitor::visitWindowFunctionOperator().

366  {
367  CHECK(idx < operands_.size());
368  return operands_[idx].get();
369  }
std::vector< std::unique_ptr< const RexScalar > > operands_
Definition: RelAlgDag.h:400
#define CHECK(condition)
Definition: Logger.h:291
const RexScalar* RexOperator::getOperandAndRelease ( const size_t  idx) const
inline

Definition at line 371 of file RelAlgDag.h.

References CHECK, and operands_.

371  {
372  CHECK(idx < operands_.size());
373  return operands_[idx].release();
374  }
std::vector< std::unique_ptr< const RexScalar > > operands_
Definition: RelAlgDag.h:400
#define CHECK(condition)
Definition: Logger.h:291
size_t RexOperator::size ( ) const
inline

Definition at line 364 of file RelAlgDag.h.

References operands_.

Referenced by acceptChildren(), RexFunctionOperator::acceptChildren(), anonymous_namespace{RelAlgDag.cpp}::anonymous_namespace{RelAlgDag.cpp}::find_generic_expr_in_window_func(), anonymous_namespace{RelAlgDag.cpp}::anonymous_namespace{RelAlgDag.cpp}::is_window_function_avg(), anonymous_namespace{RelAlgDag.cpp}::PushDownGenericExpressionInWindowFunction::pushDownExpressionInWindowFunction(), RelAlgTranslator::translateAbs(), RelAlgTranslator::translateBinaryGeoFunction(), RelAlgTranslator::translateDateadd(), RelAlgTranslator::translateDatediff(), RelAlgTranslator::translateDatepart(), RelAlgTranslator::translateDatePlusMinus(), RelAlgTranslator::translateDatetime(), RelAlgTranslator::translateExtract(), RelAlgTranslator::translateFunction(), RelAlgTranslator::translateFunctionArgs(), RelAlgTranslator::translateFunctionWithGeoArg(), RelAlgTranslator::translateGeoBoundingBoxIntersectOper(), RelAlgTranslator::translateGeoComparison(), RelAlgTranslator::translateHPTLiteral(), RelAlgTranslator::translateInOper(), RelAlgTranslator::translateItem(), RelAlgTranslator::translateLength(), RelAlgTranslator::translateLike(), RelAlgTranslator::translateLikely(), RelAlgTranslator::translateMLPredict(), RelAlgTranslator::translateOper(), RelAlgTranslator::translatePCAProject(), RelAlgTranslator::translateRegexp(), RelAlgTranslator::translateSampleRatio(), RelAlgTranslator::translateSign(), RelAlgTranslator::translateTernaryGeoFunction(), RelAlgTranslator::translateUnaryGeoFunction(), RelAlgTranslator::translateUnlikely(), RelAlgTranslator::translateUoper(), RelAlgTranslator::translateWidthBucket(), RelAlgTranslator::translateWindowFunction(), RelRexDagVisitor::visit(), QueryPlanDagChecker::visit(), anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitOperator(), RexVisitor< T >::visitOperator(), RexDeepCopyVisitor::visitOperator(), anonymous_namespace{RelAlgDag.cpp}::PushDownGenericExpressionInWindowFunction::visitOperator(), and RexDeepCopyVisitor::visitWindowFunctionOperator().

364 { return operands_.size(); }
std::vector< std::unique_ptr< const RexScalar > > operands_
Definition: RelAlgDag.h:400

+ Here is the caller graph for this function:

virtual size_t RexOperator::toHash ( ) const
inlineoverridevirtual

Implements Rex.

Reimplemented in RexWindowFunctionOperator, and RexFunctionOperator.

Definition at line 394 of file RelAlgDag.h.

References hash_value.

394 { return hash_value(*this); }
friend std::size_t hash_value(RexOperator const &)
Definition: RelAlgDag.cpp:3581
std::string RexOperator::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
inlineoverridevirtual

Implements RelAlgDagNode.

Reimplemented in RexWindowFunctionOperator, and RexFunctionOperator.

Definition at line 380 of file RelAlgDag.h.

References cat(), SQLTypeInfo::get_type(), op_, operands_, to_string(), SQLTypeInfo::to_string(), type_, and typeName().

381  {
382  if (!config.attributes_only) {
383  auto ret = cat(::typeName(this), "(", std::to_string(op_), ", operands=");
384  for (auto& operand : operands_) {
385  ret += operand->toString(config) + " ";
386  }
387  return cat(ret, ", type=", type_.to_string(), ")");
388  } else {
389  return cat(
390  ::typeName(this), "(", ::toString(op_), ", type=", type_.get_type(), ")");
391  }
392  };
std::string cat(Ts &&...args)
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
std::string to_string(char const *&&v)
std::string to_string() const
Definition: sqltypes.h:528
SQLTypeInfo type_
Definition: RelAlgDag.h:401
std::vector< std::unique_ptr< const RexScalar > > operands_
Definition: RelAlgDag.h:400
std::string typeName(const T *v)
Definition: toString.h:106
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:380
SQLOps op_
Definition: RelAlgDag.h:399

+ Here is the call graph for this function:

Friends And Related Function Documentation

std::size_t hash_value ( RexOperator const &  rex_op)
friend

Definition at line 3581 of file RelAlgDag.cpp.

Referenced by toHash().

3581  {
3582  if (rex_op.hash_) {
3583  return *rex_op.hash_;
3584  }
3585  rex_op.hash_ = typeid(RexOperator).hash_code();
3586  boost::hash_combine(*rex_op.hash_, rex_op.op_);
3587  boost::hash_combine(*rex_op.hash_, rex_op.operands_);
3588  boost::hash_combine(*rex_op.hash_, rex_op.getType().get_type_name());
3589  return *rex_op.hash_;
3590 }
friend struct RelAlgDagSerializer
friend

Definition at line 403 of file RelAlgDag.h.

Member Data Documentation

SQLOps RexOperator::op_
protected

Definition at line 399 of file RelAlgDag.h.

Referenced by getDisambiguated(), getOperator(), hash_value(), and toString().

std::vector<std::unique_ptr<const RexScalar> > RexOperator::operands_
mutableprotected
SQLTypeInfo RexOperator::type_
protected

Definition at line 401 of file RelAlgDag.h.

Referenced by getDisambiguated(), getType(), and toString().


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