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

Function deconstruct_expanded_array

src/backend/utils/adt/array_expanded.c:423–453  ·  view source on GitHub ↗

* Create the Datum/isnull representation of an expanded array object * if we didn't do so previously */

Source from the content-addressed store, hash-verified

421 * if we didn't do so previously
422 */
423void
424deconstruct_expanded_array(ExpandedArrayHeader *eah)
425{
426 if (eah->dvalues == NULL)
427 {
428 MemoryContext oldcxt = MemoryContextSwitchTo(eah->hdr.eoh_context);
429 Datum *dvalues;
430 bool *dnulls;
431 int nelems;
432
433 dnulls = NULL;
434 deconstruct_array(eah->fvalue,
435 eah->element_type,
436 eah->typlen, eah->typbyval, eah->typalign,
437 &dvalues,
438 ARR_HASNULL(eah->fvalue) ? &dnulls : NULL,
439 &nelems);
440
441 /*
442 * Update header only after successful completion of this step. If
443 * deconstruct_array fails partway through, worst consequence is some
444 * leaked memory in the object's context. If the caller fails at a
445 * later point, that's fine, since the deconstructed representation is
446 * valid anyhow.
447 */
448 eah->dvalues = dvalues;
449 eah->dnulls = dnulls;
450 eah->dvalueslen = eah->nelems = nelems;
451 MemoryContextSwitchTo(oldcxt);
452 }
453}

Callers 4

statext_expressions_loadFunction · 0.85
array_contain_compareFunction · 0.85

Calls 2

MemoryContextSwitchToFunction · 0.85
deconstruct_arrayFunction · 0.85

Tested by

no test coverage detected