@@ -247,14 +247,18 @@ struct TKiExploreTxResults {
247
247
}
248
248
}
249
249
250
- void AddResult ( const TExprBase& result ) {
250
+ void PrepareForResult ( ) {
251
251
if (QueryBlocks.empty ()) {
252
252
AddQueryBlock ();
253
253
}
254
254
255
255
if (!ConcurrentResults && QueryBlocks.back ().Results .size () > 0 ) {
256
256
AddQueryBlock ();
257
257
}
258
+ }
259
+
260
+ void AddResult (const TExprBase& result) {
261
+ PrepareForResult ();
258
262
259
263
auto & curBlock = QueryBlocks.back ();
260
264
curBlock.Results .push_back (result);
@@ -422,6 +426,10 @@ bool ExploreTx(TExprBase node, TExprContext& ctx, const TKiDataSink& dataSink, T
422
426
const auto & tableData = tablesData->ExistingTable (cluster, table);
423
427
YQL_ENSURE (tableData.Metadata );
424
428
429
+ if (!write .ReturningColumns ().Empty ()) {
430
+ txRes.PrepareForResult ();
431
+ }
432
+
425
433
if (tableOp == TYdbOperation::UpdateOn) {
426
434
auto inputColumnsSetting = GetSetting (write .Settings ().Ref (), " input_columns" );
427
435
YQL_ENSURE (inputColumnsSetting);
@@ -482,6 +490,11 @@ bool ExploreTx(TExprBase node, TExprContext& ctx, const TKiDataSink& dataSink, T
482
490
for (const auto & item : updateStructType->GetItems ()) {
483
491
updateColumns.emplace (item->GetName ());
484
492
}
493
+
494
+ if (!update.ReturningColumns ().Empty ()) {
495
+ txRes.PrepareForResult ();
496
+ }
497
+
485
498
txRes.AddUpdateOpToQueryBlock (node, tableData.Metadata , updateColumns);
486
499
if (!update.ReturningColumns ().Empty ()) {
487
500
txRes.AddResult (
@@ -517,6 +530,10 @@ bool ExploreTx(TExprBase node, TExprContext& ctx, const TKiDataSink& dataSink, T
517
530
YQL_ENSURE (tablesData);
518
531
const auto & tableData = tablesData->ExistingTable (cluster, table);
519
532
YQL_ENSURE (tableData.Metadata );
533
+ if (!del.ReturningColumns ().Empty ()) {
534
+ txRes.PrepareForResult ();
535
+ }
536
+
520
537
txRes.AddWriteOpToQueryBlock (node, tableData.Metadata , tableOp & KikimrReadOps ());
521
538
if (!del.ReturningColumns ().Empty ()) {
522
539
txRes.AddResult (
0 commit comments