Skip to content

Commit

Permalink
Merge 8932c0e into c7a7fef
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriyPA authored Jul 2, 2024
2 parents c7a7fef + 8932c0e commit a490e71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ydb/core/kqp/proxy_service/kqp_script_executions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2109,9 +2109,9 @@ class TGetScriptExecutionResultQueryActor : public TQueryBase {
Finish(Ydb::StatusIds::INTERNAL_ERROR, "Result set row is empty");
return;
}

i64 rowSize = serializedRow->size();
if (SizeLimit && ResultSet.rows_size() && ResultSetSize + rowSize > SizeLimit) {
if (SizeLimit && ResultSet.rows_size() && ResultSetSize + rowSize + AdditionalRowSize > SizeLimit) {
CancelFetchQuery();
return;
}
Expand All @@ -2126,6 +2126,12 @@ class TGetScriptExecutionResultQueryActor : public TQueryBase {
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;
}
ResultSetSize += AdditionalRowSize;
}

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 a490e71

Please sign in to comment.