OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
table_functions::anonymous_namespace{TableFunctionsFactory.cpp} Namespace Reference

Functions

SQLTypeInfo ext_arg_pointer_type_to_type_info (const ExtArgumentType ext_arg_type)
 
SQLTypeInfo ext_arg_type_to_type_info_output (const ExtArgumentType ext_arg_type)
 
template<size_t... I>
constexpr bool string_view_array_sorted_and_distinct (std::string_view const *list, std::index_sequence< I...>)
 
bool is_table_function_whitelisted (std::string_view const function_name)
 
std::string drop_suffix_impl (const std::string &str)
 

Function Documentation

std::string table_functions::anonymous_namespace{TableFunctionsFactory.cpp}::drop_suffix_impl ( const std::string &  str)

Definition at line 552 of file TableFunctionsFactory.cpp.

References CHECK_GT.

552  {
553  const auto idx = str.find("__");
554  if (idx == std::string::npos) {
555  return str;
556  }
557  CHECK_GT(idx, std::string::size_type(0));
558  return str.substr(0, idx);
559 }
#define CHECK_GT(x, y)
Definition: Logger.h:305
SQLTypeInfo table_functions::anonymous_namespace{TableFunctionsFactory.cpp}::ext_arg_pointer_type_to_type_info ( const ExtArgumentType  ext_arg_type)

Definition at line 34 of file TableFunctionsFactory.cpp.

References ext_arg_type_to_type_info(), kBIGINT, kBOOLEAN, kDOUBLE, kFLOAT, kINT, kNULLT, kSMALLINT, kTINYINT, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and UNREACHABLE.

Referenced by table_functions::TableFunction::getInputSQLType().

