1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
|
/* 001 */ public Object generate(Object[] references) {
/* 002 */ return new GeneratedIteratorForCodegenStage1(references);
/* 003 */ }
/* 004 */
/* 005 */ // codegenStageId=1
/* 006 */ final class GeneratedIteratorForCodegenStage1 extends org.apache.spark.sql.execution.BufferedRowIterator {
/* 007 */ private Object[] references;
/* 008 */ private scala.collection.Iterator[] inputs;
/* 009 */ private boolean hashAgg_initAgg_0;
/* 010 */ private boolean hashAgg_bufIsNull_0;
/* 011 */ private long hashAgg_bufValue_0;
/* 012 */ private hashAgg_FastHashMap_0 hashAgg_fastHashMap_0;
/* 013 */ private org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow> hashAgg_fastHashMapIter_0;
/* 014 */ private org.apache.spark.unsafe.KVIterator hashAgg_mapIter_0;
/* 015 */ private org.apache.spark.sql.execution.UnsafeFixedWidthAggregationMap hashAgg_hashMap_0;
/* 016 */ private org.apache.spark.sql.execution.UnsafeKVExternalSorter hashAgg_sorter_0;
/* 017 */ private scala.collection.Iterator rdd_input_0;
/* 018 */ private boolean expand_resultIsNull_0;
/* 019 */ private long expand_resultValue_0;
/* 020 */ private boolean expand_resultIsNull_1;
/* 021 */ private long expand_resultValue_1;
/* 022 */ private boolean expand_resultIsNull_2;
/* 023 */ private long expand_resultValue_2;
/* 024 */ private boolean hashAgg_hashAgg_isNull_11_0;
/* 025 */ private org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter[] rdd_mutableStateArray_0 = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter[7];
/* 026 */
/* 027 */ public GeneratedIteratorForCodegenStage1(Object[] references) {
/* 028 */ this.references = references;
/* 029 */ }
/* 030 */
/* 031 */ public void init(int index, scala.collection.Iterator[] inputs) {
/* 032 */ partitionIndex = index;
/* 033 */ this.inputs = inputs;
/* 034 */
/* 035 */ rdd_input_0 = inputs[0];
/* 036 */ rdd_mutableStateArray_0[0] = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(4, 32);
/* 037 */ rdd_mutableStateArray_0[1] = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(3, 0);
/* 038 */ rdd_mutableStateArray_0[2] = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(3, 0);
/* 039 */ expand_resultIsNull_0 = true;
/* 040 */ expand_resultValue_0 = -1L;
/* 041 */ expand_resultIsNull_1 = true;
/* 042 */ expand_resultValue_1 = -1L;
/* 043 */ expand_resultIsNull_2 = true;
/* 044 */ expand_resultValue_2 = -1L;
/* 045 */ rdd_mutableStateArray_0[3] = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(4, 0);
/* 046 */ rdd_mutableStateArray_0[4] = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(4, 0);
/* 047 */ rdd_mutableStateArray_0[5] = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(3, 0);
/* 048 */ rdd_mutableStateArray_0[6] = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(4, 0);
/* 049 */
/* 050 */ }
/* 051 */
/* 052 */ public class hashAgg_FastHashMap_0 {
/* 053 */ private org.apache.spark.sql.catalyst.expressions.RowBasedKeyValueBatch batch;
/* 054 */ private int[] buckets;
/* 055 */ private int capacity = 1 << 16;
/* 056 */ private double loadFactor = 0.5;
/* 057 */ private int numBuckets = (int) (capacity / loadFactor);
/* 058 */ private int maxSteps = 2;
/* 059 */ private int numRows = 0;
/* 060 */ private Object emptyVBase;
/* 061 */ private long emptyVOff;
/* 062 */ private int emptyVLen;
/* 063 */ private boolean isBatchFull = false;
/* 064 */ private org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter agg_rowWriter;
/* 065 */
/* 066 */ public hashAgg_FastHashMap_0(
/* 067 */ org.apache.spark.memory.TaskMemoryManager taskMemoryManager,
/* 068 */ InternalRow emptyAggregationBuffer) {
/* 069 */ batch = org.apache.spark.sql.catalyst.expressions.RowBasedKeyValueBatch
/* 070 */ .allocate(((org.apache.spark.sql.types.StructType) references[1] /* keySchemaTerm */), ((org.apache.spark.sql.types.StructType) references[2] /* valueSchemaTerm */), taskMemoryManager, capacity);
/* 071 */
/* 072 */ final UnsafeProjection valueProjection = UnsafeProjection.create(((org.apache.spark.sql.types.StructType) references[2] /* valueSchemaTerm */));
/* 073 */ final byte[] emptyBuffer = valueProjection.apply(emptyAggregationBuffer).getBytes();
/* 074 */
/* 075 */ emptyVBase = emptyBuffer;
/* 076 */ emptyVOff = Platform.BYTE_ARRAY_OFFSET;
/* 077 */ emptyVLen = emptyBuffer.length;
/* 078 */
/* 079 */ agg_rowWriter = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(
/* 080 */ 3, 0);
/* 081 */
/* 082 */ buckets = new int[numBuckets];
/* 083 */ java.util.Arrays.fill(buckets, -1);
/* 084 */ }
/* 085 */
/* 086 */ public org.apache.spark.sql.catalyst.expressions.UnsafeRow findOrInsert(long hashAgg_key_0, long hashAgg_key_1, long hashAgg_key_2) {
/* 087 */ long h = hash(hashAgg_key_0, hashAgg_key_1, hashAgg_key_2);
/* 088 */ int step = 0;
/* 089 */ int idx = (int) h & (numBuckets - 1);
/* 090 */ while (step < maxSteps) {
/* 091 */ // Return bucket index if it's either an empty slot or already contains the key
/* 092 */ if (buckets[idx] == -1) {
/* 093 */ if (numRows < capacity && !isBatchFull) {
/* 094 */ agg_rowWriter.reset();
/* 095 */ agg_rowWriter.zeroOutNullBytes();
/* 096 */ agg_rowWriter.write(0, hashAgg_key_0);
/* 097 */ agg_rowWriter.write(1, hashAgg_key_1);
/* 098 */ agg_rowWriter.write(2, hashAgg_key_2);
/* 099 */ org.apache.spark.sql.catalyst.expressions.UnsafeRow agg_result
/* 100 */ = agg_rowWriter.getRow();
/* 101 */ Object kbase = agg_result.getBaseObject();
/* 102 */ long koff = agg_result.getBaseOffset();
/* 103 */ int klen = agg_result.getSizeInBytes();
/* 104 */
/* 105 */ UnsafeRow vRow
/* 106 */ = batch.appendRow(kbase, koff, klen, emptyVBase, emptyVOff, emptyVLen);
/* 107 */ if (vRow == null) {
/* 108 */ isBatchFull = true;
/* 109 */ } else {
/* 110 */ buckets[idx] = numRows++;
/* 111 */ }
/* 112 */ return vRow;
/* 113 */ } else {
/* 114 */ // No more space
/* 115 */ return null;
/* 116 */ }
/* 117 */ } else if (equals(idx, hashAgg_key_0, hashAgg_key_1, hashAgg_key_2)) {
/* 118 */ return batch.getValueRow(buckets[idx]);
/* 119 */ }
/* 120 */ idx = (idx + 1) & (numBuckets - 1);
/* 121 */ step++;
/* 122 */ }
/* 123 */ // Didn't find it
/* 124 */ return null;
/* 125 */ }
/* 126 */
/* 127 */ private boolean equals(int idx, long hashAgg_key_0, long hashAgg_key_1, long hashAgg_key_2) {
/* 128 */ UnsafeRow row = batch.getKeyRow(buckets[idx]);
/* 129 */ return (row.getLong(0) == hashAgg_key_0) && (row.getLong(1) == hashAgg_key_1) && (row.getLong(2) == hashAgg_key_2);
/* 130 */ }
/* 131 */
/* 132 */ private long hash(long hashAgg_key_0, long hashAgg_key_1, long hashAgg_key_2) {
/* 133 */ long hashAgg_hash_0 = 0;
/* 134 */
/* 135 */ long hashAgg_result_0 = hashAgg_key_0;
/* 136 */ hashAgg_hash_0 = (hashAgg_hash_0 ^ (0x9e3779b9)) + hashAgg_result_0 + (hashAgg_hash_0 << 6) + (hashAgg_hash_0 >>> 2);
/* 137 */
/* 138 */ long hashAgg_result_1 = hashAgg_key_1;
/* 139 */ hashAgg_hash_0 = (hashAgg_hash_0 ^ (0x9e3779b9)) + hashAgg_result_1 + (hashAgg_hash_0 << 6) + (hashAgg_hash_0 >>> 2);
/* 140 */
/* 141 */ long hashAgg_result_2 = hashAgg_key_2;
/* 142 */ hashAgg_hash_0 = (hashAgg_hash_0 ^ (0x9e3779b9)) + hashAgg_result_2 + (hashAgg_hash_0 << 6) + (hashAgg_hash_0 >>> 2);
/* 143 */
/* 144 */ return hashAgg_hash_0;
/* 145 */ }
/* 146 */
/* 147 */ public org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow> rowIterator() {
/* 148 */ return batch.rowIterator();
/* 149 */ }
/* 150 */
/* 151 */ public void close() {
/* 152 */ batch.close();
/* 153 */ }
/* 154 */
/* 155 */ }
/* 156 */
/* 157 */ private void expand_doConsume_0(long expand_expr_0_0, boolean expand_exprIsNull_0_0, long expand_expr_1_0, boolean expand_exprIsNull_1_0, long expand_expr_2_0, boolean expand_exprIsNull_2_0) throws java.io.IOException {
/* 158 */ for (int expand_i_0 = 0; expand_i_0 < 4; expand_i_0 ++) {
/* 159 */ switch (expand_i_0) {
/* 160 */ case 0:
/* 161 */
/* 162 */ expand_resultIsNull_0 = expand_exprIsNull_1_0;
/* 163 */ expand_resultValue_0 = expand_expr_1_0;
/* 164 */
/* 165 */ expand_resultIsNull_1 = expand_exprIsNull_2_0;
/* 166 */ expand_resultValue_1 = expand_expr_2_0;
/* 167 */
/* 168 */ expand_resultIsNull_2 = false;
/* 169 */ expand_resultValue_2 = 0L;
/* 170 */
/* 171 */ break;
/* 172 */
/* 173 */ case 1:
/* 174 */
/* 175 */ expand_resultIsNull_0 = expand_exprIsNull_1_0;
/* 176 */ expand_resultValue_0 = expand_expr_1_0;
/* 177 */
/* 178 */ expand_resultIsNull_1 = true;
/* 179 */ expand_resultValue_1 = -1L;
/* 180 */
/* 181 */ expand_resultIsNull_2 = false;
/* 182 */ expand_resultValue_2 = 1L;
/* 183 */
/* 184 */ break;
/* 185 */
/* 186 */ case 2:
/* 187 */
/* 188 */ expand_resultIsNull_0 = true;
/* 189 */ expand_resultValue_0 = -1L;
/* 190 */
/* 191 */ expand_resultIsNull_1 = expand_exprIsNull_2_0;
/* 192 */ expand_resultValue_1 = expand_expr_2_0;
/* 193 */
/* 194 */ expand_resultIsNull_2 = false;
/* 195 */ expand_resultValue_2 = 2L;
/* 196 */
/* 197 */ break;
/* 198 */
/* 199 */ case 3:
/* 200 */
/* 201 */ expand_resultIsNull_0 = true;
/* 202 */ expand_resultValue_0 = -1L;
/* 203 */
/* 204 */ expand_resultIsNull_1 = true;
/* 205 */ expand_resultValue_1 = -1L;
/* 206 */
/* 207 */ expand_resultIsNull_2 = false;
/* 208 */ expand_resultValue_2 = 3L;
/* 209 */
/* 210 */ break;
/* 211 */ }
/* 212 */ ((org.apache.spark.sql.execution.metric.SQLMetric) references[8] /* numOutputRows */).add(1);
/* 213 */
/* 214 */ hashAgg_doConsume_0(expand_expr_0_0, expand_exprIsNull_0_0, expand_resultValue_0, expand_resultIsNull_0, expand_resultValue_1, expand_resultIsNull_1, expand_resultValue_2);
/* 215 */
/* 216 */ }
/* 217 */
/* 218 */ }
/* 219 */
/* 220 */ private void hashAgg_doAggregateWithKeys_0() throws java.io.IOException {
/* 221 */ while ( rdd_input_0.hasNext()) {
/* 222 */ InternalRow rdd_row_0 = (InternalRow) rdd_input_0.next();
/* 223 */ ((org.apache.spark.sql.execution.metric.SQLMetric) references[7] /* numOutputRows */).add(1);
/* 224 */ // common sub-expressions
/* 225 */
/* 226 */ boolean rdd_isNull_2 = rdd_row_0.isNullAt(2);
/* 227 */ long rdd_value_2 = rdd_isNull_2 ?
/* 228 */ -1L : (rdd_row_0.getLong(2));
/* 229 */ boolean rdd_isNull_1 = rdd_row_0.isNullAt(1);
/* 230 */ long rdd_value_1 = rdd_isNull_1 ?
/* 231 */ -1L : (rdd_row_0.getLong(1));
/* 232 */ boolean rdd_isNull_0 = rdd_row_0.isNullAt(0);
/* 233 */ long rdd_value_0 = rdd_isNull_0 ?
/* 234 */ -1L : (rdd_row_0.getLong(0));
/* 235 */
/* 236 */ expand_doConsume_0(rdd_value_2, rdd_isNull_2, rdd_value_1, rdd_isNull_1, rdd_value_0, rdd_isNull_0);
/* 237 */ // shouldStop check is eliminated
/* 238 */ }
/* 239 */
/* 240 */ hashAgg_fastHashMapIter_0 = hashAgg_fastHashMap_0.rowIterator();
/* 241 */ hashAgg_mapIter_0 = ((org.apache.spark.sql.execution.aggregate.HashAggregateExec) references[0] /* plan */).finishAggregate(hashAgg_hashMap_0, hashAgg_sorter_0, ((org.apache.spark.sql.execution.metric.SQLMetric) references[3] /* peakMemory */), ((org.apache.spark.sql.execution.metric.SQLMetric) references[4] /* spillSize */), ((org.apache.spark.sql.execution.metric.SQLMetric) references[5] /* avgHashProbe */), ((org.apache.spark.sql.execution.metric.SQLMetric) references[6] /* numTasksFallBacked */));
/* 242 */
/* 243 */ }
/* 244 */
/* 245 */ private void hashAgg_doConsume_0(long hashAgg_expr_0_0, boolean hashAgg_exprIsNull_0_0, long hashAgg_expr_1_0, boolean hashAgg_exprIsNull_1_0, long hashAgg_expr_2_0, boolean hashAgg_exprIsNull_2_0, long hashAgg_expr_3_0) throws java.io.IOException {
/* 246 */ UnsafeRow hashAgg_unsafeRowAggBuffer_0 = null;
/* 247 */ UnsafeRow hashAgg_fastAggBuffer_0 = null;
/* 248 */
/* 249 */ if (!hashAgg_exprIsNull_1_0 && !hashAgg_exprIsNull_2_0 && !false) {
/* 250 */ hashAgg_fastAggBuffer_0 = hashAgg_fastHashMap_0.findOrInsert(
/* 251 */ hashAgg_expr_1_0, hashAgg_expr_2_0, hashAgg_expr_3_0);
/* 252 */ }
/* 253 */ // Cannot find the key in fast hash map, try regular hash map.
/* 254 */ if (hashAgg_fastAggBuffer_0 == null) {
/* 255 */ // generate grouping key
/* 256 */ rdd_mutableStateArray_0[5].reset();
/* 257 */
/* 258 */ rdd_mutableStateArray_0[5].zeroOutNullBytes();
/* 259 */
/* 260 */ if (hashAgg_exprIsNull_1_0) {
/* 261 */ rdd_mutableStateArray_0[5].setNullAt(0);
/* 262 */ } else {
/* 263 */ rdd_mutableStateArray_0[5].write(0, hashAgg_expr_1_0);
/* 264 */ }
/* 265 */
/* 266 */ if (hashAgg_exprIsNull_2_0) {
/* 267 */ rdd_mutableStateArray_0[5].setNullAt(1);
/* 268 */ } else {
/* 269 */ rdd_mutableStateArray_0[5].write(1, hashAgg_expr_2_0);
/* 270 */ }
/* 271 */
/* 272 */ rdd_mutableStateArray_0[5].write(2, hashAgg_expr_3_0);
/* 273 */ int hashAgg_unsafeRowKeyHash_0 = (rdd_mutableStateArray_0[5].getRow()).hashCode();
/* 274 */ if (true) {
/* 275 */ // try to get the buffer from hash map
/* 276 */ hashAgg_unsafeRowAggBuffer_0 =
/* 277 */ hashAgg_hashMap_0.getAggregationBufferFromUnsafeRow((rdd_mutableStateArray_0[5].getRow()), hashAgg_unsafeRowKeyHash_0);
/* 278 */ }
/* 279 */ // Can't allocate buffer from the hash map. Spill the map and fallback to sort-based
/* 280 */ // aggregation after processing all input rows.
/* 281 */ if (hashAgg_unsafeRowAggBuffer_0 == null) {
/* 282 */ if (hashAgg_sorter_0 == null) {
/* 283 */ hashAgg_sorter_0 = hashAgg_hashMap_0.destructAndCreateExternalSorter();
/* 284 */ } else {
/* 285 */ hashAgg_sorter_0.merge(hashAgg_hashMap_0.destructAndCreateExternalSorter());
/* 286 */ }
/* 287 */
/* 288 */ // the hash map had be spilled, it should have enough memory now,
/* 289 */ // try to allocate buffer again.
/* 290 */ hashAgg_unsafeRowAggBuffer_0 = hashAgg_hashMap_0.getAggregationBufferFromUnsafeRow(
/* 291 */ (rdd_mutableStateArray_0[5].getRow()), hashAgg_unsafeRowKeyHash_0);
/* 292 */ if (hashAgg_unsafeRowAggBuffer_0 == null) {
/* 293 */ // failed to allocate the first page
/* 294 */ throw new org.apache.spark.memory.SparkOutOfMemoryError("No enough memory for aggregation");
/* 295 */ }
/* 296 */ }
/* 297 */
/* 298 */ }
/* 299 */
/* 300 */ // Updates the proper row buffer
/* 301 */ if (hashAgg_fastAggBuffer_0 != null) {
/* 302 */ hashAgg_unsafeRowAggBuffer_0 = hashAgg_fastAggBuffer_0;
/* 303 */ }
/* 304 */
/* 305 */ // common sub-expressions
/* 306 */
/* 307 */ // evaluate aggregate functions and update aggregation buffers
/* 308 */
/* 309 */ hashAgg_hashAgg_isNull_11_0 = true;
/* 310 */ long hashAgg_value_12 = -1L;
/* 311 */
/* 312 */ boolean hashAgg_isNull_12 = hashAgg_unsafeRowAggBuffer_0.isNullAt(0);
/* 313 */ long hashAgg_value_13 = hashAgg_isNull_12 ?
/* 314 */ -1L : (hashAgg_unsafeRowAggBuffer_0.getLong(0));
/* 315 */
/* 316 */ if (!hashAgg_isNull_12 && (hashAgg_hashAgg_isNull_11_0 ||
/* 317 */ hashAgg_value_13 > hashAgg_value_12)) {
/* 318 */ hashAgg_hashAgg_isNull_11_0 = false;
/* 319 */ hashAgg_value_12 = hashAgg_value_13;
/* 320 */ }
/* 321 */
/* 322 */ if (!hashAgg_exprIsNull_0_0 && (hashAgg_hashAgg_isNull_11_0 ||
/* 323 */ hashAgg_expr_0_0 > hashAgg_value_12)) {
/* 324 */ hashAgg_hashAgg_isNull_11_0 = false;
/* 325 */ hashAgg_value_12 = hashAgg_expr_0_0;
/* 326 */ }
/* 327 */
/* 328 */ if (!hashAgg_hashAgg_isNull_11_0) {
/* 329 */ hashAgg_unsafeRowAggBuffer_0.setLong(0, hashAgg_value_12);
/* 330 */ } else {
/* 331 */ hashAgg_unsafeRowAggBuffer_0.setNullAt(0);
/* 332 */ }
/* 333 */
/* 334 */ }
/* 335 */
/* 336 */ private void hashAgg_doAggregateWithKeysOutput_0(UnsafeRow hashAgg_keyTerm_0, UnsafeRow hashAgg_bufferTerm_0)
/* 337 */ throws java.io.IOException {
/* 338 */ ((org.apache.spark.sql.execution.metric.SQLMetric) references[9] /* numOutputRows */).add(1);
/* 339 */
/* 340 */ boolean hashAgg_isNull_14 = hashAgg_keyTerm_0.isNullAt(0);
/* 341 */ long hashAgg_value_15 = hashAgg_isNull_14 ?
/* 342 */ -1L : (hashAgg_keyTerm_0.getLong(0));
/* 343 */ boolean hashAgg_isNull_15 = hashAgg_keyTerm_0.isNullAt(1);
/* 344 */ long hashAgg_value_16 = hashAgg_isNull_15 ?
/* 345 */ -1L : (hashAgg_keyTerm_0.getLong(1));
/* 346 */ long hashAgg_value_17 = hashAgg_keyTerm_0.getLong(2);
/* 347 */ boolean hashAgg_isNull_17 = hashAgg_bufferTerm_0.isNullAt(0);
/* 348 */ long hashAgg_value_18 = hashAgg_isNull_17 ?
/* 349 */ -1L : (hashAgg_bufferTerm_0.getLong(0));
/* 350 */
/* 351 */ rdd_mutableStateArray_0[6].reset();
/* 352 */
/* 353 */ rdd_mutableStateArray_0[6].zeroOutNullBytes();
/* 354 */
/* 355 */ if (hashAgg_isNull_14) {
/* 356 */ rdd_mutableStateArray_0[6].setNullAt(0);
/* 357 */ } else {
/* 358 */ rdd_mutableStateArray_0[6].write(0, hashAgg_value_15);
/* 359 */ }
/* 360 */
/* 361 */ if (hashAgg_isNull_15) {
/* 362 */ rdd_mutableStateArray_0[6].setNullAt(1);
/* 363 */ } else {
/* 364 */ rdd_mutableStateArray_0[6].write(1, hashAgg_value_16);
/* 365 */ }
/* 366 */
/* 367 */ rdd_mutableStateArray_0[6].write(2, hashAgg_value_17);
/* 368 */
/* 369 */ if (hashAgg_isNull_17) {
/* 370 */ rdd_mutableStateArray_0[6].setNullAt(3);
/* 371 */ } else {
/* 372 */ rdd_mutableStateArray_0[6].write(3, hashAgg_value_18);
/* 373 */ }
/* 374 */ append((rdd_mutableStateArray_0[6].getRow()));
/* 375 */
/* 376 */ }
/* 377 */
/* 378 */ protected void processNext() throws java.io.IOException {
/* 379 */ if (!hashAgg_initAgg_0) {
/* 380 */ hashAgg_initAgg_0 = true;
/* 381 */ hashAgg_fastHashMap_0 = new hashAgg_FastHashMap_0(((org.apache.spark.sql.execution.aggregate.HashAggregateExec) references[0] /* plan */).getTaskContext().taskMemoryManager(), ((org.apache.spark.sql.execution.aggregate.HashAggregateExec) references[0] /* plan */).getEmptyAggregationBuffer());
/* 382 */
/* 383 */ ((org.apache.spark.sql.execution.aggregate.HashAggregateExec) references[0] /* plan */).getTaskContext().addTaskCompletionListener(
/* 384 */ new org.apache.spark.util.TaskCompletionListener() {
/* 385 */ @Override
/* 386 */ public void onTaskCompletion(org.apache.spark.TaskContext context) {
/* 387 */ hashAgg_fastHashMap_0.close();
/* 388 */ }
/* 389 */ });
/* 390 */
/* 391 */ hashAgg_hashMap_0 = ((org.apache.spark.sql.execution.aggregate.HashAggregateExec) references[0] /* plan */).createHashMap();
/* 392 */ long wholestagecodegen_beforeAgg_0 = System.nanoTime();
/* 393 */ hashAgg_doAggregateWithKeys_0();
/* 394 */ ((org.apache.spark.sql.execution.metric.SQLMetric) references[10] /* aggTime */).add((System.nanoTime() - wholestagecodegen_beforeAgg_0) / 1000000);
/* 395 */ }
/* 396 */ // output the result
/* 397 */
/* 398 */ while ( hashAgg_fastHashMapIter_0.next()) {
/* 399 */ UnsafeRow hashAgg_aggKey_0 = (UnsafeRow) hashAgg_fastHashMapIter_0.getKey();
/* 400 */ UnsafeRow hashAgg_aggBuffer_0 = (UnsafeRow) hashAgg_fastHashMapIter_0.getValue();
/* 401 */ hashAgg_doAggregateWithKeysOutput_0(hashAgg_aggKey_0, hashAgg_aggBuffer_0);
/* 402 */
/* 403 */ if (shouldStop()) return;
/* 404 */ }
/* 405 */ hashAgg_fastHashMap_0.close();
/* 406 */
/* 407 */ while ( hashAgg_mapIter_0.next()) {
/* 408 */ UnsafeRow hashAgg_aggKey_0 = (UnsafeRow) hashAgg_mapIter_0.getKey();
/* 409 */ UnsafeRow hashAgg_aggBuffer_0 = (UnsafeRow) hashAgg_mapIter_0.getValue();
/* 410 */ hashAgg_doAggregateWithKeysOutput_0(hashAgg_aggKey_0, hashAgg_aggBuffer_0);
/* 411 */ if (shouldStop()) return;
/* 412 */ }
/* 413 */ hashAgg_mapIter_0.close();
/* 414 */ if (hashAgg_sorter_0 == null) {
/* 415 */ hashAgg_hashMap_0.free();
/* 416 */ }
/* 417 */ }
/* 418 */
/* 419 */ }
|