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

Function AggRegisterCallback

src/backend/executor/nodeAgg.c:5037–5052  ·  view source on GitHub ↗

* AggRegisterCallback - register a cleanup callback for an aggregate * * This is useful for aggs to register shutdown callbacks, which will ensure * that non-memory resources are freed. The callback will occur just before * the associated aggcontext (as returned by AggCheckCallContext) is reset, * either between groups or as a result of rescanning the query. The callback * will NOT be call

Source from the content-addressed store, hash-verified

5035 * As above, this is currently not useful for aggs called as window functions.
5036 */
5037void
5038AggRegisterCallback(FunctionCallInfo fcinfo,
5039 ExprContextCallbackFunction func,
5040 Datum arg)
5041{
5042 if (fcinfo->context && IsA(fcinfo->context, AggState))
5043 {
5044 AggState *aggstate = (AggState *) fcinfo->context;
5045 ExprContext *cxt = aggstate->curaggcontext;
5046
5047 RegisterExprContextCallback(cxt, func, arg);
5048
5049 return;
5050 }
5051 elog(ERROR, "aggregate function cannot register a callback in this context");
5052}
5053
5054
5055/* ----------------------------------------------------------------

Callers 1

ordered_set_startupFunction · 0.85

Calls 1

Tested by

no test coverage detected