From f48e1e268f76da88db37813751f1cf8bcd890d9f Mon Sep 17 00:00:00 2001 From: Nikolay Shumkov Date: Sat, 28 Dec 2024 17:36:52 +0300 Subject: [PATCH] Initial commit --- .../grpc_services/query/rpc_execute_query.cpp | 18 ++++++++++++++++++ ydb/public/lib/ydb_cli/commands/ydb_sql.cpp | 6 +----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ydb/core/grpc_services/query/rpc_execute_query.cpp b/ydb/core/grpc_services/query/rpc_execute_query.cpp index 1730d30a78f0..179a4e3914b6 100644 --- a/ydb/core/grpc_services/query/rpc_execute_query.cpp +++ b/ydb/core/grpc_services/query/rpc_execute_query.cpp @@ -211,6 +211,7 @@ class TExecuteQueryRPC : public TActorBootstrapped { HFunc(TEvents::TEvWakeup, Handle); HFunc(TRpcServices::TEvGrpcNextReply, Handle); HFunc(NKqp::TEvKqpExecuter::TEvStreamData, Handle); + HFunc(NKqp::TEvKqpExecuter::TEvExecuterProgress, Handle); HFunc(NKqp::TEvKqp::TEvQueryResponse, Handle); hFunc(NKikimr::NGRpcService::TEvSubscribeGrpcCancel, Handle); default: @@ -350,6 +351,23 @@ class TExecuteQueryRPC : public TActorBootstrapped { channel.SendAck(SelfId()); } + void Handle(NKqp::TEvKqpExecuter::TEvExecuterProgress::TPtr& ev, const TActorContext& ctx) { + auto& record = ev->Get()->Record; + + Ydb::Query::ExecuteQueryResponsePart response; + response.set_status(Ydb::StatusIds::SUCCESS); + if (NeedReportStats(*Request_->GetProtoRequest())) { + FillQueryStats(*response.mutable_exec_stats(), record.GetQueryStats()); + } + + TString out; + Y_PROTOBUF_SUPPRESS_NODISCARD response.SerializeToString(&out); + + FlowControl_.PushResponse(out.size()); + + Request_->SendSerializedResult(std::move(out), Ydb::StatusIds::SUCCESS); + } + void Handle(NKqp::TEvKqp::TEvQueryResponse::TPtr& ev, const TActorContext& ctx) { NDataIntegrity::LogIntegrityTrails(Request_->GetTraceId(), *Request_->GetProtoRequest(), ev, ctx); diff --git a/ydb/public/lib/ydb_cli/commands/ydb_sql.cpp b/ydb/public/lib/ydb_cli/commands/ydb_sql.cpp index abfd8377149c..c4d52b8c1e1e 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_sql.cpp +++ b/ydb/public/lib/ydb_cli/commands/ydb_sql.cpp @@ -199,11 +199,7 @@ int TCommandSql::PrintResponse(NQuery::TExecuteQueryIterator& result) { if (!streamPart.GetStats().Empty()) { const auto& queryStats = *streamPart.GetStats(); stats = queryStats.ToString(); - ast = queryStats.GetAst(); - - if (queryStats.GetPlan()) { - plan = queryStats.GetPlan(); - } + Cout << Endl << "Current statistics:" << Endl << *stats; } } } // TResultSetPrinter destructor should be called before printing stats