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

#include <DdlCommandExecutor.h>

+ Collaboration diagram for DdlCommandExecutor:

Public Member Functions

 DdlCommandExecutor (const std::string &ddl_statement, std::shared_ptr< Catalog_Namespace::SessionInfo const > session_ptr)
 
ExecutionResult execute (bool read_only_mode)
 
bool isShowUserSessions () const
 
bool isShowQueries () const
 
bool isKillQuery () const
 
bool isAlterSystemClear () const
 
bool isAlterSessionSet () const
 
std::string returnCacheType () const
 
bool isAlterSystemControlExecutorQueue () const
 
std::string returnQueueAction () const
 
const std::string getTargetQuerySessionToKill () const
 
DistributedExecutionDetails getDistributedExecutionDetails () const
 
const std::string commandStr () const
 
std::pair< std::string,
std::string > 
getSessionParameter () const
 

Private Attributes

std::string ddl_statement_
 
std::string ddl_command_
 
std::unique_ptr< DdlCommandDataddl_data_
 
std::shared_ptr
< Catalog_Namespace::SessionInfo
const > 
session_ptr_
 

Detailed Description

Definition at line 420 of file DdlCommandExecutor.h.

Constructor & Destructor Documentation

DdlCommandExecutor::DdlCommandExecutor ( const std::string &  ddl_statement,
std::shared_ptr< Catalog_Namespace::SessionInfo const >  session_ptr 
)

Definition at line 502 of file DdlCommandExecutor.cpp.

References CHECK, ddl_command_, ddl_data_, ddl_statement_, and VLOG.

505  : session_ptr_(session_ptr) {
506  CHECK(!ddl_statement.empty());
507  ddl_statement_ = ddl_statement;
508 
509  // parse the incoming query,
510  // cache the parsed rapidjson object inside a DdlCommandDataImpl
511  // store the "abstract/base class" reference in ddl_data_
512  DdlCommandDataImpl* ddl_query_data = new DdlCommandDataImpl(ddl_statement);
513  ddl_data_ = std::unique_ptr<DdlCommandData>(ddl_query_data);
514 
515  VLOG(2) << "Parsing JSON DDL from Calcite: " << ddl_statement;
516  auto& ddl_query = ddl_query_data->query();
517  CHECK(ddl_query.IsObject()) << ddl_statement;
518  CHECK(ddl_query.HasMember("payload"));
519  CHECK(ddl_query["payload"].IsObject());
520  const auto& payload = ddl_query["payload"].GetObject();
521  CHECK(payload.HasMember("command"));
522  CHECK(payload["command"].IsString());
523  ddl_command_ = payload["command"].GetString();
524 }
std::unique_ptr< DdlCommandData > ddl_data_
std::shared_ptr< Catalog_Namespace::SessionInfo const > session_ptr_
#define CHECK(condition)
Definition: Logger.h:291
#define VLOG(n)
Definition: Logger.h:388

Member Function Documentation

const std::string DdlCommandExecutor::commandStr ( ) const

Returns command string, can be useful for logging, conversion

Definition at line 838 of file DdlCommandExecutor.cpp.

References ddl_command_.

Referenced by DBHandler::executeDdl().

838  {
839  return ddl_command_;
840 }

+ Here is the caller graph for this function:

ExecutionResult DdlCommandExecutor::execute ( bool  read_only_mode)

Parses given JSON string and routes resulting payload to appropriate DDL command class for execution.

Parameters
returnExecutionResult of DDL command execution (if applicable)

Definition at line 526 of file DdlCommandExecutor.cpp.

References ddl_command_, ddl_data_, anonymous_namespace{DdlCommandExecutor.cpp}::extractPayload(), run_benchmark_import::result, session_ptr_, and UNREACHABLE.

Referenced by DBHandler::executeDdl(), heavydb.cursor.Cursor::executemany(), and QueryRunner::QueryRunner::runDDLStatement().

