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

Function agg_retrieve_hash_table_in_memory

src/backend/executor/nodeAgg.c:3013–3130  ·  view source on GitHub ↗

* Retrieve the groups from the in-memory hash tables without considering any * spilled tuples. */

Source from the content-addressed store, hash-verified

3011 * spilled tuples.
3012 */
3013static TupleTableSlot *
3014agg_retrieve_hash_table_in_memory(AggState *aggstate)
3015{
3016 ExprContext *econtext;
3017 AggStatePerAgg peragg;
3018 AggStatePerGroup pergroup;
3019 TupleHashEntryData *entry;
3020 TupleTableSlot *firstSlot;
3021 TupleTableSlot *result;
3022 AggStatePerHash perhash;
3023
3024 /*
3025 * get state info from node.
3026 *
3027 * econtext is the per-output-tuple expression context.
3028 */
3029 econtext = aggstate->ss.ps.ps_ExprContext;
3030 peragg = aggstate->peragg;
3031 firstSlot = aggstate->ss.ss_ScanTupleSlot;
3032
3033 /*
3034 * Note that perhash (and therefore anything accessed through it) can
3035 * change inside the loop, as we change between grouping sets.
3036 */
3037 perhash = &aggstate->perhash[aggstate->current_set];
3038
3039 /*
3040 * We loop retrieving groups until we find one satisfying
3041 * aggstate->ss.ps.qual
3042 */
3043 for (;;)
3044 {
3045 TupleTableSlot *hashslot = perhash->hashslot;
3046 int i;
3047
3048 CHECK_FOR_INTERRUPTS();
3049
3050 /*
3051 * Find the next entry in the hash table
3052 */
3053 entry = ScanTupleHashTable(perhash->hashtable, &perhash->hashiter);
3054 if (entry == NULL)
3055 {
3056 int nextset = aggstate->current_set + 1;
3057
3058 if (nextset < aggstate->num_hashes)
3059 {
3060 /*
3061 * Switch to next grouping set, reinitialize, and restart the
3062 * loop.
3063 */
3064 select_current_set(aggstate, nextset, true);
3065
3066 perhash = &aggstate->perhash[aggstate->current_set];
3067
3068 ResetTupleHashIterator(perhash->hashtable, &perhash->hashiter);
3069
3070 continue;

Callers 1

agg_retrieve_hash_tableFunction · 0.85

Calls 8

select_current_setFunction · 0.85
ExecStoreMinimalTupleFunction · 0.85
slot_getallattrsFunction · 0.85
ExecClearTupleFunction · 0.85
ExecStoreVirtualTupleFunction · 0.85
prepare_projection_slotFunction · 0.85
finalize_aggregatesFunction · 0.85
project_aggregatesFunction · 0.85

Tested by

no test coverage detected