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

Function hashagg_finish_initial_spills

src/backend/executor/nodeAgg.c:3382–3409  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

3380 * be executed.
3381 */
3382static void
3383hashagg_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

Callers 2

agg_retrieve_directFunction · 0.85
agg_fill_hash_tableFunction · 0.85

Calls 3

hashagg_spill_finishFunction · 0.85
hash_agg_update_metricsFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected