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

Function load_tuple_array

src/backend/executor/nodeGatherMerge.c:597–627  ·  view source on GitHub ↗

* Read tuple(s) for given reader in nowait mode, and load into its tuple * array, until we have MAX_TUPLE_STORE of them or would have to block. */

Source from the content-addressed store, hash-verified

595 * array, until we have MAX_TUPLE_STORE of them or would have to block.
596 */
597static void
598load_tuple_array(GatherMergeState *gm_state, int reader)
599{
600 GMReaderTupleBuffer *tuple_buffer;
601 int i;
602
603 /* Don't do anything if this is the leader. */
604 if (reader == 0)
605 return;
606
607 tuple_buffer = &gm_state->gm_tuple_buffers[reader - 1];
608
609 /* If there's nothing in the array, reset the counters to zero. */
610 if (tuple_buffer->nTuples == tuple_buffer->readCounter)
611 tuple_buffer->nTuples = tuple_buffer->readCounter = 0;
612
613 /* Try to fill additional slots in the array. */
614 for (i = tuple_buffer->nTuples; i < MAX_TUPLE_STORE; i++)
615 {
616 MinimalTuple tuple;
617
618 tuple = gm_readnext_tuple(gm_state,
619 reader,
620 true,
621 &tuple_buffer->done);
622 if (!tuple)
623 break;
624 tuple_buffer->tuple[i] = tuple;
625 tuple_buffer->nTuples++;
626 }
627}
628
629/*
630 * Store the next tuple for a given reader into the appropriate slot.

Callers 2

gather_merge_initFunction · 0.85
gather_merge_readnextFunction · 0.85

Calls 1

gm_readnext_tupleFunction · 0.85

Tested by

no test coverage detected