OmniSciDB  ca0c39ec8f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExtensionFunctionsBinding.h File Reference

Argument type based extension function binding. More...

#include "ExtensionFunctionsWhitelist.h"
#include "TableFunctions/TableFunctionsFactory.h"
#include "../Analyzer/Analyzer.h"
#include "../Shared/sqltypes.h"
#include <tuple>
#include <vector>
+ Include dependency graph for ExtensionFunctionsBinding.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ExtensionFunctionBindingError
 

Namespaces

 Analyzer
 

Functions

ExtensionFunction bind_function (std::string name, Analyzer::ExpressionPtrVector func_args, const bool is_gpu)
 
ExtensionFunction bind_function (std::string name, Analyzer::ExpressionPtrVector func_args)
 
ExtensionFunction bind_function (const Analyzer::FunctionOper *function_oper, const bool is_gpu)
 
const std::tuple
< table_functions::TableFunction,
std::vector< SQLTypeInfo > > 
bind_table_function (std::string name, Analyzer::ExpressionPtrVector input_args, const bool is_gpu)
 

Detailed Description

Argument type based extension function binding.

Definition in file ExtensionFunctionsBinding.h.

Function Documentation

ExtensionFunction bind_function ( std::string  name,
Analyzer::ExpressionPtrVector  func_args,
const bool  is_gpu 
)

Definition at line 811 of file ExtensionFunctionsBinding.cpp.

References ExtensionFunctionsWhitelist::get_ext_funcs(), and setup::name.

813  {
814  // used below
815  std::vector<ExtensionFunction> ext_funcs =
817  std::string processor = (is_gpu ? "GPU" : "CPU");
818  return std::get<0>(
819  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
820 }
static std::vector< ExtensionFunction > get_ext_funcs(const std::string &name)
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

ExtensionFunction bind_function ( std::string  name,
Analyzer::ExpressionPtrVector  func_args 
)

Definition at line 783 of file ExtensionFunctionsBinding.cpp.

References ExtensionFunctionsWhitelist::get_ext_funcs(), and setup::name.

784  {
785  // used in RelAlgTranslator.cpp, first try GPU UDFs, then fall back
786  // to CPU UDFs.
787  bool is_gpu = true;
788  std::string processor = "GPU";
789  auto ext_funcs = ExtensionFunctionsWhitelist::get_ext_funcs(name, is_gpu);
790  if (!ext_funcs.size()) {
791  is_gpu = false;
792  processor = "CPU";
794  }
795  try {
796  return std::get<0>(
797  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
798  } catch (ExtensionFunctionBindingError& e) {
799  if (is_gpu) {
800  is_gpu = false;
801  processor = "GPU|CPU";
803  return std::get<0>(
804  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
805  } else {
806  throw;
807  }
808  }
809 }
static std::vector< ExtensionFunction > get_ext_funcs(const std::string &name)
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

ExtensionFunction bind_function ( const Analyzer::FunctionOper function_oper,
const bool  is_gpu 
)

Definition at line 822 of file ExtensionFunctionsBinding.cpp.

References bind_function(), Analyzer::FunctionOper::getArity(), Analyzer::FunctionOper::getName(), Analyzer::FunctionOper::getOwnArg(), and setup::name.

823  {
824  // used in ExtensionsIR.cpp
825  auto name = function_oper->getName();
826  Analyzer::ExpressionPtrVector func_args = {};
827  for (size_t i = 0; i < function_oper->getArity(); ++i) {
828  func_args.push_back(function_oper->getOwnArg(i));
829  }
830  return bind_function(name, func_args, is_gpu);
831 }
size_t getArity() const
Definition: Analyzer.h:2308
std::shared_ptr< Analyzer::Expr > getOwnArg(const size_t i) const
Definition: Analyzer.h:2315
std::tuple< T, std::vector< SQLTypeInfo > > bind_function(std::string name, Analyzer::ExpressionPtrVector func_args, const std::vector< T > &ext_funcs, const std::string processor)
std::vector< ExpressionPtr > ExpressionPtrVector
Definition: Analyzer.h:189
std::string getName() const
Definition: Analyzer.h:2306
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

const std::tuple<table_functions::TableFunction, std::vector<SQLTypeInfo> > bind_table_function ( std::string  name,
Analyzer::ExpressionPtrVector  input_args,
const bool  is_gpu 
)

Definition at line 834 of file ExtensionFunctionsBinding.cpp.

References bind_table_function(), and table_functions::TableFunctionsFactory::get_table_funcs().

836  {
837  // used in RelAlgExecutor.cpp
838  std::vector<table_functions::TableFunction> table_funcs =
840  return bind_table_function(name, input_args, table_funcs, is_gpu);
841 }
static std::vector< TableFunction > get_table_funcs()
const std::tuple< table_functions::TableFunction, std::vector< SQLTypeInfo > > bind_table_function(std::string name, Analyzer::ExpressionPtrVector input_args, const std::vector< table_functions::TableFunction > &table_funcs, const bool is_gpu)
string name
Definition: setup.in.py:72

+ Here is the call graph for this function: