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

Function DatumGetExpandedArray

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

* DatumGetExpandedArray: get a writable expanded array from an input argument * * Caution: if the input is a read/write pointer, this returns the input * argument; so callers must be sure that their changes are "safe", that is * they cannot leave the array in a corrupt state. */

Source from the content-addressed store, hash-verified

349 * they cannot leave the array in a corrupt state.
350 */
351ExpandedArrayHeader *
352DatumGetExpandedArray(Datum d)
353{
354 /* If it's a writable expanded array already, just return it */
355 if (VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(d)))
356 {
357 ExpandedArrayHeader *eah = (ExpandedArrayHeader *) DatumGetEOHP(d);
358
359 Assert(eah->ea_magic == EA_MAGIC);
360 return eah;
361 }
362
363 /* Else expand the hard way */
364 d = expand_array(d, CurrentMemoryContext, NULL);
365 return (ExpandedArrayHeader *) DatumGetEOHP(d);
366}
367
368/*
369 * As above, when caller has the ability to cache element type info

Callers 2

statext_expressions_loadFunction · 0.85

Calls 2

DatumGetEOHPFunction · 0.85
expand_arrayFunction · 0.85

Tested by

no test coverage detected