Skip to content

Commit

Permalink
Merge cdc885b into e2ed478
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriyPA authored Jul 2, 2024
2 parents e2ed478 + cdc885b commit 27be527
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ydb/core/kqp/proxy_service/kqp_script_executions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2109,8 +2109,8 @@ class TGetScriptExecutionResultQueryActor : public TQueryBase {
Finish(Ydb::StatusIds::INTERNAL_ERROR, "Result set row is empty");
return;
}
i64 rowSize = serializedRow->size();

i64 rowSize = serializedRow->size() + AdditionalRowSize;
if (SizeLimit && ResultSet.rows_size() && ResultSetSize + rowSize > SizeLimit) {
CancelFetchQuery();
return;
Expand All @@ -2121,11 +2121,17 @@ class TGetScriptExecutionResultQueryActor : public TQueryBase {
return;
}

ResultSetSize += rowSize;
if (!ResultSet.add_rows()->ParseFromString(*serializedRow)) {
Finish(Ydb::StatusIds::INTERNAL_ERROR, "Result set row is corrupted");
return;
}

// Initialize AdditionalRowSize
if (ResultSet.rows_size() == 1) {
AdditionalRowSize = static_cast<i64>(ResultSet.ByteSizeLong()) - ResultSetSize - rowSize;
rowSize += AdditionalRowSize;
}
ResultSetSize += rowSize;
}

if (TInstant::Now() + TDuration::Seconds(5) + GetAverageTime() >= Deadline) {
Expand Down Expand Up @@ -2161,6 +2167,7 @@ class TGetScriptExecutionResultQueryActor : public TQueryBase {
const TInstant Deadline;

i64 ResultSetSize = 0;
i64 AdditionalRowSize = 0;
Ydb::ResultSet ResultSet;
bool HasMoreResults = false;
};
Expand Down
4 changes: 4 additions & 0 deletions ydb/core/kqp/ut/federated_query/s3/kqp_federated_query_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,10 @@ Y_UNIT_TEST_SUITE(KqpFederatedQuery) {
}

Y_UNIT_TEST(ExecuteScriptWithLargeFile) {
ExecuteSelectQuery("test_bucket_execute_script_with_large_file", 65_MB, 500000);
}

Y_UNIT_TEST(ExecuteScriptWithThinFile) {
ExecuteSelectQuery("test_bucket_execute_script_with_large_file", 5_MB, 500000);
}
}
Expand Down

0 comments on commit 27be527

Please sign in to comment.