OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RelTableFunction Class Reference

#include <RelAlgDagBuilder.h>

+ Inheritance diagram for RelTableFunction:
+ Collaboration diagram for RelTableFunction:

Public Member Functions

 RelTableFunction (const std::string &function_name, RelAlgInputs inputs, std::vector< std::string > &fields, std::vector< const Rex * > col_inputs, std::vector< std::unique_ptr< const RexScalar >> &table_func_inputs, std::vector< std::unique_ptr< const RexScalar >> &target_exprs)
 
 RelTableFunction (RelTableFunction const &)
 
void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input) override
 
std::string getFunctionName () const
 
size_t size () const override
 
size_t getTableFuncInputsSize () const
 
size_t getColInputsSize () const
 
int32_t countRexLiteralArgs () const
 
const RexScalargetTableFuncInputAt (const size_t idx) const
 
const RexScalargetTableFuncInputAtAndRelease (const size_t idx)
 
void setTableFuncInputs (std::vector< std::unique_ptr< const RexScalar >> &exprs)
 
std::string getFieldName (const size_t idx) const
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
std::string toString () const override
 
- Public Member Functions inherited from RelAlgNode
 RelAlgNode (RelAlgInputs inputs={})
 
virtual ~RelAlgNode ()
 
void resetQueryExecutionState ()
 
void setContextData (const void *context_data) const
 
void setOutputMetainfo (const std::vector< TargetMetaInfo > &targets_metainfo) const
 
const std::vector
< TargetMetaInfo > & 
getOutputMetainfo () const
 
unsigned getId () const
 
bool hasContextData () const
 
const void * getContextData () const
 
const size_t inputCount () const
 
const RelAlgNodegetInput (const size_t idx) const
 
std::shared_ptr< const RelAlgNodegetAndOwnInput (const size_t idx) const
 
void addManagedInput (std::shared_ptr< const RelAlgNode > input)
 
bool hasInput (const RelAlgNode *needle) const
 
bool isNop () const
 
void markAsNop ()
 
void clearContextData () const
 

Private Attributes

std::string function_name_
 
std::vector< std::string > fields_
 
std::vector< const Rex * > col_inputs_
 
std::vector< std::unique_ptr
< const RexScalar > > 
table_func_inputs_
 
std::vector< std::unique_ptr
< const RexScalar > > 
target_exprs_
 

Additional Inherited Members

- Static Public Member Functions inherited from RelAlgNode
static void resetRelAlgFirstId () noexcept
 
- Protected Attributes inherited from RelAlgNode
RelAlgInputs inputs_
 
const unsigned id_
 

Detailed Description

Definition at line 1546 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

RelTableFunction::RelTableFunction ( const std::string &  function_name,
RelAlgInputs  inputs,
std::vector< std::string > &  fields,
std::vector< const Rex * >  col_inputs,
std::vector< std::unique_ptr< const RexScalar >> &  table_func_inputs,
std::vector< std::unique_ptr< const RexScalar >> &  target_exprs 
)
inline

Definition at line 1548 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

1554  : function_name_(function_name)
1555  , fields_(fields)
1556  , col_inputs_(col_inputs)
1557  , table_func_inputs_(std::move(table_func_inputs))
1558  , target_exprs_(std::move(target_exprs)) {
1559  for (const auto& input : inputs) {
1560  inputs_.emplace_back(input);
1561  }
1562  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
std::string function_name_
std::vector< const Rex * > col_inputs_
std::vector< std::string > fields_
RelAlgInputs inputs_
std::vector< std::unique_ptr< const RexScalar > > target_exprs_
RelTableFunction::RelTableFunction ( RelTableFunction const rhs)

Definition at line 489 of file RelAlgDagBuilder.cpp.

References CHECK, col_inputs_, i, and table_func_inputs_.

490  : RelAlgNode(rhs)
491  , function_name_(rhs.function_name_)
492  , fields_(rhs.fields_)
493  , col_inputs_(rhs.col_inputs_)
494  , table_func_inputs_(copyRexScalars(rhs.table_func_inputs_))
495  , target_exprs_(copyRexScalars(rhs.target_exprs_)) {
496  std::unordered_map<const Rex*, const Rex*> old_to_new_input;
497  for (size_t i = 0; i < table_func_inputs_.size(); ++i) {
498  old_to_new_input.emplace(rhs.table_func_inputs_[i].get(),
499  table_func_inputs_[i].get());
500  }
501  for (auto& target : col_inputs_) {
502  auto target_it = old_to_new_input.find(target);
503  CHECK(target_it != old_to_new_input.end());
504  target = target_it->second;
505  }
506 }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
RelAlgNode(RelAlgInputs inputs={})
std::string function_name_
std::vector< const Rex * > col_inputs_
std::vector< std::string > fields_
#define CHECK(condition)
Definition: Logger.h:206
std::vector< std::unique_ptr< const RexScalar > > copyRexScalars(std::vector< std::unique_ptr< const RexScalar >> const &scalar_sources)
std::vector< std::unique_ptr< const RexScalar > > target_exprs_

Member Function Documentation

int32_t RelTableFunction::countRexLiteralArgs ( ) const

Definition at line 478 of file RelAlgDagBuilder.cpp.

References table_func_inputs_.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

478  {
479  int32_t literal_args = 0;
480  for (const auto& arg : table_func_inputs_) {
481  const auto rex_literal = dynamic_cast<const RexLiteral*>(arg.get());
482  if (rex_literal) {
483  literal_args += 1;
484  }
485  }
486  return literal_args;
487 }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_

+ Here is the caller graph for this function:

std::shared_ptr<RelAlgNode> RelTableFunction::deepCopy ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1598 of file RelAlgDagBuilder.h.

1598  {
1599  return std::make_shared<RelTableFunction>(*this);
1600  }
size_t RelTableFunction::getColInputsSize ( ) const
inline

Definition at line 1575 of file RelAlgDagBuilder.h.

References col_inputs_.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

1575 { return col_inputs_.size(); }
std::vector< const Rex * > col_inputs_

+ Here is the caller graph for this function:

std::string RelTableFunction::getFieldName ( const size_t  idx) const
inline

Definition at line 1593 of file RelAlgDagBuilder.h.

References CHECK_LT, and fields_.

1593  {
1594  CHECK_LT(idx, fields_.size());
1595  return fields_[idx];
1596  }
std::vector< std::string > fields_
#define CHECK_LT(x, y)
Definition: Logger.h:216
std::string RelTableFunction::getFunctionName ( ) const
inline

Definition at line 1569 of file RelAlgDagBuilder.h.

References function_name_.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

1569 { return function_name_; }
std::string function_name_

+ Here is the caller graph for this function:

const RexScalar* RelTableFunction::getTableFuncInputAt ( const size_t  idx) const
inline

Definition at line 1579 of file RelAlgDagBuilder.h.

References CHECK_LT, and table_func_inputs_.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit(), anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), anonymous_namespace{RelAlgExecutor.cpp}::scalar_at(), and RelRexDagVisitor::visit().