34  {
35  switch (ext_arg_type) {
37  return SQLTypeInfo(kTINYINT, false);
39  return SQLTypeInfo(kSMALLINT, false);
41  return SQLTypeInfo(kINT, false);
43  return SQLTypeInfo(kBIGINT, false);
45  return SQLTypeInfo(kFLOAT, false);
47  return SQLTypeInfo(kDOUBLE, false);
49  return SQLTypeInfo(kBOOLEAN, false);
50  default:
51  return ext_arg_type_to_type_info(ext_arg_type);
52  }
53  UNREACHABLE();
54  return SQLTypeInfo(kNULLT, false);
55 }
#define UNREACHABLE()
Definition: Logger.h:338
Definition: sqltypes.h:72
SQLTypeInfo ext_arg_type_to_type_info(const ExtArgumentType ext_arg_type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SQLTypeInfo table_functions::anonymous_namespace{TableFunctionsFactory.cpp}::ext_arg_type_to_type_info_output ( const ExtArgumentType  ext_arg_type)

Definition at line 57 of file TableFunctionsFactory.cpp.

References ext_arg_type_to_type_info(), SQLTypeInfo::get_elem_type(), kBIGINT, kBOOLEAN, kDOUBLE, kFLOAT, kINT, kNULLT, kSMALLINT, kTINYINT, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and UNREACHABLE.

Referenced by table_functions::TableFunction::getOutputSQLType().

57  {
58  switch (ext_arg_type) {
60  return SQLTypeInfo(kTINYINT, false);
62  return SQLTypeInfo(kSMALLINT, false);
64  return SQLTypeInfo(kINT, false);
66  return SQLTypeInfo(kBIGINT, false);
68  return SQLTypeInfo(kFLOAT, false);
70  return SQLTypeInfo(kDOUBLE, false);
72  return SQLTypeInfo(kBOOLEAN, false);
73  default:
74  return ext_arg_type_to_type_info(ext_arg_type).get_elem_type();
75  }
76  UNREACHABLE();
77  return SQLTypeInfo(kNULLT, false);
78 }
#define UNREACHABLE()
Definition: Logger.h:338
Definition: sqltypes.h:72
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:975
SQLTypeInfo ext_arg_type_to_type_info(const ExtArgumentType ext_arg_type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool table_functions::anonymous_namespace{TableFunctionsFactory.cpp}::is_table_function_whitelisted ( std::string_view const  function_name)

Definition at line 358 of file TableFunctionsFactory.cpp.

References g_enable_ml_functions, and string_view_array_sorted_and_distinct().

Referenced by table_functions::TableFunctionsFactory::add().

358  {
359  // All table functions that will be on by default (and not just for testing)
360  // must be added to the whitelisted_table_functions list below.
361  // These lists must be in alphabetical order (enforced at compile-time)
362  constexpr std::string_view whitelisted_table_functions[]{
363  "dbscan",
364  "decision_tree_reg_fit",
365  "gbt_reg_fit",
366  "generate_random_strings",
367  "generate_series",
368  "get_decision_trees",
369  "kmeans",
370  "linear_reg_coefs",
371  "linear_reg_fit",
372  "ml_reg_predict",
373  "pca_fit",
374  "r2_score",
375  "random_forest_reg_fit",
376  "random_forest_reg_var_importance",
377  "supported_ml_frameworks",
378  "tf_compute_dwell_times",
379  "tf_cross_section_1d",
380  "tf_cross_section_2d",
381  "tf_feature_self_similarity",
382  "tf_feature_similarity",
383  "tf_geo_multi_rasterize",
384  "tf_geo_rasterize",
385  "tf_geo_rasterize_slope",
386  "tf_graph_shortest_path",
387  "tf_graph_shortest_paths_distances",
388  "tf_load_point_cloud",
389  "tf_mandelbrot",
390  "tf_mandelbrot_cuda",
391  "tf_mandelbrot_cuda_float",
392  "tf_mandelbrot_float",
393  "tf_point_cloud_metadata",
394  "tf_raster_contour_lines",
395  "tf_raster_contour_polygons",
396  "tf_raster_graph_shortest_slope_weighted_path"
397  };
398  constexpr auto whitelisted_table_functions_len =
399  sizeof(whitelisted_table_functions) / sizeof(*whitelisted_table_functions);
400 
401 
402  // Must be sorted.
403  constexpr std::string_view ml_table_functions[]{"dbscan",
404  "decision_tree_reg_fit",
405  "gbt_reg_fit",
406  "get_decision_trees",
407  "kmeans",
408  "linear_reg_coefs",
409  "linear_reg_fit",
410  "ml_reg_predict",
411  "pca_fit"
412  "r2_score",
413  "random_forest_reg_fit",
414  "random_forest_reg_var_importance",
415  "supported_ml_frameworks"};
416  constexpr auto ml_table_functions_len =
417  sizeof(ml_table_functions) / sizeof(*ml_table_functions);
418 
419  // compile-time validation that above lists are sorted and distinct
421  whitelisted_table_functions,
422  std::make_index_sequence<whitelisted_table_functions_len - 1>{}));
424  ml_table_functions, std::make_index_sequence<ml_table_functions_len - 1>{}));
425 
426  if (!std::binary_search(whitelisted_table_functions,
427  whitelisted_table_functions + whitelisted_table_functions_len,
428  function_name)) {
429  return false;
430  }
431  return g_enable_ml_functions ||
432  !std::binary_search(ml_table_functions,
433  ml_table_functions + ml_table_functions_len,
434  function_name);
435 }
constexpr bool string_view_array_sorted_and_distinct(std::string_view const *list, std::index_sequence< I...>)
bool g_enable_ml_functions
Definition: Execute.cpp:118

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<size_t... I>
constexpr bool table_functions::anonymous_namespace{TableFunctionsFactory.cpp}::string_view_array_sorted_and_distinct ( std::string_view const *  list,
std::index_sequence< I...>   
)

Definition at line 353 of file TableFunctionsFactory.cpp.

Referenced by is_table_function_whitelisted().

354  {
355  return ((list[I] < list[I + 1]) && ...);
356 }

+ Here is the caller graph for this function: