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

Function ExecAppendAsyncRequest

src/backend/executor/nodeAppend.c:1005–1051  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecAppendAsyncRequest * * Request a tuple asynchronously. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

1003 * ----------------------------------------------------------------
1004 */
1005static bool
1006ExecAppendAsyncRequest(AppendState *node, TupleTableSlot **result)
1007{
1008 Bitmapset *needrequest;
1009 int i;
1010
1011 /* Nothing to do if there are no async subplans needing a new request. */
1012 if (bms_is_empty(node->as_needrequest))
1013 {
1014 Assert(node->as_nasyncresults == 0);
1015 return false;
1016 }
1017
1018 /*
1019 * If there are any asynchronously-generated results that have not yet
1020 * been returned, we have nothing to do; just return one of them.
1021 */
1022 if (node->as_nasyncresults > 0)
1023 {
1024 --node->as_nasyncresults;
1025 *result = node->as_asyncresults[node->as_nasyncresults];
1026 return true;
1027 }
1028
1029 /* Make a new request for each of the async subplans that need it. */
1030 needrequest = node->as_needrequest;
1031 node->as_needrequest = NULL;
1032 i = -1;
1033 while ((i = bms_next_member(needrequest, i)) >= 0)
1034 {
1035 AsyncRequest *areq = node->as_asyncrequests[i];
1036
1037 /* Do the actual work. */
1038 ExecAsyncRequest(areq);
1039 }
1040 bms_free(needrequest);
1041
1042 /* Return one of the asynchronously-generated results if any. */
1043 if (node->as_nasyncresults > 0)
1044 {
1045 --node->as_nasyncresults;
1046 *result = node->as_asyncresults[node->as_nasyncresults];
1047 return true;
1048 }
1049
1050 return false;
1051}
1052
1053/* ----------------------------------------------------------------
1054 * ExecAppendAsyncEventWait

Callers 1

ExecAppendAsyncGetNextFunction · 0.85

Calls 4

bms_is_emptyFunction · 0.85
bms_next_memberFunction · 0.85
ExecAsyncRequestFunction · 0.85
bms_freeFunction · 0.85

Tested by

no test coverage detected