Skip to content

Commit b4816e6

Browse files
GrigoriyPAgithub-actions[bot]
authored andcommitted
YQ-4235 supported runtime results for script executions (#17421)
1 parent b3c1046 commit b4816e6

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

.github/last_commit.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ec36c2f7151e1e7718c2f0c0b2292383cab01e64
1+
04801c0ba7d7f9f55f7bd7681dd03a87c221d8c2

include/ydb-cpp-sdk/client/proto/accessor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <src/api/protos/draft/ydb_replication.pb.h>
4+
#include <src/api/protos/draft/ydb_view.pb.h>
35
#include <src/api/protos/ydb_coordination.pb.h>
46
#include <src/api/protos/ydb_export.pb.h>
57
#include <src/api/protos/ydb_import.pb.h>
@@ -8,6 +10,8 @@
810
#include <src/api/protos/ydb_topic.pb.h>
911
#include <src/api/protos/ydb_value.pb.h>
1012

13+
#include <ydb-cpp-sdk/client/draft/ydb_replication.h>
14+
#include <ydb-cpp-sdk/client/draft/ydb_view.h>
1115
#include <ydb-cpp-sdk/client/coordination/coordination.h>
1216
#include <ydb-cpp-sdk/client/export/export.h>
1317
#include <ydb-cpp-sdk/client/import/import.h>
@@ -45,6 +49,8 @@ class TProtoAccessor {
4549
static const Ydb::Topic::DescribeConsumerResult& GetProto(const NYdb::NTopic::TConsumerDescription& consumerDescription);
4650
static const Ydb::Monitoring::SelfCheckResult& GetProto(const NYdb::NMonitoring::TSelfCheckResult& selfCheckResult);
4751
static const Ydb::Coordination::DescribeNodeResult& GetProto(const NYdb::NCoordination::TNodeDescription &describeNodeResult);
52+
static const Ydb::Replication::DescribeReplicationResult& GetProto(const NYdb::NReplication::TDescribeReplicationResult& desc);
53+
static const Ydb::View::DescribeViewResult& GetProto(const NYdb::NView::TDescribeViewResult& desc);
4854

4955
static NTable::TQueryStats FromProto(const Ydb::TableStats::QueryStats& queryStats);
5056
static NTable::TTableDescription FromProto(const Ydb::Table::CreateTableRequest& request);

include/ydb-cpp-sdk/client/query/query.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,21 @@ class TResultSetMeta {
124124
public:
125125
TResultSetMeta() = default;
126126

127-
explicit TResultSetMeta(const std::vector<TColumn>& columns)
127+
explicit TResultSetMeta(const std::vector<TColumn>& columns, uint64_t rowsCount = 0, bool finished = false)
128128
: Columns(columns)
129+
, RowsCount(rowsCount)
130+
, Finished(finished)
129131
{}
130132

131-
explicit TResultSetMeta(std::vector<TColumn>&& columns)
133+
explicit TResultSetMeta(std::vector<TColumn>&& columns, uint64_t rowsCount = 0, bool finished = false)
132134
: Columns(std::move(columns))
135+
, RowsCount(rowsCount)
136+
, Finished(finished)
133137
{}
134138

135139
std::vector<TColumn> Columns;
140+
uint64_t RowsCount = 0;
141+
bool Finished = false;
136142
};
137143

138144
class TScriptExecutionOperation : public TOperation {

src/api/protos/ydb_query.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ message ExecuteQueryRequest {
186186

187187
message ResultSetMeta {
188188
repeated Ydb.Column columns = 1;
189+
uint64 number_rows = 2;
190+
bool finished = 3;
189191
}
190192

191193
message ExecuteQueryResponsePart {

src/client/query/query.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ TScriptExecutionOperation::TScriptExecutionOperation(TStatus&& status, Ydb::Oper
5353
for (const auto& column : resultSetMeta.columns()) {
5454
columns.emplace_back(column.name(), column.type());
5555
}
56-
Metadata_.ResultSetsMeta.emplace_back(std::move(columns));
56+
Metadata_.ResultSetsMeta.emplace_back(std::move(columns), resultSetMeta.number_rows(), resultSetMeta.finished());
5757
}
5858

5959
if (metadata.has_script_content()) {

0 commit comments

Comments
 (0)