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

Function ExecReScanRecursiveUnion

src/backend/executor/nodeRecursiveunion.c:319–357  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecReScanRecursiveUnion * * Rescans the relation. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

317 * ----------------------------------------------------------------
318 */
319void
320ExecReScanRecursiveUnion(RecursiveUnionState *node)
321{
322 PlanState *outerPlan = outerPlanState(node);
323 PlanState *innerPlan = innerPlanState(node);
324 RecursiveUnion *plan = (RecursiveUnion *) node->ps.plan;
325
326 /*
327 * Set recursive term's chgParam to tell it that we'll modify the working
328 * table and therefore it has to rescan.
329 */
330 innerPlan->chgParam = bms_add_member(innerPlan->chgParam, plan->wtParam);
331
332 /*
333 * if chgParam of subnode is not null then plan will be re-scanned by
334 * first ExecProcNode. Because of above, we only have to do this to the
335 * non-recursive term.
336 */
337 if (outerPlan->chgParam == NULL)
338 ExecReScan(outerPlan);
339
340 /* Release any hashtable storage */
341 if (node->tableContext)
342 MemoryContextResetAndDeleteChildren(node->tableContext);
343
344 /* And rebuild empty hashtable if needed */
345 /*
346 * RECURSIVE_CTE_FIXME: It suppose plan->numCols should be 0 if we don't
347 * support recursive union. QP should fix this later.
348 */
349 if (plan->numCols > 0)
350 ResetTupleHashTable(node->hashtable);
351
352 /* reset processing state */
353 node->recursing = false;
354 node->intermediate_empty = true;
355 tuplestore_clear(node->working_table);
356 tuplestore_clear(node->intermediate_table);
357}
358
359void
360ExecSquelchRecursiveUnion(RecursiveUnionState *node, bool force)

Callers 1

ExecReScanFunction · 0.85

Calls 4

bms_add_memberFunction · 0.85
ExecReScanFunction · 0.85
ResetTupleHashTableFunction · 0.85
tuplestore_clearFunction · 0.85

Tested by

no test coverage detected