1579  {
1580  CHECK_LT(idx, table_func_inputs_.size());
1581  return table_func_inputs_[idx].get();
1582  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
#define CHECK_LT(x, y)
Definition: Logger.h:216

+ Here is the caller graph for this function:

const RexScalar* RelTableFunction::getTableFuncInputAtAndRelease ( const size_t  idx)
inline

Definition at line 1584 of file RelAlgDagBuilder.h.

References CHECK_LT, and table_func_inputs_.

1584  {
1585  CHECK_LT(idx, table_func_inputs_.size());
1586  return table_func_inputs_[idx].release();
1587  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
#define CHECK_LT(x, y)
Definition: Logger.h:216
size_t RelTableFunction::getTableFuncInputsSize ( ) const
inline

Definition at line 1573 of file RelAlgDagBuilder.h.

References table_func_inputs_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::get_scalar_sources_size(), anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), and RelRexDagVisitor::visit().

1573 { return table_func_inputs_.size(); }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_

+ Here is the caller graph for this function:

void RelTableFunction::replaceInput ( std::shared_ptr< const RelAlgNode old_input,
std::shared_ptr< const RelAlgNode input 
)
overridevirtual

Reimplemented from RelAlgNode.

Definition at line 466 of file RelAlgDagBuilder.cpp.

References RelAlgNode::replaceInput(), table_func_inputs_, and target_exprs_.

467  {
468  RelAlgNode::replaceInput(old_input, input);
469  RexRebindInputsVisitor rebind_inputs(old_input.get(), input.get());
470  for (const auto& target_expr : target_exprs_) {
471  rebind_inputs.visit(target_expr.get());
472  }
473  for (const auto& func_input : table_func_inputs_) {
474  rebind_inputs.visit(func_input.get());
475  }
476 }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
virtual void replaceInput(std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input)
std::vector< std::unique_ptr< const RexScalar > > target_exprs_

+ Here is the call graph for this function:

void RelTableFunction::setTableFuncInputs ( std::vector< std::unique_ptr< const RexScalar >> &  exprs)
inline

Definition at line 1589 of file RelAlgDagBuilder.h.

References table_func_inputs_.

1589  {
1590  table_func_inputs_ = std::move(exprs);
1591  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
size_t RelTableFunction::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1571 of file RelAlgDagBuilder.h.

References target_exprs_.

1571 { return target_exprs_.size(); }
std::vector< std::unique_ptr< const RexScalar > > target_exprs_
std::string RelTableFunction::toString ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1602 of file RelAlgDagBuilder.h.

References cat(), fields_, function_name_, RelAlgNode::inputs_, table_func_inputs_, target_exprs_, and typeName().

1602  {
1603  return cat(::typeName(this),
1604  "(",
1606  ", inputs=",
1607  ::toString(inputs_),
1608  ", fields=",
1609  ::toString(fields_),
1610  ", col_inputs=...",
1611  ", table_func_inputs=",
1613  ", target_exprs=",
1615  ")");
1616  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
std::string toString() const override
std::string cat(Ts &&...args)
std::string function_name_
std::vector< std::string > fields_
std::string typeName(const T *v)
Definition: toString.h:82
RelAlgInputs inputs_
std::vector< std::unique_ptr< const RexScalar > > target_exprs_

+ Here is the call graph for this function:

Member Data Documentation

std::vector<const Rex*> RelTableFunction::col_inputs_
private

Definition at line 1623 of file RelAlgDagBuilder.h.

Referenced by getColInputsSize(), and RelTableFunction().

std::vector<std::string> RelTableFunction::fields_
private

Definition at line 1620 of file RelAlgDagBuilder.h.

Referenced by getFieldName(), and toString().

std::string RelTableFunction::function_name_
private

Definition at line 1619 of file RelAlgDagBuilder.h.

Referenced by getFunctionName(), and toString().

std::vector<std::unique_ptr<const RexScalar> > RelTableFunction::table_func_inputs_
private
std::vector<std::unique_ptr<const RexScalar> > RelTableFunction::target_exprs_
private

Definition at line 1628 of file RelAlgDagBuilder.h.

Referenced by replaceInput(), size(), and toString().


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