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

#include <DdlCommandExecutor.h>

+ Inheritance diagram for ShowTableFunctionsCommand:
+ Collaboration diagram for ShowTableFunctionsCommand:

Public Member Functions

 ShowTableFunctionsCommand (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 201 of file DdlCommandExecutor.h.

Constructor & Destructor Documentation

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

Definition at line 1685 of file DdlCommandExecutor.cpp.

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

Member Function Documentation

ExecutionResult ShowTableFunctionsCommand::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 1690 of file DdlCommandExecutor.cpp.

References ResultSetLogicalValuesBuilder::create(), DdlCommand::ddl_data_, anonymous_namespace{DdlCommandExecutor.cpp}::extractPayload(), anonymous_namespace{DdlCommandExecutor.cpp}::genLiteralBoolean(), genLiteralStr(), table_functions::TableFunctionsFactory::get_table_funcs(), kBOOLEAN, kTEXT, run_benchmark_import::label, and setup::name.

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

1690  {
1691  // valid in read_only_mode
1692 
1693  // Get all table functions
1694  auto& ddl_payload = extractPayload(ddl_data_);
1695  std::vector<TargetMetaInfo> label_infos;
1696  std::vector<RelLogicalValues::RowValues> logical_values;
1697 
1698  if (ddl_payload.HasMember("tfNames")) {
1699  // label_infos -> column labels
1700  label_infos.emplace_back("name", SQLTypeInfo(kTEXT, true));
1701  label_infos.emplace_back("signature", SQLTypeInfo(kTEXT, true));
1702  label_infos.emplace_back("input_names", SQLTypeInfo(kTEXT, true));
1703  label_infos.emplace_back("input_types", SQLTypeInfo(kTEXT, true));
1704  label_infos.emplace_back("output_names", SQLTypeInfo(kTEXT, true));
1705  label_infos.emplace_back("output_types", SQLTypeInfo(kTEXT, true));
1706  label_infos.emplace_back("CPU", SQLTypeInfo(kBOOLEAN, true));
1707  label_infos.emplace_back("GPU", SQLTypeInfo(kBOOLEAN, true));
1708  label_infos.emplace_back("Runtime", SQLTypeInfo(kBOOLEAN, true));
1709  label_infos.emplace_back("filter_table_transpose", SQLTypeInfo(kBOOLEAN, true));
1710  // logical_values -> table data
1711  for (const auto& tf_name_json : ddl_payload["tfNames"].GetArray()) {
1712  std::string tf_name = tf_name_json.GetString();
1714  for (table_functions::TableFunction& tf : tfs) {
1715  logical_values.emplace_back(RelLogicalValues::RowValues{});
1716  // Name
1717  logical_values.back().emplace_back(genLiteralStr(tf.getName(true, false)));
1718  // Signature
1719  logical_values.back().emplace_back(genLiteralStr(
1720  tf.getSignature(/*include_name*/ false, /*include_output*/ true)));
1721  // Input argument names
1722  logical_values.back().emplace_back(
1723  genLiteralStr(tf.getArgNames(/* use_input_args */ true)));
1724  // Input argument types
1725  logical_values.back().emplace_back(
1726  genLiteralStr(tf.getArgTypes(/* use_input_args */ true)));
1727  // Output argument names
1728  logical_values.back().emplace_back(
1729  genLiteralStr(tf.getArgNames(/* use_input_args */ false)));
1730  // Output argument types
1731  logical_values.back().emplace_back(
1732  genLiteralStr(tf.getArgTypes(/* use_input_args */ false)));
1733  // CPU?
1734  logical_values.back().emplace_back(genLiteralBoolean(tf.isCPU()));
1735  // GPU?
1736  logical_values.back().emplace_back(genLiteralBoolean(tf.isGPU()));
1737  // Runtime?
1738  logical_values.back().emplace_back(genLiteralBoolean(tf.isRuntime()));
1739  // Implements filter_table_transpose?
1740  logical_values.back().emplace_back(genLiteralBoolean(
1741  !tf.getFunctionAnnotation("filter_table_function_transpose", "").empty()));
1742  }
1743  }
1744  } else {
1745  // label_infos -> column labels
1746  for (const auto& label : {"Table UDF"}) {
1747  label_infos.emplace_back(label, SQLTypeInfo(kTEXT, true));
1748  }
1749 
1750  // logical_values -> table data
1751  std::unordered_set<std::string> unique_names;
1753  /* is_runtime */ false)) {
1754  std::string name = tf.getName(true, true);
1755  if (unique_names.find(name) == unique_names.end()) {
1756  unique_names.emplace(name);
1757  logical_values.emplace_back(RelLogicalValues::RowValues{});
1758  logical_values.back().emplace_back(genLiteralStr(name));
1759  }
1760  }
1761  }
1762 
1763  // Create ResultSet
1764  std::shared_ptr<ResultSet> rSet = std::shared_ptr<ResultSet>(
1765  ResultSetLogicalValuesBuilder::create(label_infos, logical_values));
1766 
1767  return ExecutionResult(rSet, label_infos);
1768 }
static std::vector< TableFunction > get_table_funcs()
const DdlCommandData & ddl_data_
const rapidjson::Value & extractPayload(const DdlCommandData &ddl_data)
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: