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

Function EstimateParamExecSpace

src/backend/executor/execParallel.c:313–347  ·  view source on GitHub ↗

* Estimate the amount of space required to serialize the indicated parameters. */

Source from the content-addressed store, hash-verified

311 * Estimate the amount of space required to serialize the indicated parameters.
312 */
313static Size
314EstimateParamExecSpace(EState *estate, Bitmapset *params)
315{
316 int paramid;
317 Size sz = sizeof(int);
318
319 paramid = -1;
320 while ((paramid = bms_next_member(params, paramid)) >= 0)
321 {
322 Oid typeOid;
323 int16 typLen;
324 bool typByVal;
325 ParamExecData *prm;
326
327 prm = &(estate->es_param_exec_vals[paramid]);
328 typeOid = list_nth_oid(estate->es_plannedstmt->paramExecTypes,
329 paramid);
330
331 sz = add_size(sz, sizeof(int)); /* space for paramid */
332
333 /* space for datum/isnull */
334 if (OidIsValid(typeOid))
335 get_typlenbyval(typeOid, &typLen, &typByVal);
336 else
337 {
338 /* If no type OID, assume by-value, like copyParamList does. */
339 typLen = sizeof(Datum);
340 typByVal = true;
341 }
342 sz = add_size(sz,
343 datumEstimateSpace(prm->value, prm->isnull,
344 typByVal, typLen));
345 }
346 return sz;
347}
348
349/*
350 * Serialize specified PARAM_EXEC parameters.

Callers 1

SerializeParamExecParamsFunction · 0.85

Calls 5

bms_next_memberFunction · 0.85
list_nth_oidFunction · 0.85
add_sizeFunction · 0.85
get_typlenbyvalFunction · 0.85
datumEstimateSpaceFunction · 0.85

Tested by

no test coverage detected