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

Function DatumGetExpandedArrayX

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

* As above, when caller has the ability to cache element type info */

Source from the content-addressed store, hash-verified

369 * As above, when caller has the ability to cache element type info
370 */
371ExpandedArrayHeader *
372DatumGetExpandedArrayX(Datum d, ArrayMetaState *metacache)
373{
374 /* If it's a writable expanded array already, just return it */
375 if (VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(d)))
376 {
377 ExpandedArrayHeader *eah = (ExpandedArrayHeader *) DatumGetEOHP(d);
378
379 Assert(eah->ea_magic == EA_MAGIC);
380 /* Update cache if provided */
381 if (metacache)
382 {
383 metacache->element_type = eah->element_type;
384 metacache->typlen = eah->typlen;
385 metacache->typbyval = eah->typbyval;
386 metacache->typalign = eah->typalign;
387 }
388 return eah;
389 }
390
391 /* Else expand using caller's cache if any */
392 d = expand_array(d, CurrentMemoryContext, metacache);
393 return (ExpandedArrayHeader *) DatumGetEOHP(d);
394}
395
396/*
397 * DatumGetAnyArrayP: return either an expanded array or a detoasted varlena

Callers

nothing calls this directly

Calls 2

DatumGetEOHPFunction · 0.85
expand_arrayFunction · 0.85

Tested by

no test coverage detected