Skip to content

Commit

Permalink
YQ-3157 enable batch script results by size (ydb-platform#4860)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriyPA committed May 28, 2024
1 parent 33d9048 commit c08a35f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ydb/core/fq/libs/compute/ydb/events/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,17 @@ struct TEvYdbCompute {
};

struct TEvFetchScriptResultRequest : public NActors::TEventLocal<TEvFetchScriptResultRequest, EvFetchScriptResultRequest> {
TEvFetchScriptResultRequest(const NKikimr::NOperationId::TOperationId& operationId, int64_t resultSetId, const TString& fetchToken)
TEvFetchScriptResultRequest(const NKikimr::NOperationId::TOperationId& operationId, int64_t resultSetId, const TString& fetchToken, uint64_t rowsLimit)
: OperationId(operationId)
, ResultSetId(resultSetId)
, FetchToken(fetchToken)
, RowsLimit(rowsLimit)
{}

NKikimr::NOperationId::TOperationId OperationId;
int64_t ResultSetId = 0;
TString FetchToken;
uint64_t RowsLimit = 0;
};

struct TEvFetchScriptResultResponse : public NActors::TEventLocal<TEvFetchScriptResultResponse, EvFetchScriptResultResponse> {
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/fq/libs/compute/ydb/result_writer_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class TResultSetWriterActor : public TBaseComputeActor<TResultSetWriterActor> {

void SendFetchScriptResultRequest() {
LastProcessedToken = FetchToken;
Register(new TRetryActor<TEvYdbCompute::TEvFetchScriptResultRequest, TEvYdbCompute::TEvFetchScriptResultResponse, NKikimr::NOperationId::TOperationId, int64_t, TString>(Counters.GetCounters(ERequestType::RT_FETCH_SCRIPT_RESULT), SelfId(), Connector, OperationId, ResultSetId, FetchToken));
Register(new TRetryActor<TEvYdbCompute::TEvFetchScriptResultRequest, TEvYdbCompute::TEvFetchScriptResultResponse, NKikimr::NOperationId::TOperationId, int64_t, TString, uint64_t>(Counters.GetCounters(ERequestType::RT_FETCH_SCRIPT_RESULT), SelfId(), Connector, OperationId, ResultSetId, FetchToken, 0));
}

void SendReplyAndPassAway() {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/fq/libs/compute/ydb/ydb_connector_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class TYdbConnectorActor : public NActors::TActorBootstrapped<TYdbConnectorActor
void Handle(const TEvYdbCompute::TEvFetchScriptResultRequest::TPtr& ev) {
NYdb::NQuery::TFetchScriptResultsSettings settings;
settings.FetchToken(ev->Get()->FetchToken);
settings.RowsLimit(ev->Get()->RowsLimit);
QueryClient
->FetchScriptResults(ev->Get()->OperationId, ev->Get()->ResultSetId, settings)
.Apply([actorSystem = NActors::TActivationContext::ActorSystem(), recipient = ev->Sender, cookie = ev->Cookie, database = ComputeConnection.database()](auto future) {
Expand Down

0 comments on commit c08a35f

Please sign in to comment.