MCPcopy Create free account
hub / github.com/apache/cloudberry / hashagg_reset_spill_state

Function hashagg_reset_spill_state

src/backend/executor/nodeAgg.c:3458–3491  ·  view source on GitHub ↗

* Free resources related to a spilled HashAgg. */

Source from the content-addressed store, hash-verified

3456 * Free resources related to a spilled HashAgg.
3457 */
3458static void
3459hashagg_reset_spill_state(AggState *aggstate)
3460{
3461 /* free spills from initial pass */
3462 if (aggstate->hash_spills != NULL)
3463 {
3464 int setno;
3465
3466 for (setno = 0; setno < aggstate->num_hashes; setno++)
3467 {
3468 HashAggSpill *spill = &aggstate->hash_spills[setno];
3469
3470 pfree(spill->ntuples);
3471 pfree(spill->partitions);
3472 }
3473 pfree(aggstate->hash_spills);
3474 aggstate->hash_spills = NULL;
3475 }
3476
3477 /* free batches */
3478 list_free_deep(aggstate->hash_batches);
3479 aggstate->hash_batches = NIL;
3480
3481 /* close tape set */
3482 if (aggstate->hash_tapeinfo != NULL)
3483 {
3484 HashTapeInfo *tapeinfo = aggstate->hash_tapeinfo;
3485
3486 LogicalTapeSetClose(tapeinfo->tapeset);
3487 pfree(tapeinfo->freetapes);
3488 pfree(tapeinfo);
3489 aggstate->hash_tapeinfo = NULL;
3490 }
3491}
3492
3493
3494/* -----------------

Callers 3

ExecEndAggFunction · 0.85
ExecReScanAggFunction · 0.85
ExecEagerFreeAggFunction · 0.85

Calls 3

list_free_deepFunction · 0.85
LogicalTapeSetCloseFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected