OmniSciDB  8a228a1076
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
 
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 ()
 

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 1608 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

◆ RelTableFunction() [1/2]

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 1610 of file RelAlgDagBuilder.h.

1616  : function_name_(function_name)
1617  , fields_(fields)
1618  , col_inputs_(col_inputs)
1619  , table_func_inputs_(std::move(table_func_inputs))
1620  , target_exprs_(std::move(target_exprs)) {
1621  for (const auto& input : inputs) {
1622  inputs_.emplace_back(input);
1623  }
1624  }
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() [2/2]

RelTableFunction::RelTableFunction ( RelTableFunction const &  rhs)

Definition at line 478 of file RelAlgDagBuilder.cpp.

References CHECK, col_inputs_, and table_func_inputs_.

479  : RelAlgNode(rhs)
480  , function_name_(rhs.function_name_)
481  , fields_(rhs.fields_)
482  , col_inputs_(rhs.col_inputs_)
483  , table_func_inputs_(copyRexScalars(rhs.table_func_inputs_))
484  , target_exprs_(copyRexScalars(rhs.target_exprs_)) {
485  std::unordered_map<const Rex*, const Rex*> old_to_new_input;
486  for (size_t i = 0; i < table_func_inputs_.size(); ++i) {
487  old_to_new_input.emplace(rhs.table_func_inputs_[i].get(),
488  table_func_inputs_[i].get());
489  }
490  for (auto& target : col_inputs_) {
491  auto target_it = old_to_new_input.find(target);
492  CHECK(target_it != old_to_new_input.end());
493  target = target_it->second;
494  }
495 }
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:197
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

◆ deepCopy()

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

Implements RelAlgNode.

Definition at line 1658 of file RelAlgDagBuilder.h.

1658  {
1659  return std::make_shared<RelTableFunction>(*this);
1660  }

◆ getColInputsSize()

size_t RelTableFunction::getColInputsSize ( ) const
inline

Definition at line 1637 of file RelAlgDagBuilder.h.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

1637 { return col_inputs_.size(); }
std::vector< const Rex * > col_inputs_
+ Here is the caller graph for this function:

◆ getFieldName()

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

Definition at line 1653 of file RelAlgDagBuilder.h.

References CHECK_LT.

1653  {
1654  CHECK_LT(idx, fields_.size());
1655  return fields_[idx];
1656  }
std::vector< std::string > fields_
#define CHECK_LT(x, y)
Definition: Logger.h:207

◆ getFunctionName()

std::string RelTableFunction::getFunctionName ( ) const
inline

Definition at line 1631 of file RelAlgDagBuilder.h.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

1631 { return function_name_; }
std::string function_name_
+ Here is the caller graph for this function:

◆ getTableFuncInputAt()

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

Definition at line 1639 of file RelAlgDagBuilder.h.

References CHECK_LT.

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

1639  {
1640  CHECK_LT(idx, table_func_inputs_.size());
1641  return table_func_inputs_[idx].get();
1642  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
#define CHECK_LT(x, y)
Definition: Logger.h:207
+ Here is the caller graph for this function:

◆ getTableFuncInputAtAndRelease()

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

Definition at line 1644 of file RelAlgDagBuilder.h.

References CHECK_LT.

1644  {
1645  CHECK_LT(idx, table_func_inputs_.size());
1646  return table_func_inputs_[idx].release();
1647  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
#define CHECK_LT(x, y)
Definition: Logger.h:207

◆ getTableFuncInputsSize()

size_t RelTableFunction::getTableFuncInputsSize ( ) const
inline

Definition at line 1635 of file RelAlgDagBuilder.h.

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

1635 { return table_func_inputs_.size(); }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
+ Here is the caller graph for this function:

◆ replaceInput()

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(), and RelCompound::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:

◆ setTableFuncInputs()

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

Definition at line 1649 of file RelAlgDagBuilder.h.

1649  {
1650  table_func_inputs_ = std::move(exprs);
1651  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_

◆ size()

size_t RelTableFunction::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1633 of file RelAlgDagBuilder.h.

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

◆ toString()

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

Implements RelAlgNode.

Definition at line 1662 of file RelAlgDagBuilder.h.

References run_benchmark_import::result, and to_string().

1662  {
1663  std::string result = "RelTableFunction<" +
1664  std::to_string(reinterpret_cast<uint64_t>(this)) + ">(" +
1665  function_name_ + ", ";
1666 
1667  result += "inputs=[";
1668  for (size_t i = 0; i < inputs_.size(); ++i) {
1669  result += inputs_[i]->toString();
1670  if (i < inputs_.size() - 1) {
1671  result += ", ";
1672  }
1673  }
1674  result += "], ";
1675 
1676  result += "target_exprs=[";
1677  for (size_t i = 0; i < target_exprs_.size(); ++i) {
1678  result += target_exprs_[i]->toString();
1679  if (i < target_exprs_.size() - 1) {
1680  result += ", ";
1681  }
1682  }
1683  result += "], ";
1684 
1685  result += "table_func_inputs=[";
1686  for (size_t i = 0; i < table_func_inputs_.size(); ++i) {
1687  result += table_func_inputs_[i]->toString();
1688  if (i < table_func_inputs_.size() - 1) {
1689  result += ", ";
1690  }
1691  }
1692  result += "], ";
1693 
1694  result += "col_inputs=[";
1695  for (size_t i = 0; i < col_inputs_.size(); ++i) {
1696  result += std::to_string((size_t)col_inputs_[i]);
1697  if (i < col_inputs_.size() - 1) {
1698  result += ", ";
1699  }
1700  }
1701  result += "], ";
1702 
1703  result += "fields=[";
1704  for (size_t i = 0; i < fields_.size(); ++i) {
1705  result += fields_[i];
1706  if (i < fields_.size() - 1) {
1707  result += ", ";
1708  }
1709  }
1710  result += "])";
1711 
1712  return result;
1713  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
std::string function_name_
std::vector< const Rex * > col_inputs_
std::string to_string(char const *&&v)
std::vector< std::string > fields_
RelAlgInputs inputs_
std::vector< std::unique_ptr< const RexScalar > > target_exprs_
+ Here is the call graph for this function:

Member Data Documentation

◆ col_inputs_

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

Definition at line 1720 of file RelAlgDagBuilder.h.

Referenced by RelTableFunction().

◆ fields_

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

Definition at line 1717 of file RelAlgDagBuilder.h.

◆ function_name_

std::string RelTableFunction::function_name_
private

Definition at line 1716 of file RelAlgDagBuilder.h.

◆ table_func_inputs_

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

Definition at line 1722 of file RelAlgDagBuilder.h.

Referenced by RelTableFunction().

◆ target_exprs_

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

Definition at line 1725 of file RelAlgDagBuilder.h.


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