526  {
528 
529  // the following commands use parser node locking to ensure safe concurrent access
530  if (ddl_command_ == "CREATE_TABLE") {
531  auto create_table_stmt = Parser::CreateTableStmt(extractPayload(*ddl_data_));
532  create_table_stmt.execute(*session_ptr_, read_only_mode);
533  return result;
534  } else if (ddl_command_ == "CREATE_VIEW") {
535  auto create_view_stmt = Parser::CreateViewStmt(extractPayload(*ddl_data_));
536  create_view_stmt.execute(*session_ptr_, read_only_mode);
537  return result;
538  } else if (ddl_command_ == "DROP_TABLE") {
539  auto drop_table_stmt = Parser::DropTableStmt(extractPayload(*ddl_data_));
540  drop_table_stmt.execute(*session_ptr_, read_only_mode);
541  return result;
542  } else if (ddl_command_ == "DROP_VIEW") {
543  auto drop_view_stmt = Parser::DropViewStmt(extractPayload(*ddl_data_));
544  drop_view_stmt.execute(*session_ptr_, read_only_mode);
545  return result;
546  } else if (ddl_command_ == "RENAME_TABLE") {
547  auto rename_table_stmt = Parser::RenameTableStmt(extractPayload(*ddl_data_));
548  rename_table_stmt.execute(*session_ptr_, read_only_mode);
549  return result;
550  } else if (ddl_command_ == "ALTER_TABLE") {
551  // ALTER TABLE uses the parser node locking partially as well as the global locking
552  // scheme for some cases
553  return AlterTableCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
554  } else if (ddl_command_ == "TRUNCATE_TABLE") {
555  auto truncate_table_stmt = Parser::TruncateTableStmt(extractPayload(*ddl_data_));
556  truncate_table_stmt.execute(*session_ptr_, read_only_mode);
557  return result;
558  } else if (ddl_command_ == "DUMP_TABLE") {
559  auto dump_table_stmt = Parser::DumpTableStmt(extractPayload(*ddl_data_));
560  dump_table_stmt.execute(*session_ptr_, read_only_mode);
561  return result;
562  } else if (ddl_command_ == "RESTORE_TABLE") {
563  auto restore_table_stmt = Parser::RestoreTableStmt(extractPayload(*ddl_data_));
564  restore_table_stmt.execute(*session_ptr_, read_only_mode);
565  return result;
566  } else if (ddl_command_ == "OPTIMIZE_TABLE") {
567  auto optimize_table_stmt = Parser::OptimizeTableStmt(extractPayload(*ddl_data_));
568  optimize_table_stmt.execute(*session_ptr_, read_only_mode);
569  return result;
570  } else if (ddl_command_ == "COPY_TABLE") {
571  auto copy_table_stmt = Parser::CopyTableStmt(extractPayload(*ddl_data_));
572  copy_table_stmt.execute(*session_ptr_, read_only_mode);
573  return result;
574  } else if (ddl_command_ == "EXPORT_QUERY") {
575  auto export_query_stmt = Parser::ExportQueryStmt(extractPayload(*ddl_data_));
576  export_query_stmt.execute(*session_ptr_, read_only_mode);
577  return result;
578  } else if (ddl_command_ == "CREATE_DB") {
579  auto create_db_stmt = Parser::CreateDBStmt(extractPayload(*ddl_data_));
580  create_db_stmt.execute(*session_ptr_, read_only_mode);
581  return result;
582  } else if (ddl_command_ == "DROP_DB") {
583  auto drop_db_stmt = Parser::DropDBStmt(extractPayload(*ddl_data_));
584  drop_db_stmt.execute(*session_ptr_, read_only_mode);
585  return result;
586  } else if (ddl_command_ == "CREATE_USER") {
587  auto create_user_stmt = Parser::CreateUserStmt(extractPayload(*ddl_data_));
588  create_user_stmt.execute(*session_ptr_, read_only_mode);
589  return result;
590  } else if (ddl_command_ == "DROP_USER") {
591  auto drop_user_stmt = Parser::DropUserStmt(extractPayload(*ddl_data_));
592  drop_user_stmt.execute(*session_ptr_, read_only_mode);
593  return result;
594  } else if (ddl_command_ == "ALTER_USER") {
595  auto alter_user_stmt = Parser::AlterUserStmt(extractPayload(*ddl_data_));
596  alter_user_stmt.execute(*session_ptr_, read_only_mode);
597  return result;
598  } else if (ddl_command_ == "RENAME_USER") {
599  auto rename_user_stmt = Parser::RenameUserStmt(extractPayload(*ddl_data_));
600  rename_user_stmt.execute(*session_ptr_, read_only_mode);
601  return result;
602  } else if (ddl_command_ == "CREATE_ROLE") {
603  auto create_role_stmt = Parser::CreateRoleStmt(extractPayload(*ddl_data_));
604  create_role_stmt.execute(*session_ptr_, read_only_mode);
605  return result;
606  } else if (ddl_command_ == "DROP_ROLE") {
607  auto drop_role_stmt = Parser::DropRoleStmt(extractPayload(*ddl_data_));
608  drop_role_stmt.execute(*session_ptr_, read_only_mode);
609  return result;
610  } else if (ddl_command_ == "GRANT_ROLE") {
611  auto grant_role_stmt = Parser::GrantRoleStmt(extractPayload(*ddl_data_));
612  grant_role_stmt.execute(*session_ptr_, read_only_mode);
613  return result;
614  } else if (ddl_command_ == "REVOKE_ROLE") {
615  auto revoke_role_stmt = Parser::RevokeRoleStmt(extractPayload(*ddl_data_));
616  revoke_role_stmt.execute(*session_ptr_, read_only_mode);
617  return result;
618  } else if (ddl_command_ == "GRANT_PRIVILEGE") {
619  auto grant_privilege_stmt = Parser::GrantPrivilegesStmt(extractPayload(*ddl_data_));
620  grant_privilege_stmt.execute(*session_ptr_, read_only_mode);
621  return result;
622  } else if (ddl_command_ == "REVOKE_PRIVILEGE") {
623  auto revoke_privileges_stmt =
625  revoke_privileges_stmt.execute(*session_ptr_, read_only_mode);
626  return result;
627  } else if (ddl_command_ == "CREATE_DATAFRAME") {
628  auto create_dataframe_stmt = Parser::CreateDataframeStmt(extractPayload(*ddl_data_));
629  create_dataframe_stmt.execute(*session_ptr_, read_only_mode);
630  return result;
631  } else if (ddl_command_ == "CREATE_MODEL") {
632  auto create_model_stmt = Parser::CreateModelStmt(extractPayload(*ddl_data_));
633  create_model_stmt.execute(*session_ptr_, read_only_mode);
634  return result;
635  } else if (ddl_command_ == "DROP_MODEL") {
636  auto drop_model_stmt = Parser::DropModelStmt(extractPayload(*ddl_data_));
637  drop_model_stmt.execute(*session_ptr_, read_only_mode);
638  return result;
639  } else if (ddl_command_ == "EVALUATE_MODEL") {
640  result = EvaluateModelCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
641  } else if (ddl_command_ == "VALIDATE_SYSTEM") {
642  // VALIDATE should have been excuted in outer context before it reaches here
643  UNREACHABLE();
644  } else if (ddl_command_ == "REFRESH_FOREIGN_TABLES") {
645  result =
646  RefreshForeignTablesCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
647  return result;
648  } else if (ddl_command_ == "CREATE_SERVER") {
649  result = CreateForeignServerCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
650  } else if (ddl_command_ == "DROP_SERVER") {
651  result = DropForeignServerCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
652  } else if (ddl_command_ == "CREATE_FOREIGN_TABLE") {
653  result = CreateForeignTableCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
654  } else if (ddl_command_ == "DROP_FOREIGN_TABLE") {
655  result = DropForeignTableCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
656  } else if (ddl_command_ == "SHOW_TABLES") {
657  result = ShowTablesCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
658  } else if (ddl_command_ == "SHOW_TABLE_DETAILS") {
659  result = ShowTableDetailsCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
660  } else if (ddl_command_ == "SHOW_CREATE_TABLE") {
661  result = ShowCreateTableCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
662  } else if (ddl_command_ == "SHOW_DATABASES") {
663  result = ShowDatabasesCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
664  } else if (ddl_command_ == "SHOW_SERVERS") {
665  result = ShowForeignServersCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
666  } else if (ddl_command_ == "SHOW_CREATE_SERVER") {
667  result = ShowCreateServerCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
668  } else if (ddl_command_ == "SHOW_FUNCTIONS") {
669  result = ShowFunctionsCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
670  } else if (ddl_command_ == "SHOW_RUNTIME_FUNCTIONS") {
671  result =
672  ShowRuntimeFunctionsCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
673  } else if (ddl_command_ == "SHOW_TABLE_FUNCTIONS") {
674  result = ShowTableFunctionsCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
675  } else if (ddl_command_ == "SHOW_RUNTIME_TABLE_FUNCTIONS") {
677  read_only_mode);
678  } else if (ddl_command_ == "SHOW_MODELS") {
679  result = ShowModelsCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
680  } else if (ddl_command_ == "SHOW_MODEL_DETAILS") {
681  result = ShowModelDetailsCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
682  } else if (ddl_command_ == "SHOW_MODEL_FEATURE_DETAILS") {
683  result =
684  ShowModelFeatureDetailsCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
685  } else if (ddl_command_ == "ALTER_SERVER") {
686  result = AlterForeignServerCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
687  } else if (ddl_command_ == "ALTER_DATABASE") {
688  result = AlterDatabaseCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
689  } else if (ddl_command_ == "ALTER_FOREIGN_TABLE") {
690  result = AlterForeignTableCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
691  } else if (ddl_command_ == "SHOW_DISK_CACHE_USAGE") {
692  result = ShowDiskCacheUsageCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
693  } else if (ddl_command_ == "SHOW_USER_DETAILS") {
694  result = ShowUserDetailsCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
695  } else if (ddl_command_ == "SHOW_ROLES") {
696  result = ShowRolesCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
697  } else if (ddl_command_ == "REASSIGN_OWNED") {
698  result = ReassignOwnedCommand{*ddl_data_, session_ptr_}.execute(read_only_mode);
699  } else {
700  throw std::runtime_error("Unsupported DDL command");
701  }
702 
703  return result;
704 }
std::unique_ptr< DdlCommandData > ddl_data_
#define UNREACHABLE()
Definition: Logger.h:338
const rapidjson::Value & extractPayload(const DdlCommandData &ddl_data)
std::shared_ptr< Catalog_Namespace::SessionInfo const > session_ptr_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DistributedExecutionDetails DdlCommandExecutor::getDistributedExecutionDetails ( ) const

