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

Function ExecHashTableExplainInit

src/backend/executor/nodeHash.c:2547–2571  ·  view source on GitHub ↗

* ExecHashTableExplainInit * Called after ExecHashTableCreate to set up EXPLAIN ANALYZE reporting. */

Source from the content-addressed store, hash-verified

2545 * Called after ExecHashTableCreate to set up EXPLAIN ANALYZE reporting.
2546 */
2547void
2548ExecHashTableExplainInit(HashState *hashState, HashJoinState *hjstate,
2549 HashJoinTable hashtable)
2550{
2551 MemoryContext oldcxt;
2552 int nbatch = Max(hashtable->nbatch, 1);
2553
2554 /* Switch to a memory context that survives until ExecutorEnd. */
2555 oldcxt = MemoryContextSwitchTo(hjstate->js.ps.state->es_query_cxt);
2556
2557 /* Request a callback at end of query. */
2558 hjstate->js.ps.cdbexplainfun = ExecHashTableExplainEnd;
2559
2560 /* Create workarea and attach it to the HashJoinTable. */
2561 hashtable->stats = (HashJoinTableStats *)palloc0(sizeof(*hashtable->stats));
2562 hashtable->stats->endedbatch = -1;
2563
2564 /* Create per-batch statistics array. */
2565 hashtable->stats->batchstats =
2566 (HashJoinBatchStats *)palloc0(nbatch * sizeof(hashtable->stats->batchstats[0]));
2567 hashtable->stats->nbatchstats = nbatch;
2568
2569 /* Restore caller's memory context. */
2570 MemoryContextSwitchTo(oldcxt);
2571} /* ExecHashTableExplainInit */
2572
2573
2574/*

Callers 1

ExecHashJoinImplFunction · 0.85

Calls 2

MemoryContextSwitchToFunction · 0.85
palloc0Function · 0.50

Tested by

no test coverage detected