OmniSciDB  a5dc49c757
 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 838 of file ExtensionFunctionsBinding.cpp.

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

840  {
841  // used below
842  std::vector<ExtensionFunction> ext_funcs =
844  std::string processor = (is_gpu ? "GPU" : "CPU");
845  return std::get<0>(
846  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
847 }
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 810 of file ExtensionFunctionsBinding.cpp.

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

811  {
812  // used in RelAlgTranslator.cpp, first try GPU UDFs, then fall back
813  // to CPU UDFs.
814  bool is_gpu = true;
815  std::string processor = "GPU";
816  auto ext_funcs = ExtensionFunctionsWhitelist::get_ext_funcs(name, is_gpu);
817  if (!ext_funcs.size()) {
818  is_gpu = false;
819  processor = "CPU";
821  }
822  try {
823  return std::get<0>(
824  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
825  } catch (ExtensionFunctionBindingError& e) {
826  if (is_gpu) {
827  is_gpu = false;
828  processor = "GPU|CPU";
830  return std::get<0>(
831  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
832  } else {
833  throw;
834  }
835  }
836 }
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 849 of file ExtensionFunctionsBinding.cpp.

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

850  {
851  // used in ExtensionsIR.cpp
852  auto name = function_oper->getName();
853  Analyzer::ExpressionPtrVector func_args = {};
854  for (size_t i = 0; i < function_oper->getArity(); ++i) {
855  func_args.push_back(function_oper->getOwnArg(i));
856  }
857  return bind_function(name, func_args, is_gpu);
858 }
size_t getArity() const
Definition: Analyzer.h:2746
std::shared_ptr< Analyzer::Expr > getOwnArg(const size_t i) const
Definition: Analyzer.h:2753
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:186
std::string getName() const
Definition: Analyzer.h:2744
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 861 of file ExtensionFunctionsBinding.cpp.

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

863  {
864  // used in RelAlgExecutor.cpp
865  std::vector<table_functions::TableFunction> table_funcs =
867  return bind_table_function(name, input_args, table_funcs, is_gpu);
868 }
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: