OmniSciDB  a5dc49c757
 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 254 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 1922 of file DdlCommandExecutor.cpp.

1925  : 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 1927 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(), legacylockmgr::getExecuteReadLock(), kBOOLEAN, kTEXT, run_benchmark_import::label, and setup::name.

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

1927  {
1928  auto execute_read_lock = legacylockmgr::getExecuteReadLock();
1929 
1930  // valid in read_only_mode
1931 
1932  // Get all table functions
1933  auto& ddl_payload = extractPayload(ddl_data_);
1934  std::vector<TargetMetaInfo> label_infos;
1935  std::vector<RelLogicalValues::RowValues> logical_values;
1936 
1937  if (ddl_payload.HasMember("tfNames")) {
1938  // label_infos -> column labels
1939  label_infos.emplace_back("name", SQLTypeInfo(kTEXT, true));
1940  label_infos.emplace_back("signature", SQLTypeInfo(kTEXT, true));
1941  label_infos.emplace_back("input_names", SQLTypeInfo(kTEXT, true));
1942  label_infos.emplace_back("input_types", SQLTypeInfo(kTEXT, true));
1943  label_infos.emplace_back("input_arg_defaults", SQLTypeInfo(kTEXT, true));
1944  label_infos.emplace_back("output_names", SQLTypeInfo(kTEXT, true));
1945  label_infos.emplace_back("output_types", SQLTypeInfo(kTEXT, true));
1946  label_infos.emplace_back("CPU", SQLTypeInfo(kBOOLEAN, true));
1947  label_infos.emplace_back("GPU", SQLTypeInfo(kBOOLEAN, true));
1948  label_infos.emplace_back("Runtime", SQLTypeInfo(kBOOLEAN, true));
1949  label_infos.emplace_back("filter_table_transpose", SQLTypeInfo(kBOOLEAN, true));
1950  // logical_values -> table data
1951  for (const auto& tf_name_json : ddl_payload["tfNames"].GetArray()) {
1952  std::string tf_name = tf_name_json.GetString();
1954  for (table_functions::TableFunction& tf : tfs) {
1955  logical_values.emplace_back(RelLogicalValues::RowValues{});
1956  // Name
1957  logical_values.back().emplace_back(genLiteralStr(tf.getName(true, false)));
1958  // Signature
1959  logical_values.back().emplace_back(genLiteralStr(
1960  tf.getSignature(/*include_name*/ false, /*include_output*/ true)));
1961  // Input argument names
1962  logical_values.back().emplace_back(
1963  genLiteralStr(tf.getArgNames(/* use_input_args */ true)));
1964  // Input argument types
1965  logical_values.back().emplace_back(
1966  genLiteralStr(tf.getArgTypes(/* use_input_args */ true)));
1967  // Input argument default values
1968  logical_values.back().emplace_back(genLiteralStr(tf.getInputArgsDefaultValues()));
1969  // Output argument names
1970  logical_values.back().emplace_back(
1971  genLiteralStr(tf.getArgNames(/* use_input_args */ false)));
1972  // Output argument types
1973  logical_values.back().emplace_back(
1974  genLiteralStr(tf.getArgTypes(/* use_input_args */ false)));
1975  // CPU?
1976  logical_values.back().emplace_back(genLiteralBoolean(tf.isCPU()));
1977  // GPU?
1978  logical_values.back().emplace_back(genLiteralBoolean(tf.isGPU()));
1979  // Runtime?
1980  logical_values.back().emplace_back(genLiteralBoolean(tf.isRuntime()));
1981  // Implements filter_table_transpose?
1982  logical_values.back().emplace_back(genLiteralBoolean(
1983  !tf.getFunctionAnnotation("filter_table_function_transpose", "").empty()));
1984  }
1985  }
1986  } else {
1987  // label_infos -> column labels
1988  for (const auto& label : {"Table UDF"}) {
1989  label_infos.emplace_back(label, SQLTypeInfo(kTEXT, true));
1990  }
1991 
1992  // logical_values -> table data
1993  std::unordered_set<std::string> unique_names;
1995  /* is_runtime */ false)) {
1996  std::string name = tf.getName(true, true);
1997  if (unique_names.find(name) == unique_names.end()) {
1998  unique_names.emplace(name);
1999  logical_values.emplace_back(RelLogicalValues::RowValues{});
2000  logical_values.back().emplace_back(genLiteralStr(name));
2001  }
2002  }
2003  }
2004 
2005  // Create ResultSet
2006  std::shared_ptr<ResultSet> rSet = std::shared_ptr<ResultSet>(
2007  ResultSetLogicalValuesBuilder::create(label_infos, logical_values));
2008 
2009  return ExecutionResult(rSet, label_infos);
2010 }
static std::vector< TableFunction > get_table_funcs()
auto getExecuteReadLock()
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: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: