* hashagg_finish_initial_spills * * After a HashAggBatch has been processed, it may have spilled tuples to * disk. If so, turn the spilled partitions into new batches that must later * be executed. */
| 3380 | * be executed. |
| 3381 | */ |
| 3382 | static void |
| 3383 | hashagg_finish_initial_spills(AggState *aggstate) |
| 3384 | { |
| 3385 | int setno; |
| 3386 | int total_npartitions = 0; |
| 3387 | |
| 3388 | if (aggstate->hash_spills != NULL) |
| 3389 | { |
| 3390 | for (setno = 0; setno < aggstate->num_hashes; setno++) |
| 3391 | { |
| 3392 | HashAggSpill *spill = &aggstate->hash_spills[setno]; |
| 3393 | |
| 3394 | total_npartitions += spill->npartitions; |
| 3395 | hashagg_spill_finish(aggstate, spill, setno); |
| 3396 | } |
| 3397 | |
| 3398 | /* |
| 3399 | * We're not processing tuples from outer plan any more; only |
| 3400 | * processing batches of spilled tuples. The initial spill structures |
| 3401 | * are no longer needed. |
| 3402 | */ |
| 3403 | pfree(aggstate->hash_spills); |
| 3404 | aggstate->hash_spills = NULL; |
| 3405 | } |
| 3406 | |
| 3407 | hash_agg_update_metrics(aggstate, false, total_npartitions); |
| 3408 | aggstate->hash_spill_mode = false; |
| 3409 | } |
| 3410 | |
| 3411 | /* |
| 3412 | * hashagg_spill_finish |
no test coverage detected