@@ -58,7 +58,7 @@ class TDqOutputChannel : public IDqOutputChannel {
58
58
}
59
59
60
60
ui64 GetValuesCount () const override {
61
- return SpilledRowCount + PackedRowCount + PackerCurrentRowCount ;
61
+ return SpilledRowCount + PackedRowCount + ChunkRowCount ;
62
62
}
63
63
64
64
const TDqOutputStats& GetPushStats () const override {
@@ -95,12 +95,8 @@ class TDqOutputChannel : public IDqOutputChannel {
95
95
return ;
96
96
}
97
97
98
- ui32 rows = Packer.IsBlock () ?
99
- NKikimr::NMiniKQL::TArrowBlock::From (values[width - 1 ]).GetDatum ().scalar_as <arrow::UInt64Scalar>().value
100
- : 1 ;
101
-
102
98
if (PushStats.CollectBasic ()) {
103
- PushStats.Rows += rows ;
99
+ PushStats.Rows ++ ;
104
100
PushStats.Chunks ++;
105
101
PushStats.Resume ();
106
102
}
@@ -114,8 +110,7 @@ class TDqOutputChannel : public IDqOutputChannel {
114
110
values[i] = {};
115
111
}
116
112
117
- PackerCurrentRowCount += rows;
118
- PackerCurrentChunkCount++;
113
+ ChunkRowCount++;
119
114
120
115
size_t packerSize = Packer.PackedSizeEstimate ();
121
116
if (packerSize >= MaxChunkBytes) {
@@ -125,12 +120,9 @@ class TDqOutputChannel : public IDqOutputChannel {
125
120
PushStats.Bytes += Data.back ().Buffer .Size ();
126
121
}
127
122
PackedDataSize += Data.back ().Buffer .Size ();
128
- PackedRowCount += PackerCurrentRowCount;
129
- PackedChunkCount += PackerCurrentChunkCount;
130
- Data.back ().RowCount = PackerCurrentRowCount;
131
- Data.back ().ChunkCount = PackerCurrentChunkCount;
132
- PackerCurrentRowCount = 0 ;
133
- PackerCurrentChunkCount = 0 ;
123
+ PackedRowCount += ChunkRowCount;
124
+ Data.back ().RowCount = ChunkRowCount;
125
+ ChunkRowCount = 0 ;
134
126
packerSize = 0 ;
135
127
}
136
128
@@ -142,13 +134,11 @@ class TDqOutputChannel : public IDqOutputChannel {
142
134
TDqSerializedBatch data;
143
135
data.Proto .SetTransportVersion (TransportVersion);
144
136
data.Proto .SetRows (head.RowCount );
145
- data.Proto .SetChunks (head.ChunkCount );
146
137
data.SetPayload (std::move (head.Buffer ));
147
138
Storage->Put (NextStoredId++, SaveForSpilling (std::move (data)));
148
139
149
140
PackedDataSize -= bufSize;
150
141
PackedRowCount -= head.RowCount ;
151
- PackedChunkCount -= head.ChunkCount ;
152
142
153
143
SpilledRowCount += head.RowCount ;
154
144
@@ -209,29 +199,22 @@ class TDqOutputChannel : public IDqOutputChannel {
209
199
} else if (!Data.empty ()) {
210
200
auto & packed = Data.front ();
211
201
PackedRowCount -= packed.RowCount ;
212
- PackedChunkCount -= packed.ChunkCount ;
213
202
PackedDataSize -= packed.Buffer .Size ();
214
203
data.Proto .SetRows (packed.RowCount );
215
- data.Proto .SetChunks (packed.ChunkCount );
216
204
data.SetPayload (std::move (packed.Buffer ));
217
205
Data.pop_front ();
218
206
} else {
219
- data.Proto .SetRows (PackerCurrentRowCount);
220
- data.Proto .SetChunks (PackerCurrentChunkCount);
207
+ data.Proto .SetRows (ChunkRowCount);
221
208
data.SetPayload (FinishPackAndCheckSize ());
222
- if (PushStats.CollectBasic ()) {
223
- PushStats.Bytes += data.Payload .Size ();
224
- }
225
- PackerCurrentRowCount = 0 ;
226
- PackerCurrentChunkCount = 0 ;
209
+ ChunkRowCount = 0 ;
227
210
}
228
211
229
212
DLOG (" Took " << data.RowCount () << " rows" );
230
213
231
214
if (PopStats.CollectBasic ()) {
232
215
PopStats.Bytes += data.Size ();
233
- PopStats.Rows += data.RowCount ();
234
- PopStats.Chunks ++; // pop chunks do not match push chunks
216
+ PopStats.Rows += data.RowCount ();
217
+ PopStats.Chunks ++;
235
218
if (!IsFull () || FirstStoredId == NextStoredId) {
236
219
PopStats.Resume ();
237
220
}
@@ -273,31 +256,20 @@ class TDqOutputChannel : public IDqOutputChannel {
273
256
data.Clear ();
274
257
data.Proto .SetTransportVersion (TransportVersion);
275
258
if (SpilledRowCount == 0 && PackedRowCount == 0 ) {
276
- data.Proto .SetRows (PackerCurrentRowCount);
277
- data.Proto .SetChunks (PackerCurrentChunkCount);
259
+ data.Proto .SetRows (ChunkRowCount);
278
260
data.SetPayload (FinishPackAndCheckSize ());
279
- if (PushStats.CollectBasic ()) {
280
- PushStats.Bytes += data.Payload .Size ();
281
- }
282
- PackerCurrentRowCount = 0 ;
283
- PackerCurrentChunkCount = 0 ;
261
+ ChunkRowCount = 0 ;
284
262
return true ;
285
263
}
286
264
287
265
// Repack all - thats why PopAll should never be used
288
- if (PackerCurrentRowCount ) {
266
+ if (ChunkRowCount ) {
289
267
Data.emplace_back ();
290
268
Data.back ().Buffer = FinishPackAndCheckSize ();
291
- if (PushStats.CollectBasic ()) {
292
- PushStats.Bytes += Data.back ().Buffer .Size ();
293
- }
294
269
PackedDataSize += Data.back ().Buffer .Size ();
295
- PackedRowCount += PackerCurrentRowCount;
296
- PackedChunkCount += PackerCurrentChunkCount;
297
- Data.back ().RowCount = PackerCurrentRowCount;
298
- Data.back ().ChunkCount = PackerCurrentChunkCount;
299
- PackerCurrentRowCount = 0 ;
300
- PackerCurrentChunkCount = 0 ;
270
+ PackedRowCount += ChunkRowCount;
271
+ Data.back ().RowCount = ChunkRowCount;
272
+ ChunkRowCount = 0 ;
301
273
}
302
274
303
275
NKikimr::NMiniKQL::TUnboxedValueBatch rows (OutputType);
@@ -360,9 +332,7 @@ class TDqOutputChannel : public IDqOutputChannel {
360
332
ui64 rows = GetValuesCount ();
361
333
Data.clear ();
362
334
Packer.Clear ();
363
- PackedDataSize = 0 ;
364
- SpilledRowCount = PackedRowCount = PackerCurrentRowCount = 0 ;
365
- PackedChunkCount = PackerCurrentChunkCount = 0 ;
335
+ SpilledRowCount = PackedDataSize = PackedRowCount = ChunkRowCount = 0 ;
366
336
FirstStoredId = NextStoredId;
367
337
return rows;
368
338
}
@@ -389,7 +359,6 @@ class TDqOutputChannel : public IDqOutputChannel {
389
359
struct TSerializedBatch {
390
360
TChunkedBuffer Buffer;
391
361
ui64 RowCount = 0 ;
392
- ui64 ChunkCount = 0 ;
393
362
};
394
363
std::deque<TSerializedBatch> Data;
395
364
@@ -399,10 +368,8 @@ class TDqOutputChannel : public IDqOutputChannel {
399
368
400
369
size_t PackedDataSize = 0 ;
401
370
size_t PackedRowCount = 0 ;
402
- size_t PackedChunkCount = 0 ;
403
371
404
- size_t PackerCurrentRowCount = 0 ;
405
- size_t PackerCurrentChunkCount = 0 ;
372
+ size_t ChunkRowCount = 0 ;
406
373
407
374
bool Finished = false ;
408
375
0 commit comments