OmniSciDB  addbbd5075
 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, 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 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
std::vector< std::shared_ptr
< const RelAlgNode > > 
inputs_
 
const unsigned id_
 

Detailed Description

Definition at line 1368 of file RelAlgDagBuilder.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 1370 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

1376  : function_name_(function_name)
1377  , fields_(fields)
1378  , col_inputs_(col_inputs)
1379  , table_func_inputs_(std::move(table_func_inputs))
1380  , target_exprs_(std::move(target_exprs)) {
1381  inputs_.emplace_back(input);
1382  }
std::vector< std::shared_ptr< const RelAlgNode > > inputs_
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_
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 375 of file RelAlgDagBuilder.cpp.

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

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

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

1393 { 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 1409 of file RelAlgDagBuilder.h.

References CHECK_LT.

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

Definition at line 1387 of file RelAlgDagBuilder.h.

Referenced by RelAlgExecutor::createTableFunctionWorkUnit().

1387 { 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 1395 of file RelAlgDagBuilder.h.

References CHECK_LT.

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

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

+ Here is the caller graph for this function:

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

Definition at line 1400 of file RelAlgDagBuilder.h.

References CHECK_LT.

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

Definition at line 1391 of file RelAlgDagBuilder.h.

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

1391 { 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 363 of file RelAlgDagBuilder.cpp.

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

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

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

Implements RelAlgNode.

Definition at line 1389 of file RelAlgDagBuilder.h.

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

Implements RelAlgNode.

Definition at line 1416 of file RelAlgDagBuilder.h.

References run_benchmark_import::result, and to_string().

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

Referenced by deepCopy().

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

Definition at line 1436 of file RelAlgDagBuilder.h.

Referenced by deepCopy().

std::string RelTableFunction::function_name_
private

Definition at line 1435 of file RelAlgDagBuilder.h.

Referenced by deepCopy().

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

Definition at line 1441 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and replaceInput().

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

Definition at line 1444 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and replaceInput().


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