OmniSciDB  a667adc9c8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ExtensionFunctionsBinding.h File Reference
#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)
 
bool is_ext_arg_type_column (const ExtArgumentType ext_arg_type)
 
bool is_ext_arg_type_column_list (const ExtArgumentType ext_arg_type)
 
bool is_ext_arg_type_array (const ExtArgumentType ext_arg_type)
 
bool is_ext_arg_type_geo (const ExtArgumentType ext_arg_type)
 
bool is_ext_arg_type_pointer (const ExtArgumentType ext_arg_type)
 
bool is_ext_arg_type_scalar (const ExtArgumentType ext_arg_type)
 

Function Documentation

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

Definition at line 645 of file ExtensionFunctionsBinding.cpp.

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

647  {
648  // used below
649  std::vector<ExtensionFunction> ext_funcs =
651  std::string processor = (is_gpu ? "GPU" : "CPU");
652  return std::get<0>(
653  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
654 }
static std::vector< ExtensionFunction > get_ext_funcs(const std::string &name, const bool is_gpu)
string name
Definition: setup.in.py:62

+ Here is the call graph for this function:

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

Definition at line 617 of file ExtensionFunctionsBinding.cpp.

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

618  {
619  // used in RelAlgTranslator.cpp, first try GPU UDFs, then fall back
620  // to CPU UDFs.
621  bool is_gpu = true;
622  std::string processor = "GPU";
623  auto ext_funcs = ExtensionFunctionsWhitelist::get_ext_funcs(name, is_gpu);
624  if (!ext_funcs.size()) {
625  is_gpu = false;
626  processor = "CPU";
628  }
629  try {
630  return std::get<0>(
631  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
632  } catch (ExtensionFunctionBindingError& e) {
633  if (is_gpu) {
634  is_gpu = false;
635  processor = "GPU|CPU";
637  return std::get<0>(
638  bind_function<ExtensionFunction>(name, func_args, ext_funcs, processor));
639  } else {
640  throw;
641  }
642  }
643 }
static std::vector< ExtensionFunction > get_ext_funcs(const std::string &name, const bool is_gpu)
string name
Definition: setup.in.py:62

+ Here is the call graph for this function:

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

Definition at line 656 of file ExtensionFunctionsBinding.cpp.

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

657  {
658  // used in ExtensionsIR.cpp
659  auto name = function_oper->getName();
660  Analyzer::ExpressionPtrVector func_args = {};
661  for (size_t i = 0; i < function_oper->getArity(); ++i) {
662  func_args.push_back(function_oper->getOwnArg(i));
663  }
664  return bind_function(name, func_args, is_gpu);
665 }
size_t getArity() const
Definition: Analyzer.h:1360
string name
Definition: setup.in.py:62
std::shared_ptr< Analyzer::Expr > getOwnArg(const size_t i) const
Definition: Analyzer.h:1367
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:182
std::string getName() const
Definition: Analyzer.h:1358

+ 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 668 of file ExtensionFunctionsBinding.cpp.

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

670  {
671  // used in RelAlgExecutor.cpp
672  std::vector<table_functions::TableFunction> table_funcs =
674  return bind_table_function(name, input_args, table_funcs, is_gpu);
675 }
string name
Definition: setup.in.py:62
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)
static std::vector< TableFunction > get_table_funcs(const std::string &name, const bool is_gpu)

+ Here is the call graph for this function:

bool is_ext_arg_type_array ( const ExtArgumentType  ext_arg_type)

Definition at line 677 of file ExtensionFunctionsBinding.cpp.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, and ArrayInt8.

Referenced by CodeGenerator::codegenFunctionOperCastArgs(), ExtensionFunctionsWhitelist::getLLVMDeclarations(), and anonymous_namespace{ExtensionFunctionsBinding.cpp}::match_arguments().

+ Here is the caller graph for this function:

bool is_ext_arg_type_column ( const ExtArgumentType  ext_arg_type)

Definition at line 693 of file ExtensionFunctionsBinding.cpp.

References ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, and ColumnInt8.

Referenced by anonymous_namespace{ExtensionFunctionsBinding.cpp}::match_arguments().

+ Here is the caller graph for this function:

bool is_ext_arg_type_column_list ( const ExtArgumentType  ext_arg_type)
bool is_ext_arg_type_geo ( const ExtArgumentType  ext_arg_type)

Definition at line 725 of file ExtensionFunctionsBinding.cpp.

References GeoLineString, GeoMultiPolygon, GeoPoint, and GeoPolygon.

Referenced by CodeGenerator::codegenFunctionOperCastArgs().

725  {
726  switch (ext_arg_type) {
731  return true;
732 
733  default:
734  return false;
735  }
736 }

+ Here is the caller graph for this function:

bool is_ext_arg_type_pointer ( const ExtArgumentType  ext_arg_type)

Definition at line 738 of file ExtensionFunctionsBinding.cpp.

References PBool, PDouble, PFloat, PInt16, PInt32, PInt64, and PInt8.

Referenced by CodeGenerator::codegenFunctionOperCastArgs().

+ Here is the caller graph for this function:

bool is_ext_arg_type_scalar ( const ExtArgumentType  ext_arg_type)

Definition at line 754 of file ExtensionFunctionsBinding.cpp.

References Bool, Double, Float, Int16, Int32, Int64, and Int8.

754  {
755  switch (ext_arg_type) {
763  return true;
764 
765  default:
766  return false;
767  }
768 }