Returns an object indicating where command execution should take place and how results should be aggregated for distributed setups.

Definition at line 773 of file DdlCommandExecutor.cpp.

References DistributedExecutionDetails::aggregation_type, AGGREGATOR_ONLY, ALL_NODES, CHECK, ddl_command_, ddl_data_, DistributedExecutionDetails::execution_location, anonymous_namespace{DdlCommandExecutor.cpp}::extractPayload(), LEAVES_ONLY, NONE, and UNION.

773  {
774  DistributedExecutionDetails execution_details;
775  if (ddl_command_ == "CREATE_DATAFRAME" || ddl_command_ == "RENAME_TABLE" ||
776  ddl_command_ == "ALTER_TABLE" || ddl_command_ == "CREATE_TABLE" ||
777  ddl_command_ == "DROP_TABLE" || ddl_command_ == "TRUNCATE_TABLE" ||
778  ddl_command_ == "DUMP_TABLE" || ddl_command_ == "RESTORE_TABLE" ||
779  ddl_command_ == "OPTIMIZE_TABLE" || ddl_command_ == "CREATE_VIEW" ||
780  ddl_command_ == "DROP_VIEW" || ddl_command_ == "CREATE_DB" ||
781  ddl_command_ == "DROP_DB" || ddl_command_ == "ALTER_DATABASE" ||
782  ddl_command_ == "CREATE_USER" || ddl_command_ == "DROP_USER" ||
783  ddl_command_ == "ALTER_USER" || ddl_command_ == "RENAME_USER" ||
784  ddl_command_ == "CREATE_ROLE" || ddl_command_ == "DROP_ROLE" ||
785  ddl_command_ == "GRANT_ROLE" || ddl_command_ == "REVOKE_ROLE" ||
786  ddl_command_ == "REASSIGN_OWNED" || ddl_command_ == "CREATE_POLICY" ||
787  ddl_command_ == "DROP_POLICY" || ddl_command_ == "CREATE_SERVER" ||
788  ddl_command_ == "DROP_SERVER" || ddl_command_ == "CREATE_FOREIGN_TABLE" ||
789  ddl_command_ == "DROP_FOREIGN_TABLE" || ddl_command_ == "CREATE_USER_MAPPING" ||
790  ddl_command_ == "DROP_USER_MAPPING" || ddl_command_ == "ALTER_FOREIGN_TABLE" ||
791  ddl_command_ == "ALTER_SERVER" || ddl_command_ == "REFRESH_FOREIGN_TABLES" ||
792  ddl_command_ == "ALTER_SYSTEM_CLEAR") {
793  // group user/role/db commands
795  execution_details.aggregation_type = AggregationType::NONE;
796  } else if (ddl_command_ == "GRANT_PRIVILEGE" || ddl_command_ == "REVOKE_PRIVILEGE") {
797  auto& ddl_payload = extractPayload(*ddl_data_);
798  CHECK(ddl_payload.HasMember("type"));
799  const std::string& targetType = ddl_payload["type"].GetString();
800  if (targetType == "DASHBOARD") {
801  // dashboard commands should run on Aggregator alone
803  execution_details.aggregation_type = AggregationType::NONE;
804  } else {
806  execution_details.aggregation_type = AggregationType::NONE;
807  }
808 
809  } else if (ddl_command_ == "SHOW_TABLE_DETAILS" ||
810  ddl_command_ == "SHOW_DISK_CACHE_USAGE") {
812  execution_details.aggregation_type = AggregationType::UNION;
813  } else {
814  // Commands that fall here : COPY_TABLE, EXPORT_QUERY, etc.
816  execution_details.aggregation_type = AggregationType::NONE;
817  }
818  return execution_details;
819 }
std::unique_ptr< DdlCommandData > ddl_data_
const rapidjson::Value & extractPayload(const DdlCommandData &ddl_data)
#define CHECK(condition)
Definition: Logger.h:291
ExecutionLocation execution_location

+ Here is the call graph for this function:

std::pair< std::string, std::string > DdlCommandExecutor::getSessionParameter ( ) const

Returns name and value of a Session parameter

Definition at line 726 of file DdlCommandExecutor.cpp.

References CHECK, ddl_data_, anonymous_namespace{DdlCommandExecutor.cpp}::extractPayload(), and to_upper().

Referenced by DBHandler::executeDdl().

726  {
727  enum SetParameterType { String_t, Numeric_t };
728  static const std::unordered_map<std::string, SetParameterType>
729  session_set_parameters_map = {{"EXECUTOR_DEVICE", SetParameterType::String_t},
730  {"CURRENT_DATABASE", SetParameterType::String_t}};
731 
732  auto& ddl_payload = extractPayload(*ddl_data_);
733  CHECK(ddl_payload.HasMember("sessionParameter"));
734  CHECK(ddl_payload["sessionParameter"].IsString());
735  CHECK(ddl_payload.HasMember("parameterValue"));
736  CHECK(ddl_payload["parameterValue"].IsString());
737  std::string parameter_name = to_upper(ddl_payload["sessionParameter"].GetString());
738  std::string parameter_value = ddl_payload["parameterValue"].GetString();
739 
740  const auto param_it = session_set_parameters_map.find(parameter_name);
741  if (param_it == session_set_parameters_map.end()) {
742  throw std::runtime_error(parameter_name + " is not a settable session parameter.");
743  }
744  if (param_it->second == SetParameterType::Numeric_t) {
745  if (!std::regex_match(parameter_value, std::regex("[(-|+)|][0-9]+"))) {
746  throw std::runtime_error("The value of session parameter " + param_it->first +
747  " should be a numeric.");
748  }
749  }
750  return {parameter_name, parameter_value};
751 }
std::unique_ptr< DdlCommandData > ddl_data_
const rapidjson::Value & extractPayload(const DdlCommandData &ddl_data)
std::string to_upper(const std::string &str)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const std::string DdlCommandExecutor::getTargetQuerySessionToKill ( ) const

Returns target query session if this command is KILL QUERY

Definition at line 821 of file DdlCommandExecutor.cpp.

References CHECK, ddl_data_, anonymous_namespace{DdlCommandExecutor.cpp}::extractPayload(), and isKillQuery().

Referenced by DBHandler::executeDdl().

821  {
822  // caller should check whether DDL indicates KillQuery request
823  // i.e., use isKillQuery() before calling this function
824  auto& ddl_payload = extractPayload(*ddl_data_);
825  CHECK(isKillQuery());
826  CHECK(ddl_payload.HasMember("querySession"));
827  const std::string& query_session = ddl_payload["querySession"].GetString();
828  // regex matcher for public_session: start_time{3}-session_id{4} (Example:819-4RDo)
829  boost::regex session_id_regex{R"([0-9]{3}-[a-zA-Z0-9]{4})",
830  boost::regex::extended | boost::regex::icase};
831  if (!boost::regex_match(query_session, session_id_regex)) {
832  throw std::runtime_error(
833  "Please provide the correct session ID of the query that you want to interrupt.");
834  }
835  return query_session;
836 }
std::unique_ptr< DdlCommandData > ddl_data_
const rapidjson::Value & extractPayload(const DdlCommandData &ddl_data)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool DdlCommandExecutor::isAlterSessionSet ( ) const

Returns true if this command is ALTER SESSION SET

Definition at line 722 of file DdlCommandExecutor.cpp.

