Skip to content

Commit 7e94215

Browse files
dim-anKirillKurdyukov
authored andcommitted
YT: add pagination for the GetJobStderr command (ydb-platform#8627)
1 parent fa673e2 commit 7e94215

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

ydb/library/yql/providers/dq/actors/yt/yt_wrapper.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ using namespace NYT::NApi;
2929
using namespace NActors;
3030

3131
namespace NYql {
32+
// This is compat function. YT changed returned type of IClient::GetJobStder.
33+
// This function is used to be compatible both with new and old versions.
34+
//
35+
// Can be removed once arcadia and github both use new version of YT client.
36+
template <typename T>
37+
TFuture<NYT::TSharedRef> ToStderrDataFuture(const NYT::TFuture<T>& jobStderrResponse) {
38+
if constexpr (std::is_same_v<T, NYT::TSharedRef>) {
39+
return jobStderrResponse.Apply(BIND([] (const NYT::TSharedRef& rsp) {
40+
return rsp;
41+
}));
42+
} else {
43+
// T must be TGetJobStderrResponse
44+
return jobStderrResponse.Apply(BIND([] (const T& rsp) {
45+
return rsp.Data;
46+
}));
47+
}
48+
}
49+
3250
struct TRequest: public NYT::TRefCounted {
3351
const TActorId SelfId;
3452
const TActorId Sender;
@@ -624,8 +642,8 @@ namespace NYql {
624642
for (const auto& job : result.Jobs) {
625643
YQL_CLOG(DEBUG, ProviderDq) << "Printing stderr (" << ToString(operationId) << "," << ToString(job.Id) << ")";
626644

627-
YT_UNUSED_FUTURE(cli->GetJobStderr(operationId, job.Id)
628-
.Apply(BIND([jobId = job.Id, operationId](const TSharedRef& data) {
645+
auto jobStderrData = ToStderrDataFuture(cli->GetJobStderr(operationId, job.Id));
646+
YT_UNUSED_FUTURE(jobStderrData.Apply(BIND([jobId = job.Id, operationId](const NYT::TSharedRef& data) {
629647
YQL_CLOG(DEBUG, ProviderDq)
630648
<< "Stderr ("
631649
<< ToString(operationId) << ","

0 commit comments

Comments
 (0)