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

Function setop_retrieve_hash_table

src/backend/executor/nodeSetOp.c:424–471  ·  view source on GitHub ↗

* ExecSetOp for hashed case: phase 2, retrieving groups from hash table */

Source from the content-addressed store, hash-verified

422 * ExecSetOp for hashed case: phase 2, retrieving groups from hash table
423 */
424static TupleTableSlot *
425setop_retrieve_hash_table(SetOpState *setopstate)
426{
427 TupleHashEntryData *entry;
428 TupleTableSlot *resultTupleSlot;
429
430 /*
431 * get state info from node
432 */
433 resultTupleSlot = setopstate->ps.ps_ResultTupleSlot;
434
435 /*
436 * We loop retrieving groups until we find one we should return
437 */
438 while (!setopstate->setop_done)
439 {
440 CHECK_FOR_INTERRUPTS();
441
442 /*
443 * Find the next entry in the hash table
444 */
445 entry = ScanTupleHashTable(setopstate->hashtable, &setopstate->hashiter);
446 if (entry == NULL)
447 {
448 /* No more entries in hashtable, so done */
449 setopstate->setop_done = true;
450 return NULL;
451 }
452
453 /*
454 * See if we should emit any copies of this tuple, and if so return
455 * the first copy.
456 */
457 set_output_count(setopstate, (SetOpStatePerGroup) entry->additional);
458
459 if (setopstate->numOutput > 0)
460 {
461 setopstate->numOutput--;
462 return ExecStoreMinimalTuple(entry->firstTuple,
463 resultTupleSlot,
464 false);
465 }
466 }
467
468 /* No more groups */
469 ExecClearTuple(resultTupleSlot);
470 return NULL;
471}
472
473/* ----------------------------------------------------------------
474 * ExecInitSetOp

Callers 1

ExecSetOpFunction · 0.85

Calls 3

set_output_countFunction · 0.85
ExecStoreMinimalTupleFunction · 0.85
ExecClearTupleFunction · 0.85

Tested by

no test coverage detected