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

#include <RelAlgAbstractInterpreter.h>

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

Public Member Functions

 RelTableFunction (const std::string &function_name, std::shared_ptr< const RelAlgNode > input, 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)
 
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 ()
 
virtual ~RelAlgNode ()
 
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
std::vector< std::shared_ptr
< const RelAlgNode > > 
inputs_
 
const unsigned id_
 

Detailed Description

Definition at line 1366 of file RelAlgAbstractInterpreter.h.

Constructor & Destructor Documentation

RelTableFunction::RelTableFunction ( const std::string &  function_name,
std::shared_ptr< const RelAlgNode input,
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 1368 of file RelAlgAbstractInterpreter.h.

References RelAlgNode::inputs_.

1374  : function_name_(function_name)
1375  , fields_(fields)
1376  , col_inputs_(col_inputs)
1377  , table_func_inputs_(std::move(table_func_inputs))
1378  , target_exprs_(std::move(target_exprs)) {
1379  inputs_.emplace_back(input);
1380  }
std::vector< std::shared_ptr< const RelAlgNode > > inputs_
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
std::vector< const Rex * > col_inputs_
std::vector< std::string > fields_
std::vector< std::unique_ptr< const RexScalar > > target_exprs_

Member Function Documentation

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

Implements RelAlgNode.

Definition at line 372 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), col_inputs_, fields_, function_name_, RelAlgNode::inputs_, table_func_inputs_, target_exprs_, and RexVisitorBase< T >::visit().

372  {
373  RexDeepCopyVisitor copier;
374 
375  std::unordered_map<const Rex*, const Rex*> old_to_new_input;
376 
377  std::vector<std::unique_ptr<const RexScalar>> table_func_inputs_copy;
378  for (auto& expr : table_func_inputs_) {
379  table_func_inputs_copy.push_back(copier.visit(expr.get()));
380  old_to_new_input.insert(
381  std::make_pair(expr.get(), table_func_inputs_copy.back().get()));
382  }
383 
384  std::vector<const Rex*> col_inputs_copy;
385  for (auto target : col_inputs_) {
386  auto target_it = old_to_new_input.find(target);
387  CHECK(target_it != old_to_new_input.end());
388  col_inputs_copy.push_back(target_it->second);
389  }
390  auto fields_copy = fields_;
391 
392  std::vector<std::unique_ptr<const RexScalar>> target_exprs_copy;
393  for (auto& expr : target_exprs_) {
394  target_exprs_copy.push_back(copier.visit(expr.get()));
395  }
396 
397  return std::make_shared<RelTableFunction>(function_name_,
398  inputs_[0],
399  fields_copy,
400  col_inputs_copy,
401  table_func_inputs_copy,
402  target_exprs_copy);
403 }
std::vector< std::shared_ptr< const RelAlgNode > > inputs_
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
std::vector< const Rex * > col_inputs_
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
CHECK(cgen_state)
std::vector< std::string > fields_
std::vector< std::unique_ptr< const RexScalar > > target_exprs_

+ Here is the call graph for this function:

size_t RelTableFunction::getColInputsSize ( ) const
inline

Definition at line 1391 of file RelAlgAbstractInterpreter.h.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

1391 { 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 1407 of file RelAlgAbstractInterpreter.h.

References CHECK_LT.

1407  {
1408  CHECK_LT(idx, fields_.size());
1409  return fields_[idx];
1410  }
std::vector< std::string > fields_
#define CHECK_LT(x, y)
Definition: Logger.h:200
std::string RelTableFunction::getFunctionName ( ) const
inline

Definition at line 1385 of file RelAlgAbstractInterpreter.h.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

1385 { return function_name_; }

+ Here is the caller graph for this function:

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

Definition at line 1393 of file RelAlgAbstractInterpreter.h.

References CHECK_LT.

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

1393  {
1394  CHECK_LT(idx, table_func_inputs_.size());
1395  return table_func_inputs_[idx].get();
1396  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
#define CHECK_LT(x, y)
Definition: Logger.h:200

+ Here is the caller graph for this function:

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

Definition at line 1398 of file RelAlgAbstractInterpreter.h.

References CHECK_LT.

1398  {
1399  CHECK_LT(idx, table_func_inputs_.size());
1400  return table_func_inputs_[idx].release();
1401  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
#define CHECK_LT(x, y)
Definition: Logger.h:200
size_t RelTableFunction::getTableFuncInputsSize ( ) const
inline

Definition at line 1389 of file RelAlgAbstractInterpreter.h.

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

1389 { 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 360 of file RelAlgAbstractInterpreter.cpp.

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

361  {
362  RelAlgNode::replaceInput(old_input, input);
363  RexRebindInputsVisitor rebind_inputs(old_input.get(), input.get());
364  for (const auto& target_expr : target_exprs_) {
365  rebind_inputs.visit(target_expr.get());
366  }
367  for (const auto& func_input : table_func_inputs_) {
368  rebind_inputs.visit(func_input.get());
369  }
370 }
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 1403 of file RelAlgAbstractInterpreter.h.

1403  {
1404  table_func_inputs_ = std::move(exprs);
1405  }
std::vector< std::unique_ptr< const RexScalar > > table_func_inputs_
size_t RelTableFunction::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1387 of file RelAlgAbstractInterpreter.h.

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

Implements RelAlgNode.

Definition at line 1414 of file RelAlgAbstractInterpreter.h.

References run_benchmark_import::result, and to_string().

1414  {
1415  std::string result = "RelTableFunction<" +
1416  std::to_string(reinterpret_cast<uint64_t>(this)) + ">(" +
1417  function_name_ + " ";
1418 
1419  result += "targets: " + std::to_string(target_exprs_.size());
1420  result += "inputs: [";
1421  for (size_t i = 0; i < target_exprs_.size(); ++i) {
1422  result += target_exprs_[i]->toString();
1423  if (i < target_exprs_.size() - 1) {
1424  result += ", ";
1425  }
1426  }
1427  result += "]";
1428 
1429  return result;
1430  }
std::string to_string(char const *&&v)
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 1437 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy().

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

Definition at line 1434 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy().

std::string RelTableFunction::function_name_
private

Definition at line 1433 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy().

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

Definition at line 1439 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), and replaceInput().

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

Definition at line 1442 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), and replaceInput().


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