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

Function makeMdArrayResult

src/backend/utils/adt/arrayfuncs.c:5335–5369  ·  view source on GitHub ↗

* makeMdArrayResult - produce multi-D final result of accumArrayResult * * beware: no check that specified dimensions match the number of values * accumulated. * * Note: if the astate was not initialized within a separate memory context * (that is, initArrayResultWithSize was called with subcontext=false), then using * release=true is illegal. Instead, release astate along with the rest of

Source from the content-addressed store, hash-verified

5333 * release is true if okay to release working state
5334 */
5335Datum
5336makeMdArrayResult(ArrayBuildState *astate,
5337 int ndims,
5338 int *dims,
5339 int *lbs,
5340 MemoryContext rcontext,
5341 bool release)
5342{
5343 ArrayType *result;
5344 MemoryContext oldcontext;
5345
5346 /* Build the final array result in rcontext */
5347 oldcontext = MemoryContextSwitchTo(rcontext);
5348
5349 result = construct_md_array(astate->dvalues,
5350 astate->dnulls,
5351 ndims,
5352 dims,
5353 lbs,
5354 astate->element_type,
5355 astate->typlen,
5356 astate->typbyval,
5357 astate->typalign);
5358
5359 MemoryContextSwitchTo(oldcontext);
5360
5361 /* Clean up all the junk */
5362 if (release)
5363 {
5364 Assert(astate->private_cxt);
5365 MemoryContextDelete(astate->mcontext);
5366 }
5367
5368 return PointerGetDatum(result);
5369}
5370
5371/*
5372 * The following three functions provide essentially the same API as

Callers 7

plperl_array_to_datumFunction · 0.85
PLySequence_ToArrayFunction · 0.85
populate_arrayFunction · 0.85
makeArrayResultFunction · 0.85
makeArrayResultAnyFunction · 0.85
array_agg_finalfnFunction · 0.85
parseAOStorageOptsFunction · 0.85

Calls 2

MemoryContextSwitchToFunction · 0.85
construct_md_arrayFunction · 0.85

Tested by

no test coverage detected