OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShowFunctionsCommand Class Reference

#include <DdlCommandExecutor.h>

+ Inheritance diagram for ShowFunctionsCommand:
+ Collaboration diagram for ShowFunctionsCommand:

Public Member Functions

 ShowFunctionsCommand (const DdlCommandData &ddl_data, std::shared_ptr< Catalog_Namespace::SessionInfo const > session_ptr)
 
ExecutionResult execute (bool read_only_mode) override
 
- Public Member Functions inherited from DdlCommand
 DdlCommand (const DdlCommandData &ddl_data, std::shared_ptr< Catalog_Namespace::SessionInfo const > session_ptr)
 

Additional Inherited Members

- Protected Attributes inherited from DdlCommand
const DdlCommandDataddl_data_
 
std::shared_ptr
< Catalog_Namespace::SessionInfo
const > 
session_ptr_
 

Detailed Description

Definition at line 237 of file DdlCommandExecutor.h.

Constructor & Destructor Documentation

ShowFunctionsCommand::ShowFunctionsCommand ( const DdlCommandData ddl_data,
std::shared_ptr< Catalog_Namespace::SessionInfo const >  session_ptr 
)

Definition at line 1832 of file DdlCommandExecutor.cpp.

1835  : DdlCommand(ddl_data, session_ptr) {}
DdlCommand(const DdlCommandData &ddl_data, std::shared_ptr< Catalog_Namespace::SessionInfo const > session_ptr)

Member Function Documentation

ExecutionResult ShowFunctionsCommand::execute ( bool  read_only_mode)
overridevirtual

Executes the DDL command corresponding to provided JSON payload.

Parameters
_returnresult of DDL command execution (if applicable)

Implements DdlCommand.

Definition at line 1837 of file DdlCommandExecutor.cpp.

References ResultSetLogicalValuesBuilder::create(), DdlCommand::ddl_data_, anonymous_namespace{DdlCommandExecutor.cpp}::extractPayload(), anonymous_namespace{DdlCommandExecutor.cpp}::genLiteralBoolean(), genLiteralStr(), ExtensionFunctionsWhitelist::get_ext_funcs(), ExtensionFunctionsWhitelist::get_udfs_name(), legacylockmgr::getExecuteReadLock(), kBOOLEAN, kTEXT, run_benchmark_import::label, and setup::name.

Referenced by heavydb.cursor.Cursor::executemany().

1837  {
1838  auto execute_read_lock = legacylockmgr::getExecuteReadLock();
1839 
1840  // Get all row-wise functions
1841  auto& ddl_payload = extractPayload(ddl_data_);
1842  std::vector<TargetMetaInfo> label_infos;
1843  std::vector<RelLogicalValues::RowValues> logical_values;
1844 
1845  if (ddl_payload.HasMember("ScalarFnNames")) {
1846  // label_infos -> column labels
1847  label_infos.emplace_back("name", SQLTypeInfo(kTEXT, true));
1848  label_infos.emplace_back("signature", SQLTypeInfo(kTEXT, true));
1849  label_infos.emplace_back("CPU", SQLTypeInfo(kBOOLEAN, true));
1850  label_infos.emplace_back("GPU", SQLTypeInfo(kBOOLEAN, true));
1851  label_infos.emplace_back("Runtime", SQLTypeInfo(kBOOLEAN, true));
1852  for (const auto& udf_name_json : ddl_payload["ScalarFnNames"].GetArray()) {
1853  std::string udf_name = udf_name_json.GetString();
1854  std::vector<ExtensionFunction> ext_funcs =
1856 
1857  for (ExtensionFunction& fn : ext_funcs) {
1858  logical_values.emplace_back(RelLogicalValues::RowValues{});
1859  // Name
1860  logical_values.back().emplace_back(genLiteralStr(udf_name));
1861  // Signature
1862  logical_values.back().emplace_back(genLiteralStr(fn.toSignature()));
1863  // CPU?
1864  logical_values.back().emplace_back(genLiteralBoolean(fn.isCPU()));
1865  // GPU?
1866  logical_values.back().emplace_back(genLiteralBoolean(fn.isGPU()));
1867  // Runtime?
1868  logical_values.back().emplace_back(genLiteralBoolean(fn.isRuntime()));
1869  }
1870  }
1871 
1872  } else {
1873  // label_infos -> column labels
1874  for (const auto& label : {"Scalar UDF"}) {
1875  label_infos.emplace_back(label, SQLTypeInfo(kTEXT, true));
1876  }
1877 
1878  // logical_values -> table data
1879  for (auto name : ExtensionFunctionsWhitelist::get_udfs_name(/* is_runtime */ false)) {
1880  logical_values.emplace_back(RelLogicalValues::RowValues{});
1881  logical_values.back().emplace_back(genLiteralStr(name));
1882  }
1883  }
1884 
1885  // Create ResultSet
1886  std::shared_ptr<ResultSet> rSet = std::shared_ptr<ResultSet>(
1887  ResultSetLogicalValuesBuilder::create(label_infos, logical_values));
1888 
1889  return ExecutionResult(rSet, label_infos);
1890 }
static std::vector< ExtensionFunction > get_ext_funcs(const std::string &name)
auto getExecuteReadLock()
const DdlCommandData & ddl_data_
const rapidjson::Value & extractPayload(const DdlCommandData &ddl_data)
static std::unordered_set< std::string > get_udfs_name(const bool is_runtime)
std::unique_ptr< RexLiteral > genLiteralBoolean(bool val)
static ResultSet * create(std::vector< TargetMetaInfo > &label_infos, std::vector< RelLogicalValues::RowValues > &logical_values)
Definition: sqltypes.h:79
static std::unique_ptr< RexLiteral > genLiteralStr(std::string val)
Definition: DBHandler.cpp:7770
std::vector< std::unique_ptr< const RexScalar >> RowValues
Definition: RelAlgDag.h:2656
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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