OmniSciDB  c0231cc57d
 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 184 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 1599 of file DdlCommandExecutor.cpp.

1602  : 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 1604 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(), kBOOLEAN, kTEXT, run_benchmark_import::label, and setup::name.

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

1604  {
1605  // Get all row-wise functions
1606  auto& ddl_payload = extractPayload(ddl_data_);
1607  std::vector<TargetMetaInfo> label_infos;
1608  std::vector<RelLogicalValues::RowValues> logical_values;
1609 
1610  if (ddl_payload.HasMember("ScalarFnNames")) {
1611  // label_infos -> column labels
1612  label_infos.emplace_back("name", SQLTypeInfo(kTEXT, true));
1613  label_infos.emplace_back("signature", SQLTypeInfo(kTEXT, true));
1614  label_infos.emplace_back("CPU", SQLTypeInfo(kBOOLEAN, true));
1615  label_infos.emplace_back("GPU", SQLTypeInfo(kBOOLEAN, true));
1616  label_infos.emplace_back("Runtime", SQLTypeInfo(kBOOLEAN, true));
1617  for (const auto& udf_name_json : ddl_payload["ScalarFnNames"].GetArray()) {
1618  std::string udf_name = udf_name_json.GetString();
1619  std::vector<ExtensionFunction> ext_funcs =
1621 
1622  for (ExtensionFunction& fn : ext_funcs) {
1623  logical_values.emplace_back(RelLogicalValues::RowValues{});
1624  // Name
1625  logical_values.back().emplace_back(genLiteralStr(udf_name));
1626  // Signature
1627  logical_values.back().emplace_back(genLiteralStr(fn.toSignature()));
1628  // CPU?
1629  logical_values.back().emplace_back(genLiteralBoolean(fn.isCPU()));
1630  // GPU?
1631  logical_values.back().emplace_back(genLiteralBoolean(fn.isGPU()));
1632  // Runtime?
1633  logical_values.back().emplace_back(genLiteralBoolean(fn.isRuntime()));
1634  }
1635  }
1636 
1637  } else {
1638  // label_infos -> column labels
1639  for (const auto& label : {"Scalar UDF"}) {
1640  label_infos.emplace_back(label, SQLTypeInfo(kTEXT, true));
1641  }
1642 
1643  // logical_values -> table data
1644  for (auto name : ExtensionFunctionsWhitelist::get_udfs_name(/* is_runtime */ false)) {
1645  logical_values.emplace_back(RelLogicalValues::RowValues{});
1646  logical_values.back().emplace_back(genLiteralStr(name));
1647  }
1648  }
1649 
1650  // Create ResultSet
1651  std::shared_ptr<ResultSet> rSet = std::shared_ptr<ResultSet>(
1652  ResultSetLogicalValuesBuilder::create(label_infos, logical_values));
1653 
1654  return ExecutionResult(rSet, label_infos);
1655 }
static std::vector< ExtensionFunction > get_ext_funcs(const std::string &name)
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:66
static std::unique_ptr< RexLiteral > genLiteralStr(std::string val)
Definition: DBHandler.cpp:7263
std::vector< std::unique_ptr< const RexScalar >> RowValues
Definition: RelAlgDag.h:2226
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: