diff --git a/ydb/core/driver_lib/cli_utils/cli.cpp b/ydb/core/driver_lib/cli_utils/cli.cpp index f84f6784df03..d53ae4ef94d0 100644 --- a/ydb/core/driver_lib/cli_utils/cli.cpp +++ b/ydb/core/driver_lib/cli_utils/cli.cpp @@ -4,15 +4,6 @@ namespace NKikimr { namespace NDriverClient { -void DumpProxyErrorCodes(IOutputStream &o, const NKikimrClient::TResponse &response) { - o << "status: " << response.GetStatus() << Endl; - o << "status transcript: " << static_cast(response.GetStatus()) << Endl; - if (response.HasProxyErrorCode()) { - o << "proxy error code: " << response.GetProxyErrorCode() << Endl; - o << "proxy error code transcript: " << static_cast(response.GetProxyErrorCode()) << Endl; - } -} - void HideOptions(NLastGetopt::TOpts& opts, const TString& prefix) { for (auto opt : opts.Opts_) { if (opt.Get()->GetName().StartsWith(prefix)) { diff --git a/ydb/core/driver_lib/cli_utils/cli.h b/ydb/core/driver_lib/cli_utils/cli.h index 36d9cf929991..7b0cb56841c4 100644 --- a/ydb/core/driver_lib/cli_utils/cli.h +++ b/ydb/core/driver_lib/cli_utils/cli.h @@ -22,12 +22,7 @@ namespace NKikimr { namespace NDriverClient { - - void DumpProxyErrorCodes(IOutputStream &o, const NKikimrClient::TResponse &response); - void DumpSchemeErrorCode(IOutputStream &o, const NKikimrClient::TResponse &response); - int SchemeInitRoot(TCommandConfig &cmdConf, int argc, char** argv); - int CompileAndExecMiniKQL(TCommandConfig &cmdConf, int argc, char **argv); int KeyValueRequest(TCommandConfig &cmdConf, int argc, char **argv); int PersQueueRequest(TCommandConfig &cmdConf, int argc, char **argv); int PersQueueStress(TCommandConfig &cmdConf, int argc, char **argv); diff --git a/ydb/core/driver_lib/cli_utils/cli_minikql_compile_and_exec.cpp b/ydb/core/driver_lib/cli_utils/cli_minikql_compile_and_exec.cpp deleted file mode 100644 index 118766d50183..000000000000 --- a/ydb/core/driver_lib/cli_utils/cli_minikql_compile_and_exec.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include "cli.h" - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace NKikimr { -namespace NDriverClient { - -using namespace NYql; - -struct TCmdCompileAndExecMiniKQLConfig : public TCliCmdConfig { - TCmdCompileAndExecMiniKQLConfig(); - - void Parse(int argc, char **argv); - - TString PathToTextPgm; - TString PathToBinPgm; - - TString PathToTextParams; - TString PathToBinParams; -}; - -int CompileAndExecMiniKQL(TCommandConfig &cmdConf, int argc, char **argv) { - Y_UNUSED(cmdConf); - -#ifdef _win32_ - WSADATA dummy; - WSAStartup(MAKEWORD(2, 2), &dummy); -#endif - - TCmdCompileAndExecMiniKQLConfig config; - config.Parse(argc, argv); - - auto functionRegistry = NMiniKQL::CreateFunctionRegistry(NMiniKQL::CreateBuiltinRegistry()); - TAlignedPagePoolCounters countersStub; - NMiniKQL::TScopedAlloc alloc(__LOCATION__, countersStub); - NMiniKQL::TTypeEnvironment TypeEnv(alloc); - - TAutoPtr request(new NMsgBusProxy::TBusRequest()); - - auto* mkqlTx = request->Record.MutableTransaction()->MutableMiniKQLTransaction(); - if (config.PathToBinPgm) { - TString pgmBin = TFileInput(config.PathToBinPgm).ReadAll(); - mkqlTx->MutableProgram()->SetBin(pgmBin); - } else if (config.PathToTextPgm) { - TString pgmText = TFileInput(config.PathToTextPgm).ReadAll(); - mkqlTx->MutableProgram()->SetText(pgmText); - } - - if (config.PathToBinParams) { - TString paramsBin = TFileInput(config.PathToBinParams).ReadAll(); - mkqlTx->MutableParams()->SetBin(paramsBin); - } else if (config.PathToTextParams) { - TString paramsText = TFileInput(config.PathToTextParams).ReadAll(); - mkqlTx->MutableParams()->SetText(paramsText); - } - - mkqlTx->SetFlatMKQL(true); - - TAutoPtr reply; - NBus::EMessageStatus msgStatus = config.SyncCall(request, reply); - - if (msgStatus != NBus::MESSAGE_OK) { - Cerr << "Can't send request, msgstatus=" << msgStatus << ".\n"; - return 1; - } - const NKikimrClient::TResponse& response = static_cast(reply.Get())->Record; - - auto txRes = response.GetMiniKQLCompileResults(); - - if (txRes.ProgramCompileErrorsSize() > 0) { - TIssues errors; - NYql::IssuesFromMessage(txRes.GetProgramCompileErrors(), errors); - Cerr << "Program compile errors:\n"; - if (config.PathToBinPgm) { - errors.PrintTo(Cerr); - } else { - const TString pgmText = TFileInput(config.PathToTextPgm).ReadAll(); - errors.PrintWithProgramTo(Cerr, config.PathToTextPgm, pgmText); - } - } - - if (txRes.ParamsCompileErrorsSize() > 0) { - TIssues errors; - NYql::IssuesFromMessage(txRes.GetParamsCompileErrors(), errors); - Cerr << "Params compile errors:\n"; - if (config.PathToBinParams) { - errors.PrintTo(Cerr); - } else { - const TString paramsText = TFileInput(config.PathToTextParams).ReadAll(); - errors.PrintWithProgramTo(Cerr, config.PathToTextParams, paramsText); - } - } - - - if (!response.GetDataShardErrors().empty()) { - Cerr << "DataShard errors:\n " << response.GetDataShardErrors() << Endl; - } - if (!response.GetMiniKQLErrors().empty()) { - Cerr << "MiniKQL errors:\n" << response.GetMiniKQLErrors() << Endl; - } - if (response.HasProxyErrorCode()) { - Cerr << "Proxy status: " << static_cast(response.GetProxyErrorCode()) << Endl; - } - if (response.HasProxyErrors()) { - Cerr << "Proxy errors: " << response.GetProxyErrors() << Endl; - } - if (response.UnresolvedKeysSize() > 0) { - for (size_t i = 0, end = response.UnresolvedKeysSize(); i < end; ++i) { - Cerr << response.GetUnresolvedKeys(i) << Endl; - } - } - if ((ui32) NMsgBusProxy::MSTATUS_OK != response.GetStatus()) { - Cerr << "Bad Response status: " << (NMsgBusProxy::EResponseStatus) response.GetStatus() << Endl; - return 1; - } - - auto execEngineStatus = static_cast(response.GetExecutionEngineResponseStatus()); - Cerr << "ExecutionEngineResponse status: " << (ui32) execEngineStatus << Endl; - if (execEngineStatus != NMiniKQL::IEngineFlat::EStatus::Complete - && execEngineStatus != NMiniKQL::IEngineFlat::EStatus::Aborted) - { - return 1; - } - const auto& evaluatedResp = response.GetExecutionEngineEvaluatedResponse(); - Cout << evaluatedResp.DebugString() << Endl; - - return 0; -} - - -TCmdCompileAndExecMiniKQLConfig::TCmdCompileAndExecMiniKQLConfig() -{} - -void TCmdCompileAndExecMiniKQLConfig::Parse(int argc, char **argv) { - using namespace NLastGetopt; - - TOpts opts = TOpts::Default(); - opts.AddLongOption('f', "pgm-txt", "path to file with text program").RequiredArgument("PATH").StoreResult(&PathToTextPgm); - opts.AddLongOption('b', "pgm-bin", "path to file with serialized program").RequiredArgument("PATH").StoreResult(&PathToBinPgm); - opts.AddLongOption("params-txt", "path to file with text program params").RequiredArgument("PATH").StoreResult(&PathToTextParams); - opts.AddLongOption("params-bin", "path to file with serialized program params").RequiredArgument("PATH").StoreResult(&PathToBinParams); - - ConfigureBaseLastGetopt(opts); - - TOptsParseResult res(&opts, argc, argv); - - ConfigureMsgBusLastGetopt(res, argc, argv); - - if (!PathToBinPgm && !PathToTextPgm) { - ythrow yexception() << "One of the ['pgm-txt', 'pgm-bin'] options must be set."; - } - if (PathToBinPgm && PathToTextPgm) { - ythrow yexception() << "Only one of the ['pgm-txt', 'pgm-bin'] options must be set."; - } -} - -} // namespace NDriverClient -} // namespace NKikimr diff --git a/ydb/core/driver_lib/cli_utils/ya.make b/ydb/core/driver_lib/cli_utils/ya.make index 114d964a27fc..e7970cd82ebf 100644 --- a/ydb/core/driver_lib/cli_utils/ya.make +++ b/ydb/core/driver_lib/cli_utils/ya.make @@ -25,7 +25,6 @@ SRCS( cli_persqueue.cpp cli_persqueue_cluster_discovery.cpp cli_persqueue_stress.cpp - cli_minikql_compile_and_exec.cpp cli_scheme_cache_append.cpp cli_scheme_initroot.cpp melancholic_gopher.cpp diff --git a/ydb/core/driver_lib/run/driver.h b/ydb/core/driver_lib/run/driver.h index 8e0ba39fc898..bdaabe64fc6c 100644 --- a/ydb/core/driver_lib/run/driver.h +++ b/ydb/core/driver_lib/run/driver.h @@ -30,7 +30,6 @@ namespace NKikimr { XX(EDM_FORMAT_UTIL, "format-util", "query blob storage format configuration file") \ XX(EDM_NODE_BY_HOST, "node-by-host", "get node id by hostname") \ XX(EDM_SCHEME_INITROOT, "scheme-initroot", "init scheme root") \ - XX(EDM_COMPILE_AND_EXEC_MINIKQL, "minikql-exec", "compile and execute MiniKQL program") \ XX(EDM_KEYVALUE_REQUEST, "keyvalue-request", "send protobuf request to a keyvalue tablet") \ XX(EDM_PERSQUEUE_REQUEST, "persqueue-request", "send protobuf request to a persqueue tablet") \ XX(EDM_PERSQUEUE_STRESS, "persqueue-stress", "stress read or write to a persqueue tablet") \ diff --git a/ydb/core/driver_lib/run/main.cpp b/ydb/core/driver_lib/run/main.cpp index 92ec423792f8..b26225fc143d 100644 --- a/ydb/core/driver_lib/run/main.cpp +++ b/ydb/core/driver_lib/run/main.cpp @@ -154,8 +154,6 @@ int MainRun(const TKikimrRunConfig& runConfig, std::shared_ptr return MainNodeByHost(cmdConf, argc, argv); case EDM_SCHEME_INITROOT: return NDriverClient::SchemeInitRoot(cmdConf, argc, argv); - case EDM_COMPILE_AND_EXEC_MINIKQL: - return NDriverClient::CompileAndExecMiniKQL(cmdConf, argc, argv); case EDM_PERSQUEUE_REQUEST: return NDriverClient::PersQueueRequest(cmdConf, argc, argv); case EDM_PERSQUEUE_STRESS: