aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhor911 <hor911@ydb.tech>2023-07-24 12:40:45 +0300
committerhor911 <hor911@ydb.tech>2023-07-24 12:40:45 +0300
commit9908c93a1412479fe215dbfa2e10b17e1e7cd0f8 (patch)
tree67957e54baa029fe557f414f6670e2efed77f080
parentb7219f203fa98a1bfab4cf250e833776845edec3 (diff)
downloadydb-9908c93a1412479fe215dbfa2e10b17e1e7cd0f8.tar.gz
Allow ResultSet reordering
-rw-r--r--ydb/core/kqp/run_script_actor/kqp_run_script_actor.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/ydb/core/kqp/run_script_actor/kqp_run_script_actor.cpp b/ydb/core/kqp/run_script_actor/kqp_run_script_actor.cpp
index 4e5d9a57bd..a124b79d52 100644
--- a/ydb/core/kqp/run_script_actor/kqp_run_script_actor.cpp
+++ b/ydb/core/kqp/run_script_actor/kqp_run_script_actor.cpp
@@ -216,18 +216,17 @@ private:
auto resultSetIndex = ev->Get()->Record.GetQueryResultIndex();
- if (resultSetIndex > ExpireAt.size()) {
- Issues.AddIssue(MakeIssue(NKikimrIssues::TIssuesIds::DEFAULT_ERROR, "Unexpected result set index"));
- Finish(Ydb::StatusIds::INTERNAL_ERROR);
- return;
- }
-
- if (resultSetIndex == ExpireAt.size()) {
- // next ResultSet arrived
+ if (resultSetIndex >= ExpireAt.size()) {
+ // we don't know result set count, so just accept all of them
+ // it's possible to have several result sets per script
+ // they can arrive in any order and may be missed for some indices
ResultSetRowCount.resize(resultSetIndex + 1);
ResultSetByteCount.resize(resultSetIndex + 1);
Truncated.resize(resultSetIndex + 1);
ExpireAt.resize(resultSetIndex + 1);
+ }
+
+ if (ExpireAt[resultSetIndex] == TInstant::Zero()) {
ExpireAt[resultSetIndex] = TInstant::Now() + TDuration::Days(1);
}