References ddl_command_.

Referenced by DBHandler::executeDdl().

722  {
723  return (ddl_command_ == "ALTER_SESSION_SET");
724 }

+ Here is the caller graph for this function:

bool DdlCommandExecutor::isAlterSystemClear ( ) const

Returns true if this command is ALTER SYSTEM CLEAR

Definition at line 718 of file DdlCommandExecutor.cpp.

References ddl_command_.

Referenced by DBHandler::executeDdl().

718  {
719  return (ddl_command_ == "ALTER_SYSTEM_CLEAR");
720 }

+ Here is the caller graph for this function:

bool DdlCommandExecutor::isAlterSystemControlExecutorQueue ( ) const

Returns true if this command is ALTER SYSTEM PAUSE|RESUME EXECUTOR QUEUE

Definition at line 761 of file DdlCommandExecutor.cpp.

References ddl_command_.

Referenced by DBHandler::executeDdl().

761  {
762  return (ddl_command_ == "ALTER_SYSTEM_CONTROL_EXECUTOR_QUEUE");
763 }

+ Here is the caller graph for this function:

bool DdlCommandExecutor::isKillQuery ( ) const

Returns true if this command is KILL QUERY

Definition at line 714 of file DdlCommandExecutor.cpp.

References ddl_command_.

Referenced by DBHandler::executeDdl(), and getTargetQuerySessionToKill().

714  {
715  return (ddl_command_ == "KILL_QUERY");
716 }

+ Here is the caller graph for this function:

bool DdlCommandExecutor::isShowQueries ( ) const

Returns true if this command is SHOW QUERIES

Definition at line 710 of file DdlCommandExecutor.cpp.

References ddl_command_.

Referenced by DBHandler::executeDdl().

710  {
711  return (ddl_command_ == "SHOW_QUERIES");
712 }

+ Here is the caller graph for this function:

bool DdlCommandExecutor::isShowUserSessions ( ) const

Returns true if this command is SHOW USER SESSIONS

Definition at line 706 of file DdlCommandExecutor.cpp.

References ddl_command_.

Referenced by DBHandler::executeDdl().

706  {
707  return (ddl_command_ == "SHOW_USER_SESSIONS");
708 }

+ Here is the caller graph for this function:

std::string DdlCommandExecutor::returnCacheType ( ) const

Returns which kind of caches to clear if ALTER SYSTEM CLEAR

Definition at line 753 of file DdlCommandExecutor.cpp.

References CHECK, ddl_command_, ddl_data_, and anonymous_namespace{DdlCommandExecutor.cpp}::extractPayload().

Referenced by DBHandler::executeDdl().

753  {
754  CHECK(ddl_command_ == "ALTER_SYSTEM_CLEAR");
755  auto& ddl_payload = extractPayload(*ddl_data_);
756  CHECK(ddl_payload.HasMember("cacheType"));
757  CHECK(ddl_payload["cacheType"].IsString());
758  return ddl_payload["cacheType"].GetString();
759 }
std::unique_ptr< DdlCommandData > ddl_data_
const rapidjson::Value & extractPayload(const DdlCommandData &ddl_data)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string DdlCommandExecutor::returnQueueAction ( ) const

Returns whether PAUSE or RESUME request has been delivered to ALTER SYSTEM <CONTROL> EXECUTOR qUEUE

Definition at line 765 of file DdlCommandExecutor.cpp.

References CHECK, ddl_command_, ddl_data_, and anonymous_namespace{DdlCommandExecutor.cpp}::extractPayload().

Referenced by DBHandler::executeDdl().

765  {
766  CHECK(ddl_command_ == "ALTER_SYSTEM_CONTROL_EXECUTOR_QUEUE");
767  auto& ddl_payload = extractPayload(*ddl_data_);
768  CHECK(ddl_payload.HasMember("queueAction"));
769  CHECK(ddl_payload["queueAction"].IsString());
770  return ddl_payload["queueAction"].GetString();
771 }
std::unique_ptr< DdlCommandData > ddl_data_
const rapidjson::Value & extractPayload(const DdlCommandData &ddl_data)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

std::string DdlCommandExecutor::ddl_statement_
private

Definition at line 497 of file DdlCommandExecutor.h.

Referenced by DdlCommandExecutor().

std::shared_ptr<Catalog_Namespace::SessionInfo const> DdlCommandExecutor::session_ptr_
private

Definition at line 500 of file DdlCommandExecutor.h.

Referenced by execute().


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