Skip to content

Commit 29e3cb4

Browse files
authored
YYQ-3398 fixed result set size counting (#6157)
1 parent f2a8da1 commit 29e3cb4

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

ydb/core/grpc_services/query/rpc_fetch_script_results.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ using TEvFetchScriptResultsRequest = TGrpcRequestNoOperationCall<Ydb::Query::Fet
2525
Ydb::Query::FetchScriptResultsResponse>;
2626

2727
constexpr i64 MAX_ROWS_LIMIT = 1000;
28-
constexpr i64 MAX_SIZE_LIMIT = 60_MB;
28+
constexpr i64 MAX_SIZE_LIMIT = 50_MB;
2929

3030
class TFetchScriptResultsRPC : public TRpcRequestActor<TFetchScriptResultsRPC, TEvFetchScriptResultsRequest, false> {
3131
public:

ydb/core/kqp/proxy_service/kqp_script_executions.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,9 +2109,9 @@ class TGetScriptExecutionResultQueryActor : public TQueryBase {
21092109
Finish(Ydb::StatusIds::INTERNAL_ERROR, "Result set row is empty");
21102110
return;
21112111
}
2112-
2112+
21132113
i64 rowSize = serializedRow->size();
2114-
if (SizeLimit && ResultSet.rows_size() && ResultSetSize + rowSize > SizeLimit) {
2114+
if (SizeLimit && ResultSet.rows_size() && ResultSetSize + rowSize + AdditionalRowSize > SizeLimit) {
21152115
CancelFetchQuery();
21162116
return;
21172117
}
@@ -2126,6 +2126,12 @@ class TGetScriptExecutionResultQueryActor : public TQueryBase {
21262126
Finish(Ydb::StatusIds::INTERNAL_ERROR, "Result set row is corrupted");
21272127
return;
21282128
}
2129+
2130+
// Initialize AdditionalRowSize
2131+
if (ResultSet.rows_size() == 1) {
2132+
AdditionalRowSize = static_cast<i64>(ResultSet.ByteSizeLong()) - ResultSetSize;
2133+
}
2134+
ResultSetSize += AdditionalRowSize;
21292135
}
21302136

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

21632169
i64 ResultSetSize = 0;
2170+
i64 AdditionalRowSize = 0;
21642171
Ydb::ResultSet ResultSet;
21652172
bool HasMoreResults = false;
21662173
};

ydb/core/kqp/ut/federated_query/s3/kqp_federated_query_ut.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,10 @@ Y_UNIT_TEST_SUITE(KqpFederatedQuery) {
17861786
}
17871787

17881788
Y_UNIT_TEST(ExecuteScriptWithLargeFile) {
1789+
ExecuteSelectQuery("test_bucket_execute_script_with_large_file", 65_MB, 500000);
1790+
}
1791+
1792+
Y_UNIT_TEST(ExecuteScriptWithThinFile) {
17891793
ExecuteSelectQuery("test_bucket_execute_script_with_large_file", 5_MB, 500000);
17901794
}
17911795
}

0 commit comments

Comments
 (0)